diff --git a/Justfile b/Justfile index 314eb3a..e6023c6 100644 --- a/Justfile +++ b/Justfile @@ -10,10 +10,7 @@ build: (cd $dir && wash build); \ done -version := "0.3.0" +version := "0.0.0" push: # Push to GHCR - wash push ghcr.io/cosmonic/cosmonic-gitops/wiretransfer_processmanager:{{version}} process_manager/build/wiretransfer_processmanager_s.wasm - wash push ghcr.io/cosmonic/cosmonic-gitops/bankaccount_projector:{{version}} projector/build/bankaccount_projector_s.wasm - wash push ghcr.io/cosmonic/cosmonic-gitops/bankaccount_aggregate:{{version}} aggregate/build/bankaccount_aggregate_s.wasm wash push ghcr.io/cosmonic/cosmonic-gitops/bankaccount_catalog:{{version}} eventcatalog/actor/build/bankaccountcatalog_s.wasm \ No newline at end of file diff --git a/aggregate/.cargo/config.toml b/aggregate/.cargo/config.toml deleted file mode 100644 index 4905f77..0000000 --- a/aggregate/.cargo/config.toml +++ /dev/null @@ -1,5 +0,0 @@ -[build] -target = "wasm32-unknown-unknown" - -[net] -git-fetch-with-cli = true \ No newline at end of file diff --git a/aggregate/.gitignore b/aggregate/.gitignore deleted file mode 100644 index 262ca9a..0000000 --- a/aggregate/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -# Generated by Cargo -# will have compiled files and executables -debug/ -target/ - -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock - -# These are backup files generated by rustfmt -**/*.rs.bk - -# MSVC Windows builds of rustc generate these, which store debugging information -*.pdb - -build/ diff --git a/aggregate/.keys/bankaccount_aggregate_module.nk b/aggregate/.keys/bankaccount_aggregate_module.nk deleted file mode 100644 index 54994b7..0000000 --- a/aggregate/.keys/bankaccount_aggregate_module.nk +++ /dev/null @@ -1 +0,0 @@ -SMANGOYSDZ4P3SG4GDUXECMO2J2GFOIV6NQJWGFOVA3GZBSXMGZT5GWFJ4 \ No newline at end of file diff --git a/aggregate/Cargo.toml b/aggregate/Cargo.toml deleted file mode 100644 index 40909a6..0000000 --- a/aggregate/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -[package] -name = "bankaccount-aggregate" -version = "0.3.0" -authors = ["Cosmonic Team"] -edition = "2021" - -[lib] -crate-type = ["cdylib", "rlib"] -name = "bankaccount_aggregate" - -[dependencies] -anyhow = "1.0.40" -async-trait = "0.1" -futures = { version = "0.3", features = ["executor"] } -serde_bytes = "0.11" -serde_json = "1.0.94" -serde = { version = "1.0", features = ["derive"] } -wasmbus-rpc = "0.14.0" -concordance-gen = { git = "https://github.com/cosmonic/concordance"} -wasmcloud-interface-logging = {version = "0.10.0", features = ["sync_macro"]} -regress = "0.7.1" - -[profile.release] -# Optimize for small code size -lto = true -opt-level = "s" -strip = true \ No newline at end of file diff --git a/aggregate/README.md b/aggregate/README.md deleted file mode 100644 index 4c02bb9..0000000 --- a/aggregate/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Bank Account Aggregate -This aggregate represents the sum of events on the `bankaccount` stream, which is keyed by the account number on the commands and events in this logical stream. - -# Configuration -The following configuration values should be set for this aggregate to work properly. -* `ROLE` - `aggregate` -* `INTEREST` - `bankaccount` -* `NAME` - `bankaccount` -* `KEY` - `account_number` - -# Manual Testing -You can send the following commands manually to watch the aggregate perform its tasks: - -## Creating an Account -You can use the following `nats req` command (edit the data as you see fit) to create a new account by submitting a new `create_account` command: -``` -nats req cc.commands.bankaccount '{"command_type": "create_account", "key": "ABC123", "data": {"account_number": "ABC123", "initial_balance": 4000, "min_balance": 100, "customer_id": "CUSTBOB"}}' -``` -You should receive a reply that looks something like this: -``` -11:25:05 Sending request on "cc.commands.bankaccount" -11:25:05 Received with rtt 281.083µs -{"stream":"CC_COMMANDS", "seq":2} -``` - -And now you can verify that you have indeed created the `ABC123` account (note the key is account number and not customer ID). -``` -nats kv get CC_STATE agg.bankaccount.ABC123 -CC_STATE > agg.bankaccount.ABC123 created @ 20 Mar 23 15:25 UTC - -{"balance":4000,"min_balance":100,"account_number":"ABC123"} -``` - diff --git a/aggregate/src/commands.rs b/aggregate/src/commands.rs deleted file mode 100644 index a58cba9..0000000 --- a/aggregate/src/commands.rs +++ /dev/null @@ -1,199 +0,0 @@ -use crate::*; - -pub(crate) fn handle_reserve_funds( - input: ReserveFunds, - state: Option, -) -> Result { - let Some(old_state) = state else { - return Err(anyhow::anyhow!( - "Rejected command to reserve funds. Account {} does not exist.", - input.account_number - )); - }; - let avail_balance = old_state.available_balance(); - if input.amount as u32 > avail_balance { - error!( - "Rejecting command to reserve funds, account {} does not have sufficient funds. Available {}", - &input.account_number, avail_balance - ); - Ok(vec![]) - } else { - Ok(vec![Event::new( - FundsReserved::TYPE, - STREAM, - &FundsReserved { - account_number: input.account_number.to_string(), - wire_transfer_id: input.wire_transfer_id, - customer_id: old_state.customer_id.to_string(), - amount: input.amount, - }, - )]) - } -} - -pub(crate) fn handle_release_funds( - input: ReleaseFunds, - state: Option, -) -> Result { - let Some(old_state) = state else { - return Err(anyhow::anyhow!( - "Rejected command to release funds. Account {} does not exist.", - input.account_number - )); - }; - - if old_state - .reserved_funds - .contains_key(&input.wire_transfer_id) - { - Ok(vec![Event::new( - FundsReleased::TYPE, - STREAM, - &FundsReleased { - customer_id: input.customer_id, - account_number: input.account_number.to_string(), - wire_transfer_id: input.wire_transfer_id.to_string(), - }, - )]) - } else { - error!( - "Rejecting command to release funds, account {} does not have a wire transfer hold for {}", - &input.account_number, input.wire_transfer_id - ); - Ok(vec![]) - } -} - -pub(crate) fn handle_commit_funds( - input: CommitFunds, - state: Option, -) -> Result { - let Some(old_state) = state else { - return Err(anyhow::anyhow!( - "Rejected command to commit funds. Account {} does not exist.", - input.account_number - )); - }; - - if old_state - .reserved_funds - .contains_key(&input.wire_transfer_id) - { - Ok(vec![Event::new( - FundsCommitted::TYPE, - STREAM, - &FundsCommitted { - customer_id: input.customer_id, - account_number: input.account_number.to_string(), - wire_transfer_id: input.wire_transfer_id.to_string(), - }, - )]) - } else { - error!( - "Rejecting command to commit funds, account {} does not have a wire transfer hold for {}", - &input.account_number, input.wire_transfer_id - ); - Ok(vec![]) - } -} - -pub(crate) fn handle_create_account(input: CreateAccount) -> Result { - Ok(vec![Event::new( - AccountCreated::TYPE, - STREAM, - &AccountCreated { - initial_balance: input.initial_balance, - account_number: input.account_number.to_string(), - min_balance: input.min_balance, - customer_id: input.customer_id, - }, - )]) -} - -pub(crate) fn handle_withdraw_funds( - input: WithdrawFunds, - state: Option, -) -> Result { - let Some(state) = state else { - return Err(anyhow::anyhow!( - "Rejected command to withdraw funds. Account {} does not exist.", - input.account_number - )); - }; - - if state.available_balance() < input.amount as u32 { - error!( - "Rejecting command to withdraw funds, account {} does not have sufficient funds. Available {}", - &input.account_number, state.available_balance() - ); - Ok(vec![]) - } else { - Ok(vec![Event::new( - FundsWithdrawn::TYPE, - STREAM, - &FundsWithdrawn { - note: input.note, - account_number: input.account_number.to_string(), - amount: input.amount, - customer_id: input.customer_id, - }, - )]) - } -} - -pub(crate) fn handle_wire_funds( - input: WireFunds, - state: Option, -) -> Result { - let Some(state) = state else { - return Err(anyhow::anyhow!( - "Rejected command to wire funds. Account {} does not exist.", - input.account_number - )); - }; - - if state.available_balance() < input.amount as u32 { - error!( - "Rejecting command to wire funds, account {} does not have sufficient funds. Available {}", - &input.account_number, state.available_balance() - ); - Ok(vec![]) - } else { - Ok(vec![Event::new( - WireTransferInitiated::TYPE, - STREAM, - &WireTransferInitiated { - note: input.note, - account_number: input.target_account_number, - target_routing_number: input.target_routing_number, - target_account_number: input.account_number, - amount: input.amount, - customer_id: input.customer_id, - wire_transfer_id: input.wire_transaction_id, - }, - )]) - } -} - -pub(crate) fn handle_deposit_funds( - input: DepositFunds, - state: Option, -) -> Result { - if state.is_none() { - return Err(anyhow::anyhow!( - "Rejected command to deposit funds. Account {} does not exist.", - input.account_number - )); - }; - - Ok(vec![Event::new( - FundsDeposited::TYPE, - STREAM, - &FundsDeposited { - note: input.note, - account_number: input.account_number.to_string(), - amount: input.amount, - customer_id: input.customer_id, - }, - )]) -} diff --git a/aggregate/src/events.rs b/aggregate/src/events.rs deleted file mode 100644 index 95541fa..0000000 --- a/aggregate/src/events.rs +++ /dev/null @@ -1,119 +0,0 @@ -use crate::*; - -impl From for BankAccountAggregateState { - fn from(input: AccountCreated) -> BankAccountAggregateState { - BankAccountAggregateState { - balance: input.initial_balance.unwrap_or(0) as _, - min_balance: input.min_balance.unwrap_or(0) as _, - account_number: input.account_number, - customer_id: input.customer_id, - reserved_funds: HashMap::new(), - } - } -} - -pub(crate) fn apply_account_created(input: AccountCreated) -> Result { - Ok(StateAck::ok(Some(BankAccountAggregateState::from(input)))) -} - -pub(crate) fn apply_funds_deposited( - input: FundsDeposited, - state: Option, -) -> Result { - let Some(state) = state else { - error!( - "Rejecting funds deposited event. Account {} does not exist.", - input.account_number - ); - return Ok(StateAck::error( - "Account does not exist", - None::, - )); - }; - let state = BankAccountAggregateState { - balance: state.balance + input.amount as u32, - ..state - }; - Ok(StateAck::ok(Some(state))) -} - -pub(crate) fn apply_funds_released( - input: FundsReleased, - state: Option, -) -> Result { - let Some(state) = state else { - error!( - "Rejecting funds released event. Account {} does not exist.", - input.account_number - ); - return Ok(StateAck::error( - "Account does not exist", - None::, - )); - }; - let state = state.release_funds(&input.wire_transfer_id); - Ok(StateAck::ok(Some(state))) -} - -pub(crate) fn apply_funds_committed( - input: FundsCommitted, - state: Option, -) -> Result { - let Some(state) = state else { - error!( - "Rejecting funds committed event. Account {} does not exist.", - input.account_number - ); - return Ok(StateAck::error( - "Account does not exist", - None::, - )); - }; - let state = state.commit_funds(&input.wire_transfer_id); - Ok(StateAck::ok(Some(state))) -} - -pub(crate) fn apply_funds_reserved( - input: FundsReserved, - state: Option, -) -> Result { - let Some(state) = state else { - error!( - "Rejecting funds reserved event. Account {} does not exist.", - input.account_number - ); - return Ok(StateAck::error( - "Account does not exist", - None::, - )); - }; - let state = state.reserve_funds(&input.wire_transfer_id, input.amount as u32); - Ok(StateAck::ok(Some(state))) -} - -pub(crate) fn apply_funds_withdrawn( - input: FundsWithdrawn, - state: Option, -) -> Result { - let Some(state) = state else { - error!( - "Rejecting funds withdrawn event. Account {} does not exist.", - input.account_number - ); - return Ok(StateAck::error( - "Account does not exist", - None::, - )); - }; - let state = state.withdraw(input.amount as u32); - Ok(StateAck::ok(Some(state))) -} - -pub(crate) fn apply_wire_transfer_initiated( - _input: WireTransferInitiated, - state: Option, -) -> Result { - // We don't currently change internal state because of this. The first time a wire transfer - // impacts the the account is when funds are reserved (by the process manager) - Ok(StateAck::ok(state)) -} diff --git a/aggregate/src/lib.rs b/aggregate/src/lib.rs deleted file mode 100644 index efbdc1f..0000000 --- a/aggregate/src/lib.rs +++ /dev/null @@ -1,136 +0,0 @@ -use anyhow::Result; -use std::collections::HashMap; - -use serde::{Deserialize, Serialize}; -use wasmcloud_interface_logging::error; - -mod commands; -mod events; -mod state; - -use state::BankAccountAggregateState; - -concordance_gen::generate!({ - path: "../eventcatalog", - role: "aggregate", - entity: "bank account" -}); - -impl BankAccountAggregate for BankAccountAggregateImpl { - // -- Commands -- - fn handle_reserve_funds( - &self, - input: ReserveFunds, - state: Option, - ) -> anyhow::Result { - commands::handle_reserve_funds(input, state) - } - - fn handle_release_funds( - &self, - input: ReleaseFunds, - state: Option, - ) -> anyhow::Result { - commands::handle_release_funds(input, state) - } - - fn handle_commit_funds( - &self, - input: CommitFunds, - state: Option, - ) -> anyhow::Result { - commands::handle_commit_funds(input, state) - } - - fn handle_create_account( - &self, - input: CreateAccount, - _state: Option, - ) -> anyhow::Result { - commands::handle_create_account(input) - } - - fn handle_withdraw_funds( - &self, - input: WithdrawFunds, - state: Option, - ) -> anyhow::Result { - commands::handle_withdraw_funds(input, state) - } - - fn handle_wire_funds( - &self, - input: WireFunds, - state: Option, - ) -> anyhow::Result { - commands::handle_wire_funds(input, state) - } - - fn handle_deposit_funds( - &self, - input: DepositFunds, - state: Option, - ) -> anyhow::Result { - commands::handle_deposit_funds(input, state) - } - - // -- Events -- - - fn apply_account_created( - &self, - input: AccountCreated, - _state: Option, - ) -> anyhow::Result { - events::apply_account_created(input) - } - - fn apply_funds_deposited( - &self, - input: FundsDeposited, - state: Option, - ) -> anyhow::Result { - events::apply_funds_deposited(input, state) - } - - fn apply_funds_released( - &self, - input: FundsReleased, - state: Option, - ) -> anyhow::Result { - events::apply_funds_released(input, state) - } - - fn apply_funds_committed( - &self, - input: FundsCommitted, - state: Option, - ) -> anyhow::Result { - events::apply_funds_committed(input, state) - } - - fn apply_funds_reserved( - &self, - input: FundsReserved, - state: Option, - ) -> anyhow::Result { - events::apply_funds_reserved(input, state) - } - - fn apply_funds_withdrawn( - &self, - input: FundsWithdrawn, - state: Option, - ) -> anyhow::Result { - events::apply_funds_withdrawn(input, state) - } - - fn apply_wire_transfer_initiated( - &self, - input: WireTransferInitiated, - state: Option, - ) -> anyhow::Result { - events::apply_wire_transfer_initiated(input, state) - } -} - -const STREAM: &str = "bankaccount"; diff --git a/aggregate/src/state.rs b/aggregate/src/state.rs deleted file mode 100644 index b3aaa9c..0000000 --- a/aggregate/src/state.rs +++ /dev/null @@ -1,69 +0,0 @@ -use crate::*; - -#[derive(Serialize, Deserialize, Default, Debug, Clone)] -pub struct BankAccountAggregateState { - pub balance: u32, // CENTS - pub min_balance: u32, - pub account_number: String, - pub customer_id: String, - pub reserved_funds: HashMap, // wire_transfer_id -> amount -} - -impl BankAccountAggregateState { - /// Returns the regular balance minus the sum of transfer holds - pub fn available_balance(&self) -> u32 { - self.balance - .checked_sub(self.reserved_funds.values().sum::()) - .unwrap_or(0) - } - - /// Returns the total amount of funds on hold - pub fn total_reserved(&self) -> u32 { - self.reserved_funds.values().sum::() - } - - /// Releases the funds associated with a wire transfer hold. Has no affect on actual balance, only available - pub fn release_funds(self, reservation_id: &str) -> Self { - let mut new_state = self.clone(); - new_state.reserved_funds.remove(reservation_id); - - new_state - } - - /// Adds a reservation hold for a given wire transfer. Has no affect on actual balance, only available - pub fn reserve_funds(self, reservation_id: &str, amount: u32) -> Self { - let mut new_state = self.clone(); - new_state - .reserved_funds - .insert(reservation_id.to_string(), amount); - new_state - } - - /// Commits held funds. Subtracts held funds from balance. Note: A more realistic banking - /// app might emit an overdrawn/overdraft event if the new balance is less than 0. Here we - /// just floor the balance at 0. Also note that overcommits shouldn't happen because we reject - /// attempts to hold beyond available funds - pub fn commit_funds(self, reservation_id: &str) -> Self { - let mut new_state = self.clone(); - let amount = new_state.reserved_funds.remove(reservation_id).unwrap_or(0); - new_state.balance = new_state.balance.checked_sub(amount).unwrap_or(0); - new_state - } - - /// Withdraws a given amount of funds - pub fn withdraw(self, amount: u32) -> Self { - let mut new_state = self.clone(); - new_state.balance = new_state.balance.checked_sub(amount).unwrap_or(0); - new_state - } - - /// Deposits a given amount of funds. Ceilings at u32::MAX - pub fn deposit(self, amount: u32) -> Self { - let mut new_state = self.clone(); - new_state.balance = new_state - .balance - .checked_add(amount) - .unwrap_or(new_state.balance); - new_state - } -} diff --git a/aggregate/wasmcloud.toml b/aggregate/wasmcloud.toml deleted file mode 100644 index ecd3909..0000000 --- a/aggregate/wasmcloud.toml +++ /dev/null @@ -1,7 +0,0 @@ -name = "BankAccountAggregate" -language = "rust" -type = "actor" - -[actor] -key_directory = "./.keys" -claims = ["cosmonic:eventsourcing", "wasmcloud:builtin:logging"] diff --git a/eventcatalog/README.md b/eventcatalog/README.md index c0caa4f..086c479 100644 --- a/eventcatalog/README.md +++ b/eventcatalog/README.md @@ -17,7 +17,3 @@ npm run build cd actor wash build ``` - -## All Events - -![All Bank Account Events](./all_events.png) diff --git a/eventcatalog/all_events.png b/eventcatalog/all_events.png deleted file mode 100644 index dae3e9e..0000000 Binary files a/eventcatalog/all_events.png and /dev/null differ diff --git a/eventcatalog/events/AccountCreated/index.md b/eventcatalog/events/AccountCreated/index.md deleted file mode 100644 index 454140b..0000000 --- a/eventcatalog/events/AccountCreated/index.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: AccountCreated -summary: "Indicates the creation of a new bank account" -version: 0.0.1 -consumers: - - 'Bank Account Aggregate' - - 'Bank Account Projector' -producers: - - 'Bank Account Aggregate' -tags: - - label: 'event' -externalLinks: [] -badges: [] ---- -Indicates that a bank account has been created. As with all events, this is immutable truth. - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/AccountCreated/schema.json b/eventcatalog/events/AccountCreated/schema.json deleted file mode 100644 index 32d1bd2..0000000 --- a/eventcatalog/events/AccountCreated/schema.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/AccountCreated.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "AccountCreated", - "type": "object", - "properties": { - "accountNumber": { - "type": "string", - "description": "The account number of the new account" - }, - "minBalance": { - "type": "integer", - "description": "The minimum required maintenance balance for the account" - }, - "initialBalance": { - "type": "integer", - "description": "Initial deposit amount for the account" - }, - "customerId": { - "type": "string", - "description": "The ID of the customer" - } - }, - "required": ["accountNumber", "customerId"] - } - \ No newline at end of file diff --git a/eventcatalog/events/CommitFunds/index.md b/eventcatalog/events/CommitFunds/index.md deleted file mode 100644 index ec7caa0..0000000 --- a/eventcatalog/events/CommitFunds/index.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: CommitFunds -summary: "A request to commit funds under hold to a wire transfer" -version: 0.0.1 -consumers: - - 'Bank Account Aggregate' -producers: - - 'Wire Transfer Process Manager' -tags: - - label: 'command' -externalLinks: [] -badges: [] ---- -A request to commit the funds currently on hold for a given wire transfer. - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/CommitFunds/schema.json b/eventcatalog/events/CommitFunds/schema.json deleted file mode 100644 index dc6a4db..0000000 --- a/eventcatalog/events/CommitFunds/schema.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/CommitFunds.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "CommitFunds", - "type": "object", - "properties": { - "accountNumber": { - "type": "string", - "description": "The account number" - }, - "customerId": { - "type": "string", - "description": "The ID of the customer performing the withdrawal" - }, - "wireTransferId": { - "type": "string", - "description": "A unique ID identifying the wire transfer transaction" - } - }, - "required": ["accountNumber", "customerId", "wireTransferId"] - } - \ No newline at end of file diff --git a/eventcatalog/events/CreateAccount/index.md b/eventcatalog/events/CreateAccount/index.md deleted file mode 100644 index ba54d68..0000000 --- a/eventcatalog/events/CreateAccount/index.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: CreateAccount -summary: "Requests the creation of a new bank account" -version: 0.0.1 -consumers: - - 'Bank Account Aggregate' -tags: - - label: 'command' -externalLinks: [] -badges: [] ---- -Requests the creation of a new bank account. This command can fail to process if the parameters are invalid or if the account already exists. - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/CreateAccount/schema.json b/eventcatalog/events/CreateAccount/schema.json deleted file mode 100644 index 8dabe27..0000000 --- a/eventcatalog/events/CreateAccount/schema.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/CreateAccount.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "CreateAccount", - "type": "object", - "properties": { - "accountNumber": { - "type": "string", - "description": "The account number to be created" - }, - "minBalance": { - "type": "integer", - "description": "The minimum required maintenance balance for the account" - }, - "initialBalance": { - "type": "integer", - "description": "Initial deposit amount for the account" - }, - "customerId": { - "type": "string", - "description": "The ID of the customer" - } - }, - "required": ["accountNumber", "customerId"] -} diff --git a/eventcatalog/events/DepositFunds/index.md b/eventcatalog/events/DepositFunds/index.md deleted file mode 100644 index c744127..0000000 --- a/eventcatalog/events/DepositFunds/index.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: DepositFunds -summary: "A request to deposit funds into an account" -version: 0.0.1 -consumers: - - 'Bank Account Aggregate' -tags: - - label: 'command' -externalLinks: [] -badges: [] ---- -Requests the deposit of a specified amount into the account. This command can fail to process if the parameters are invalid. - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/DepositFunds/schema.json b/eventcatalog/events/DepositFunds/schema.json deleted file mode 100644 index ad2a2cc..0000000 --- a/eventcatalog/events/DepositFunds/schema.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/DepositFunds.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "DepositFunds", - "type": "object", - "properties": { - "accountNumber": { - "type": "string", - "description": "The account number" - }, - "amount": { - "type": "integer", - "description": "The amount to deposit" - }, - "note": { - "type": "string", - "description": "An optional note to be associated with the deposit" - }, - "customerId": { - "type": "string", - "description": "The ID of the customer performing the deposit" - }, - "transferId": { - "type": "string", - "description": "A unique ID identifying the transfer transaction if applicable" - } - }, - "required": ["accountNumber", "amount", "customerId"] - } - \ No newline at end of file diff --git a/eventcatalog/events/FundsCommitted/index.md b/eventcatalog/events/FundsCommitted/index.md deleted file mode 100644 index dfa1b00..0000000 --- a/eventcatalog/events/FundsCommitted/index.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: FundsCommitted -summary: "Indicates that reserved funds were committed and withdrawn" -version: 0.0.1 -consumers: - - 'Bank Account Aggregate' - - 'Wire Transfer Process Manager' -producers: - - 'Bank Account Aggregate' -tags: - - label: 'event' -externalLinks: [] -badges: [] ---- -Indicates that previously held funds were withdrawn from the account. In the interest of simplicity, this example doesn't support partially committed funds or funds that are required to clear in increments of some small value. - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/FundsCommitted/schema.json b/eventcatalog/events/FundsCommitted/schema.json deleted file mode 100644 index 06eb023..0000000 --- a/eventcatalog/events/FundsCommitted/schema.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/FundsCommitted.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "FundsCommitted", - "type": "object", - "properties": { - "accountNumber": { - "type": "string", - "description": "The account number" - }, - "customerId": { - "type": "string", - "description": "The ID of the customer" - }, - "wireTransferId": { - "type": "string", - "description": "A unique ID identifying the wire transfer transaction" - } - }, - "required": ["accountNumber", "customerId", "wireTransferId"] - } - \ No newline at end of file diff --git a/eventcatalog/events/FundsDeposited/index.md b/eventcatalog/events/FundsDeposited/index.md deleted file mode 100644 index 5093f99..0000000 --- a/eventcatalog/events/FundsDeposited/index.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: FundsDeposited -summary: "Indicates funds have been deposited into an account" -version: 0.0.1 -consumers: - - 'Bank Account Aggregate' - - 'Bank Account Projector' -producers: - - 'Bank Account Aggregate' -tags: - - label: 'event' -externalLinks: [] -badges: [] ---- -Indicates that funds have been deposited into an account. - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/FundsDeposited/schema.json b/eventcatalog/events/FundsDeposited/schema.json deleted file mode 100644 index e3a8211..0000000 --- a/eventcatalog/events/FundsDeposited/schema.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/FundsDeposited.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "FundsDeposited", - "type": "object", - "properties": { - "accountNumber": { - "type": "string", - "description": "The account number" - }, - "amount": { - "type": "integer", - "description": "The amount deposited" - }, - "note": { - "type": "string", - "description": "An optional note to associated with the deposit" - }, - "customerId": { - "type": "string", - "description": "The ID of the customer that performed the deposit" - } - }, - "required": ["accountNumber", "amount", "customerId"] - } - \ No newline at end of file diff --git a/eventcatalog/events/FundsReleased/index.md b/eventcatalog/events/FundsReleased/index.md deleted file mode 100644 index af8ed44..0000000 --- a/eventcatalog/events/FundsReleased/index.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: FundsReleased -summary: "Indicates that reserved funds were released" -version: 0.0.1 -consumers: - - 'Bank Account Aggregate' - - 'Wire Transfer Process Manager' - - 'Bank Account Projector' -producers: - - 'Bank Account Aggregate' -tags: - - label: 'event' -externalLinks: [] -badges: [] ---- -Indicates that held funds were released as part of a failed or canceled transfer. - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/FundsReleased/schema.json b/eventcatalog/events/FundsReleased/schema.json deleted file mode 100644 index f23c698..0000000 --- a/eventcatalog/events/FundsReleased/schema.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/FundsReleased.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "FundsReleased", - "type": "object", - "properties": { - "accountNumber": { - "type": "string", - "description": "The account number" - }, - "customerId": { - "type": "string", - "description": "The ID of the customer" - }, - "wireTransferId": { - "type": "string", - "description": "A unique ID identifying the wire transfer transaction" - } - }, - "required": ["accountNumber", "customerId", "wireTransferId"] - } - \ No newline at end of file diff --git a/eventcatalog/events/FundsReserved/index.md b/eventcatalog/events/FundsReserved/index.md deleted file mode 100644 index cc6378d..0000000 --- a/eventcatalog/events/FundsReserved/index.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: FundsReserved -summary: "Indicates funds have been placed on hold for a wire transfer" -version: 0.0.1 -consumers: - - 'Bank Account Aggregate' - - 'Wire Transfer Process Manager' - - 'Bank Account Projector' -producers: - - 'Bank Account Aggregate' -tags: - - label: 'event' -externalLinks: [] -badges: [] ---- -Indicates that the funds to be used in a wire transfer have been reserved/placed on hold. - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/FundsReserved/schema.json b/eventcatalog/events/FundsReserved/schema.json deleted file mode 100644 index 5c28d49..0000000 --- a/eventcatalog/events/FundsReserved/schema.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/FundsReserved.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "FundsReserved", - "type": "object", - "properties": { - "accountNumber": { - "type": "string", - "description": "The account number" - }, - "amount": { - "type": "integer", - "description": "The amount reserved" - }, - "customerId": { - "type": "string", - "description": "The ID of the customer" - }, - "wireTransferId": { - "type": "string", - "description": "A unique ID identifying the wire transfer transaction" - } - }, - "required": ["accountNumber", "amount", "customerId", "wireTransferId"] - } - \ No newline at end of file diff --git a/eventcatalog/events/FundsWithdrawn/index.md b/eventcatalog/events/FundsWithdrawn/index.md deleted file mode 100644 index b1dbc81..0000000 --- a/eventcatalog/events/FundsWithdrawn/index.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: FundsWithdrawn -summary: "Indicates a successful withdrawal of funds" -version: 0.0.1 -consumers: - - 'Bank Account Aggregate' - - 'Bank Account Projector' -producers: - - 'Bank Account Aggregate' -tags: - - label: 'event' -externalLinks: [] -badges: [] ---- -Indicates funds have been withdrawn from the account - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/FundsWithdrawn/schema.json b/eventcatalog/events/FundsWithdrawn/schema.json deleted file mode 100644 index 8f6f7ec..0000000 --- a/eventcatalog/events/FundsWithdrawn/schema.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/FundsWithdrawn.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "FundsWithdrawn", - "type": "object", - "properties": { - "accountNumber": { - "type": "string", - "description": "The account number" - }, - "amount": { - "type": "integer", - "description": "The amount withdrawn" - }, - "note": { - "type": "string", - "description": "An optional note associated with the withdrawal" - }, - "customerId": { - "type": "string", - "description": "The ID of the customer that performed the withdrawal" - } - }, - "required": ["accountNumber", "amount", "customerId"] - } - \ No newline at end of file diff --git a/eventcatalog/events/ReleaseFunds/index.md b/eventcatalog/events/ReleaseFunds/index.md deleted file mode 100644 index 3c39437..0000000 --- a/eventcatalog/events/ReleaseFunds/index.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: ReleaseFunds -summary: "A request to release funds from a wire transfer" -version: 0.0.1 -consumers: - - 'Bank Account Aggregate' -producers: - - 'Wire Transfer Process Manager' -tags: - - label: 'command' -externalLinks: [] -badges: [] ---- -Requests that funds held for a given wire transfer are to be released. Note that this command can be rejected if no such -wire transfer is known to the aggregate. - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/ReleaseFunds/schema.json b/eventcatalog/events/ReleaseFunds/schema.json deleted file mode 100644 index 3c7d79b..0000000 --- a/eventcatalog/events/ReleaseFunds/schema.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/ReleaseFunds.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "ReleaseFunds", - "type": "object", - "description": "A request to release funds from a wire transfer", - "properties": { - "accountNumber": { - "type": "string", - "description": "The account number" - }, - "customerId": { - "type": "string", - "description": "The ID of the customer" - }, - "wireTransferId": { - "type": "string", - "description": "A unique ID identifying the wire transfer transaction" - } - }, - "required": ["accountNumber", "customerId", "wireTransferId"] - } - \ No newline at end of file diff --git a/eventcatalog/events/ReserveFunds/index.md b/eventcatalog/events/ReserveFunds/index.md deleted file mode 100644 index bb71ec4..0000000 --- a/eventcatalog/events/ReserveFunds/index.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: ReserveFunds -summary: "A request to place wire transfer funds on hold" -version: 0.0.1 -consumers: - - 'Bank Account Aggregate' -producers: - - 'Wire Transfer Process Manager' -tags: - - label: 'command' -externalLinks: [] -badges: [] ---- -A request to place on hold the funds to be involved in a given wire transfer - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/ReserveFunds/schema.json b/eventcatalog/events/ReserveFunds/schema.json deleted file mode 100644 index 14ec612..0000000 --- a/eventcatalog/events/ReserveFunds/schema.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/ReserveFunds.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "ReserveFunds", - "type": "object", - "properties": { - "accountNumber": { - "type": "string", - "description": "The account number" - }, - "amount": { - "type": "integer", - "description": "The amount to reserve" - }, - "customerId": { - "type": "string", - "description": "The ID of the customer performing the withdrawal" - }, - "wireTransferId": { - "type": "string", - "description": "A unique ID identifying the wire transfer transaction" - } - }, - "required": ["accountNumber", "amount", "customerId", "wireTransferId"] - } - \ No newline at end of file diff --git a/eventcatalog/events/WireFunds/index.md b/eventcatalog/events/WireFunds/index.md deleted file mode 100644 index 42423cd..0000000 --- a/eventcatalog/events/WireFunds/index.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: WireFunds -summary: "A request to wire funds to another account at another bank" -version: 0.0.1 -consumers: - - 'Bank Account Aggregate' -tags: - - label: 'command' -externalLinks: [] -badges: [] ---- -Requests the wiring of a specified amount to another account at another bank. This command can fail to process if the parameters are invalid or if the source account does not have sufficient funds. This will result in the _holding_ of the funds until the wire is completed or cancelled. - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/WireFunds/schema.json b/eventcatalog/events/WireFunds/schema.json deleted file mode 100644 index 7838c57..0000000 --- a/eventcatalog/events/WireFunds/schema.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/WireFunds.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "WireFunds", - "type": "object", - "properties": { - "accountNumber": { - "type": "string", - "description": "The source account number" - }, - "amount": { - "type": "integer", - "description": "The amount to be transferred to the target account" - }, - "note": { - "type": "string", - "description": "An optional note to be associated with the wire transfer" - }, - "customerId": { - "type": "string", - "description": "The ID of the customer performing the transfer" - }, - "wireTransactionId": { - "type": "string", - "description": "A unique ID identifying the wire transfer transaction" - }, - "targetRoutingNumber": { - "type": "string", - "description": "The routing number of the target bank" - }, - "targetAccountNumber": { - "type": "string", - "description": "The account number of the target account" - } - }, - "required": [ - "accountNumber", - "amount", - "customerId", - "wireTransactionId", - "targetRoutingNumber", - "targetAccountNumber" - ] -} diff --git a/eventcatalog/events/WireTransferFailed/index.md b/eventcatalog/events/WireTransferFailed/index.md deleted file mode 100644 index 6ddb412..0000000 --- a/eventcatalog/events/WireTransferFailed/index.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: WireTransferFailed -summary: "Indicates that a wire transfer process failed" -version: 0.0.1 -consumers: - - 'Wire Transfer Process Manager' -tags: - - label: 'event' - - label: 'external' -externalLinks: [] -badges: [] ---- -This event is published from an external source to indicate that the wire transfer process failed. -Note that this event doesn't have any internal information like customer ID because it originates from outside the system. - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/WireTransferFailed/schema.json b/eventcatalog/events/WireTransferFailed/schema.json deleted file mode 100644 index 6252642..0000000 --- a/eventcatalog/events/WireTransferFailed/schema.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/WireTransferFailed.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "WireTransferFailed", - "type": "object", - "properties": { - "note": { - "type": "string", - "description": "An optional note describing the reason for failure" - }, - "wireTransferId": { - "type": "string", - "description": "A unique ID identifying the wire transfer transaction" - }, - "targetRoutingNumber": { - "type": "string", - "description": "The routing number of the target bank" - }, - "targetAccountNumber": { - "type": "string", - "description": "The account number of the target account" - } - }, - "required": [ - "accountNumber", - "amount", - "customerId", - "wireTransferId", - "targetRoutingNumber", - "targetAccountNumber" - ] - } - \ No newline at end of file diff --git a/eventcatalog/events/WireTransferInitiated/index.md b/eventcatalog/events/WireTransferInitiated/index.md deleted file mode 100644 index 5f128e9..0000000 --- a/eventcatalog/events/WireTransferInitiated/index.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: WireTransferInitiated -summary: "Indicates that a wire transfer process has begun" -version: 0.0.1 -consumers: - - 'Bank Account Projector' - - 'Wire Transfer Process Manager' - - 'Bank Account Aggregate' -producers: - - 'Bank Account Aggregate' -tags: - - label: 'event' -externalLinks: [] -badges: [] ---- -Indicates that the **process** of a wire transfer has been initiated. External stimuli from a gateway can then emit events to indicate the completion (successful or otherwise) of this process. Funds involved in the transfer are _reserved_ from the account, but not yet _withdrawn_. The funds will either be released or fully withdrawn pending the outcome of the transfer. - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/WireTransferInitiated/schema.json b/eventcatalog/events/WireTransferInitiated/schema.json deleted file mode 100644 index e7ee980..0000000 --- a/eventcatalog/events/WireTransferInitiated/schema.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/WireTransferInitiated.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "WireTransferInitiated", - "type": "object", - "properties": { - "accountNumber": { - "type": "string", - "description": "The source account number" - }, - "amount": { - "type": "integer", - "description": "The amount to be transferred to the target account" - }, - "note": { - "type": "string", - "description": "An optional note to be associated with the wire transfer" - }, - "customerId": { - "type": "string", - "description": "The ID of the customer performing the transfer" - }, - "wireTransferId": { - "type": "string", - "description": "A unique ID identifying the wire transfer transaction" - }, - "targetRoutingNumber": { - "type": "string", - "description": "The routing number of the target bank" - }, - "targetAccountNumber": { - "type": "string", - "description": "The account number of the target account" - } - }, - "required": [ - "accountNumber", - "amount", - "customerId", - "wireTransferId", - "targetRoutingNumber", - "targetAccountNumber" - ] - } - \ No newline at end of file diff --git a/eventcatalog/events/WireTransferSucceeded/index.md b/eventcatalog/events/WireTransferSucceeded/index.md deleted file mode 100644 index e5406e0..0000000 --- a/eventcatalog/events/WireTransferSucceeded/index.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: WireTransferSucceeded -summary: "Indicates that a wire transfer process completed successfully" -version: 0.0.1 -consumers: - - 'Wire Transfer Process Manager' -tags: - - label: 'event' - - label: 'external' -externalLinks: [] -badges: [] ---- -Indicates that the given wire transfer succeeded. This event has no internal information because it originates from outside the system. - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/WireTransferSucceeded/schema.json b/eventcatalog/events/WireTransferSucceeded/schema.json deleted file mode 100644 index d8e88b7..0000000 --- a/eventcatalog/events/WireTransferSucceeded/schema.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/WireTransferSucceeded.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "WireTransferSucceeded", - "type": "object", - "properties": { - "note": { - "type": "string", - "description": "An optional note" - }, - "wireTransferId": { - "type": "string", - "description": "A unique ID identifying the wire transfer transaction" - }, - "targetRoutingNumber": { - "type": "string", - "description": "The routing number of the target bank" - }, - "targetAccountNumber": { - "type": "string", - "description": "The account number of the target account" - } - }, - "required": [ - "wireTransferId", - "targetRoutingNumber", - "targetAccountNumber" - ] - } - \ No newline at end of file diff --git a/eventcatalog/events/WithdrawFunds/index.md b/eventcatalog/events/WithdrawFunds/index.md deleted file mode 100644 index 7234da9..0000000 --- a/eventcatalog/events/WithdrawFunds/index.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: WithdrawFunds -summary: "A request to withdraw funds from an account" -version: 0.0.1 -consumers: - - 'Bank Account Aggregate' -tags: - - label: 'command' -externalLinks: [] -badges: [] ---- -Requests the withdrawal of a specified amount from the account. This command can fail to process if the parameters are invalid or if the account does not have sufficient funds. - -Note that there is a design decision here. You can allow the withdrawal to go through even if there is insufficient funds, and then also emit an overdraft event. Or all commands attempting to withdraw below the minimum (or 0 if omitted) are rejected. This is a domain/application decision and -not really something that can be decided by the framework. - - - -## Schema - \ No newline at end of file diff --git a/eventcatalog/events/WithdrawFunds/schema.json b/eventcatalog/events/WithdrawFunds/schema.json deleted file mode 100644 index dc25fbf..0000000 --- a/eventcatalog/events/WithdrawFunds/schema.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "$id": "https://cosmonic.com/concordance/bankaccount/WithdrawFunds.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "WithdrawFunds", - "type": "object", - "properties": { - "accountNumber": { - "type": "string", - "description": "The account number" - }, - "amount": { - "type": "integer", - "description": "The amount to withdraw" - }, - "note": { - "type": "string", - "description": "An optional note to be associated with the withdrawal" - }, - "customerId": { - "type": "string", - "description": "The ID of the customer performing the withdrawal" - } - }, - "required": ["accountNumber", "amount", "customerId"] - } - \ No newline at end of file diff --git a/eventcatalog/package-lock.json b/eventcatalog/package-lock.json index 1529e99..12eeef8 100644 --- a/eventcatalog/package-lock.json +++ b/eventcatalog/package-lock.json @@ -1,12 +1,12 @@ { "name": "eventcatalog", - "version": "0.0.1", + "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "eventcatalog", - "version": "0.0.1", + "version": "0.0.0", "dependencies": { "@eventcatalog/core": "1.0.1" }, diff --git a/eventcatalog/package.json b/eventcatalog/package.json index 710367d..bc46ce7 100644 --- a/eventcatalog/package.json +++ b/eventcatalog/package.json @@ -1,6 +1,6 @@ { "name": "eventcatalog", - "version": "0.3.0", + "version": "0.0.0", "private": true, "scripts": { "start": "eventcatalog start", diff --git a/eventcatalog/services/Bank Account Aggregate/index.md b/eventcatalog/services/Bank Account Aggregate/index.md deleted file mode 100644 index d032b60..0000000 --- a/eventcatalog/services/Bank Account Aggregate/index.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Bank Account Aggregate -summary: | - The aggregate for managing individual bank accounts -tags: - - label: 'aggregate' ---- - -The bank account aggregate is responsible for validating incoming commands and emitting the appropriate events. - - \ No newline at end of file diff --git a/eventcatalog/services/Bank Account Projector/index.md b/eventcatalog/services/Bank Account Projector/index.md deleted file mode 100644 index 96ce287..0000000 --- a/eventcatalog/services/Bank Account Projector/index.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Bank Account Projector -summary: | - The projector responsible for creating bank account read model -tags: - - label: 'projector' ---- - -This projector monitors bank account events and projects the corresponding read model. - - \ No newline at end of file diff --git a/eventcatalog/services/Wire Transfer Process Manager/index.md b/eventcatalog/services/Wire Transfer Process Manager/index.md deleted file mode 100644 index 5cbc020..0000000 --- a/eventcatalog/services/Wire Transfer Process Manager/index.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Wire Transfer Process Manager -summary: | - The process manager for managing wire transfer processes -tags: - - label: 'procman' ---- - -This process manager is responsible for managing the process of wire transfers. It listens for the `WireTransferInitiated` event and then emits the appropriate commands to continue the process - - - -## Interest -The following indicates the sequential flow of the process manager's interest, which is required for defining link definitions. It's important to note that the process doesn't complete when it receives the fail/succeed events from the outside world. The process is only considered completed when the funds held by the wire transfer are released or committed. - -* `start` - [WireTransferInitiated](../../events/WireTransferInitiated) -* `advance` - [FundsReserved](../../events/FundsReserved), [WireTransferSucceeded](../../events/WireTransferSucceeded), [WireTransferFailed](../../events/WireTransferFailed) -* `end` - [FundsCommitted](../../events/FundsCommitted), [FundsReleased](../../events/FundsReleased) \ No newline at end of file diff --git a/process_manager/.cargo/config.toml b/process_manager/.cargo/config.toml deleted file mode 100644 index 4905f77..0000000 --- a/process_manager/.cargo/config.toml +++ /dev/null @@ -1,5 +0,0 @@ -[build] -target = "wasm32-unknown-unknown" - -[net] -git-fetch-with-cli = true \ No newline at end of file diff --git a/process_manager/.gitignore b/process_manager/.gitignore deleted file mode 100644 index 262ca9a..0000000 --- a/process_manager/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -# Generated by Cargo -# will have compiled files and executables -debug/ -target/ - -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock - -# These are backup files generated by rustfmt -**/*.rs.bk - -# MSVC Windows builds of rustc generate these, which store debugging information -*.pdb - -build/ diff --git a/process_manager/.keys/bankaccount_processmanager_module.nk b/process_manager/.keys/bankaccount_processmanager_module.nk deleted file mode 100644 index 923faca..0000000 --- a/process_manager/.keys/bankaccount_processmanager_module.nk +++ /dev/null @@ -1 +0,0 @@ -SMAMWST3KY5Q422MRVTCLPO32YRXODME3VFF5XKGFAHBFJPSFDBU6TQYJY \ No newline at end of file diff --git a/process_manager/.keys/wiretransfer_processmanager_module.nk b/process_manager/.keys/wiretransfer_processmanager_module.nk deleted file mode 100644 index 3bbe95a..0000000 --- a/process_manager/.keys/wiretransfer_processmanager_module.nk +++ /dev/null @@ -1 +0,0 @@ -SMACMFH6REQAXNM4VOQLXOBSFTEG6XVY5QMRXEZIC423RQRUPOLOPFW5WM \ No newline at end of file diff --git a/process_manager/Cargo.toml b/process_manager/Cargo.toml deleted file mode 100644 index 30f4861..0000000 --- a/process_manager/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -[package] -name = "bankaccount-processmanager" -version = "0.3.0" -authors = ["Cosmonic Team"] -edition = "2021" - -[lib] -crate-type = ["cdylib", "rlib"] -name = "wiretransfer_processmanager" - -[dependencies] -anyhow = "1.0.40" -async-trait = "0.1" -futures = { version = "0.3", features = ["executor"] } -serde_bytes = "0.11" -serde_json = "1.0.94" -serde = { version = "1.0", features = ["derive"] } -wasmbus-rpc = "0.14.0" -concordance-gen = { git = "https://github.com/cosmonic/concordance"} -wasmcloud-interface-logging = {version = "0.10.0", features = ["sync_macro"]} -regress = "0.6.0" - -[profile.release] -# Optimize for small code size -lto = true -opt-level = "s" -strip = true diff --git a/process_manager/README.md b/process_manager/README.md deleted file mode 100644 index 8a3c82d..0000000 --- a/process_manager/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# Bank Account Sample - Interbank Transfer Process Manager -TBD \ No newline at end of file diff --git a/process_manager/src/lib.rs b/process_manager/src/lib.rs deleted file mode 100644 index 2364e29..0000000 --- a/process_manager/src/lib.rs +++ /dev/null @@ -1,175 +0,0 @@ -use serde::{Deserialize, Serialize}; - -concordance_gen::generate!({ - path: "../eventcatalog", - role: "process_manager", - entity: "wire transfer" -}); - -#[async_trait] -impl WireTransferProcessManager for WireTransferProcessManagerImpl { - async fn handle_funds_released( - &self, - _input: FundsReleased, - _state: Option, - ) -> RpcResult { - // release of funds is the termination of a transfer process - Ok(ProcessManagerAck::ok( - None::, - vec![], - )) - } - - async fn handle_funds_committed( - &self, - _input: FundsCommitted, - _state: Option, - ) -> RpcResult { - // commitment of funds is the termination of a transfer process - Ok(ProcessManagerAck::ok( - None::, - vec![], - )) - } - - async fn handle_funds_reserved( - &self, - _input: FundsReserved, - state: Option, - ) -> RpcResult { - let Some(mut state) = state else { - return Ok(ProcessManagerAck::ok( - None::, - vec![], - )); - }; - state.status = TransferStatus::FundsReserved; - Ok(ProcessManagerAck::ok(Some(state), vec![])) - } - - async fn handle_wire_transfer_succeeded( - &self, - input: WireTransferSucceeded, - state: Option, - ) -> RpcResult { - let Some(mut state) = state else { - return Ok(ProcessManagerAck::ok( - None::, - vec![], - )); - }; - state.status = TransferStatus::TransferCompleted; - let cmd = CommitFunds { - account_number: state.account_number.to_string(), - customer_id: state.customer_id.to_string(), - wire_transfer_id: input.wire_transfer_id.to_string(), - }; - - Ok(ProcessManagerAck::ok( - Some(state), - vec![OutputCommand::new( - CommitFunds::TYPE, - &cmd, - STREAM, - &cmd.account_number, - )], - )) - } - - async fn handle_wire_transfer_initiated( - &self, - input: WireTransferInitiated, - _state: Option, - ) -> RpcResult { - let state = WireTransferProcessManagerState::new(&input); - - let cmd = ReserveFunds { - customer_id: input.customer_id, - account_number: input.account_number, - amount: input.amount, - wire_transfer_id: input.wire_transfer_id.to_string(), - }; - - Ok(ProcessManagerAck::ok( - Some(state), - vec![OutputCommand::new( - ReserveFunds::TYPE, - &cmd, - STREAM, - &cmd.account_number, - )], - )) - } - - async fn handle_wire_transfer_failed( - &self, - input: WireTransferFailed, - state: Option, - ) -> RpcResult { - let Some(state) = state else { - return Ok(ProcessManagerAck::ok( - None::, - vec![], - )); - }; - let cmd = ReleaseFunds { - account_number: state.account_number.to_string(), - customer_id: state.customer_id.to_string(), - wire_transfer_id: input.wire_transfer_id.to_string(), - }; - Ok(ProcessManagerAck::ok( - Some(state), - vec![OutputCommand::new( - ReleaseFunds::TYPE, - &cmd, - STREAM, - &cmd.account_number, - )], - )) - } -} - -#[derive(Debug, Clone, Serialize, Deserialize, Default)] -pub struct WireTransferProcessManagerState { - pub wire_transfer_id: String, - pub account_number: String, - pub customer_id: String, - pub amount: u32, - pub target_routing_number: String, - pub target_account_number: String, - pub status: TransferStatus, -} - -#[derive(Clone, Serialize, Deserialize, Debug, Default)] -pub enum TransferStatus { - Requested, - FundsReserved, - TransferInitiated, - TransferCompleted, - TransferFailed, - #[default] - Unknown, -} - -impl WireTransferProcessManagerState { - pub fn to_bytes(self) -> Vec { - serde_json::to_vec(&self).unwrap_or_default() - } -} - -impl WireTransferProcessManagerState { - pub fn new(event: &WireTransferInitiated) -> WireTransferProcessManagerState { - let event = event.clone(); - WireTransferProcessManagerState { - wire_transfer_id: event.wire_transfer_id, - account_number: event.account_number, - customer_id: event.customer_id, - amount: event.amount as u32, - target_routing_number: event.target_routing_number, - target_account_number: event.target_account_number, - status: TransferStatus::Requested, - } - } -} - -const STREAM: &str = "bankaccount"; diff --git a/process_manager/wasmcloud.toml b/process_manager/wasmcloud.toml deleted file mode 100644 index 34aa0f4..0000000 --- a/process_manager/wasmcloud.toml +++ /dev/null @@ -1,7 +0,0 @@ -name = "WireTransferProcessManager" -language = "rust" -type = "actor" - -[actor] -key_directory = "./.keys" -claims = ["cosmonic:eventsourcing", "wasmcloud:builtin:logging"] diff --git a/projector/.cargo/config.toml b/projector/.cargo/config.toml deleted file mode 100644 index 4905f77..0000000 --- a/projector/.cargo/config.toml +++ /dev/null @@ -1,5 +0,0 @@ -[build] -target = "wasm32-unknown-unknown" - -[net] -git-fetch-with-cli = true \ No newline at end of file diff --git a/projector/.gitignore b/projector/.gitignore deleted file mode 100644 index 262ca9a..0000000 --- a/projector/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -# Generated by Cargo -# will have compiled files and executables -debug/ -target/ - -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock - -# These are backup files generated by rustfmt -**/*.rs.bk - -# MSVC Windows builds of rustc generate these, which store debugging information -*.pdb - -build/ diff --git a/projector/.keys/bankaccount_projector_module.nk b/projector/.keys/bankaccount_projector_module.nk deleted file mode 100644 index 24f7801..0000000 --- a/projector/.keys/bankaccount_projector_module.nk +++ /dev/null @@ -1 +0,0 @@ -SMADQF4DVD4AUK2WAR5RKDW4G2S4TRNS4MS5ADERYQ6STLK7MANGYNQCPA \ No newline at end of file diff --git a/projector/Cargo.toml b/projector/Cargo.toml deleted file mode 100644 index d78a08b..0000000 --- a/projector/Cargo.toml +++ /dev/null @@ -1,28 +0,0 @@ -[package] -name = "bankaccount-projector" -version = "0.3.0" -authors = ["Cosmonic Team"] -edition = "2021" - -[lib] -crate-type = ["cdylib", "rlib"] -name = "bankaccount_projector" - -[dependencies] -anyhow = "1.0.40" -async-trait = "0.1" -futures = { version = "0.3", features = ["executor"] } -serde_bytes = "0.11" -serde_json = "1.0.94" -serde = { version = "1.0", features = ["derive"] } -wasmbus-rpc = "0.14.0" -concordance-gen = { git = "https://github.com/cosmonic/concordance"} -wasmcloud-interface-logging = {version = "0.10.0", features = ["sync_macro"]} -wasmcloud-interface-keyvalue = "0.11.0" -regress = "0.7.1" - -[profile.release] -# Optimize for small code size -lto = true -opt-level = "s" -strip = true \ No newline at end of file diff --git a/projector/README.md b/projector/README.md deleted file mode 100644 index 07e2314..0000000 --- a/projector/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Bank Account Projector -This projector is responsible for storing read-optimized view data for bank accounts as a function application over the stream of inbound bank account events. - -This projector maintains the following projections: -* **balances** - The current balance of any account can be looked up immediately by querying the key `balance.{account_number}` -* **ledger** - The ledger (chronological transaction history) of any account can be received as a JSON string via the key `ledger.{account_number}` - -⚠️ NOTE: for testing purposes please don't use non-alphanumeric characters for the fake account numbers as it could potentially mess up key value storage depending on the chosen provider's support for complex keys. - -# Configuration -This actor needs to be linked (bound) to two capability providers. One must support the `cosmonic:eventsourcing` contract. The Concordance provider for this contract requires the following configuration: - -* `ROLE` - `projector` -* `INTEREST` - `account_created,funds_deposited,funds_withdrawn,wire_funds_reserved,wire_funds_released` -* `NAME` - `bankaccount_projector` - -Note that stateless event handlers (whether you're using them as projectors, notifiers, gateways, etc) must declare their interest in events _explicitly_ in a comma-delimited list. Because of the use of commas in this data, it's probably easier and more reliable to use `wash ctl put link` rather than using the graphical wasmCloud dashboard. - -This actor will also need to be linked to a `wasmcloud:keyvalue` capability provider, the implementation of which is entirely up to the developer and the configuration is likely specific to the implementation chosen (e.g. Redis vs NATS, etc). - -# Manual Testing -You can start a wasmCloud host, start all of the bank account actors, and then start both the Concordance provider and your key-value provider of choice. Set the link definitions accordingly and then run the `scenario_1.sh` script in the [scripts](../scripts/) directory. You should then see the aggregate state stored in the `CC_STATE` bucket, the resulting events in the `CC_EVENTS` stream, and, assuming you used Redis, you'll see a balance projection in `balance.ABC123` and the ledger JSON structure in `ledger.ABC123`. diff --git a/projector/src/lib.rs b/projector/src/lib.rs deleted file mode 100644 index 322a2b9..0000000 --- a/projector/src/lib.rs +++ /dev/null @@ -1,38 +0,0 @@ -use anyhow::Result; -use serde::{Deserialize, Serialize}; - -concordance_gen::generate!({ - path: "../eventcatalog", - role: "projector", - entity: "bank account" -}); - -mod store; - -#[async_trait] -impl BankAccountProjector for BankAccountProjectorImpl { - async fn handle_account_created(&self, input: AccountCreated) -> Result<()> { - store::initialize_account(input).await - } - - async fn handle_funds_deposited(&self, input: FundsDeposited) -> Result<()> { - store::record_funds_deposited(input).await - } - - async fn handle_funds_reserved(&self, input: FundsReserved) -> Result<()> { - store::record_funds_reserved(input).await - } - - async fn handle_funds_withdrawn(&self, input: FundsWithdrawn) -> Result<()> { - store::record_funds_withdrawn(input).await - } - - async fn handle_funds_released(&self, input: FundsReleased) -> Result<()> { - store::record_funds_released(input).await - } - - async fn handle_wire_transfer_initiated(&self, _input: WireTransferInitiated) -> Result<()> { - Ok(()) - } -} - diff --git a/projector/src/store.rs b/projector/src/store.rs deleted file mode 100644 index 8acbe59..0000000 --- a/projector/src/store.rs +++ /dev/null @@ -1,275 +0,0 @@ -use std::collections::HashMap; - -use crate::*; - -use serde::{Deserialize, Serialize}; -use wasmbus_rpc::actor::prelude::*; -use wasmcloud_interface_keyvalue::{GetResponse, KeyValue, KeyValueSender, SetRequest}; -use wasmcloud_interface_logging::{debug, error}; - -// Note an invariant: the last() element in a ledger's effective_balance field is -// always the same as the balance stored in the balance.{account} key. - -/// Creates a new AccountLedger instance with an initial transaction as a deposit, -/// sets the current balance to the initial amount -pub async fn initialize_account(event: AccountCreated) -> Result<()> { - debug!("Initializing account {}", event.account_number); - let kv = KeyValueSender::new(); - - let account_number = event.account_number.to_string(); - let ctx = Context::default(); - - let initial_balance = event.initial_balance.unwrap_or_default() as u32; - - // Set up the initial ledger - let ledger_key = format!("ledger.{account_number}"); - let ledger = AccountLedger::new(event.account_number, initial_balance); - let ledger_json = serde_json::to_string(&ledger).unwrap(); // we know this won't fail - - // set the current balance - let balance_key = format!("balance.{account_number}"); - - set(&ctx, &kv, ledger_key, ledger_json).await; - set(&ctx, &kv, balance_key, initial_balance.to_string()).await; - - Ok(()) -} - -/// Records a deposit by adding a `LedgerLine` to the end of the previously stored -/// ledger and recording the new balance. -pub async fn record_funds_deposited(event: FundsDeposited) -> Result<()> { - debug!("Recording deposit in account {}", event.account_number); - let account_number = event.account_number.to_string(); - let ctx = Context::default(); - - let kv = KeyValueSender::new(); - let ledger_key = format!("ledger.{account_number}"); - - let new_ledger = get(&ctx, &kv, &ledger_key).await.map(|ledger_raw| { - serde_json::from_str::(&ledger_raw).map(|mut ledger| { - let last_balance = ledger.ledger_lines.last().unwrap().effective_balance; - ledger.ledger_lines.push(LedgerLine { - amount: event.amount as u32, - tx_type: TransactionType::Deposit, - effective_balance: last_balance + event.amount as u32, - }); - ledger - }) - }); - if let Some(Ok(ledger)) = new_ledger { - let new_balance = ledger - .ledger_lines - .last() - .map(|l| l.effective_balance) - .unwrap_or(0); - set_ledger(&ctx, &kv, ledger_key, ledger).await; - let balance_key = format!("balance.{account_number}"); - set(&ctx, &kv, balance_key, new_balance.to_string()).await; - } else { - error!("Unable to save projection for deposit on account {account_number}"); - } - - Ok(()) -} - -/// Records a reservation of funds by adding a funds reserved transaction to the end of the -/// ledger and recording the newly adjusted balance -pub async fn record_funds_reserved(event: FundsReserved) -> Result<()> { - debug!( - "Recording funds reservation (interbank) in account {}", - event.account_number - ); - let account_number = event.account_number.to_string(); - let ctx = Context::default(); - - let kv = KeyValueSender::new(); - let ledger_key = format!("ledger.{account_number}"); - - let new_ledger = get(&ctx, &kv, &ledger_key).await.map(|ledger_raw| { - serde_json::from_str::(&ledger_raw).map(|mut ledger| { - let last_balance = ledger.ledger_lines.last().unwrap().effective_balance; - ledger - .holds - .insert(event.wire_transfer_id, event.amount as u32); - ledger.ledger_lines.push(LedgerLine { - amount: event.amount as u32, - tx_type: TransactionType::FundsReserve, - effective_balance: last_balance - event.amount as u32, - }); - ledger - }) - }); - if let Some(Ok(ledger)) = new_ledger { - let new_balance = ledger - .ledger_lines - .last() - .map(|l| l.effective_balance) - .unwrap_or(0); - set_ledger(&ctx, &kv, ledger_key, ledger).await; - let balance_key = format!("balance.{account_number}"); - set(&ctx, &kv, balance_key, new_balance.to_string()).await; - } else { - error!("Unable to save projection for withdrawal on account {account_number}"); - } - - Ok(()) -} - -// Releases previously reserved funds by adding a funds released transaction to the end -/// of the ledger and recording the updated balance -pub async fn record_funds_released(event: FundsReleased) -> Result<()> { - debug!( - "Recording funds release (interbank) in account {}", - event.account_number - ); - let account_number = event.account_number.to_string(); - - let kv = KeyValueSender::new(); - let ledger_key = format!("ledger.{account_number}"); - let ctx = Context::default(); - - let new_ledger = get(&ctx, &kv, &ledger_key).await.map(|ledger_raw| { - serde_json::from_str::(&ledger_raw).map(|mut ledger| { - let last_balance = ledger.ledger_lines.last().unwrap().effective_balance; - let orig_hold = ledger.holds.remove(&event.wire_transfer_id); - ledger.ledger_lines.push(LedgerLine { - amount: orig_hold.unwrap_or_default(), - tx_type: TransactionType::FundsRelease, - effective_balance: last_balance + orig_hold.unwrap_or_default(), - }); - ledger - }) - }); - if let Some(Ok(ledger)) = new_ledger { - let new_balance = ledger - .ledger_lines - .last() - .map(|l| l.effective_balance) - .unwrap_or(0); - set_ledger(&ctx, &kv, ledger_key, ledger).await; - let balance_key = format!("balance.{account_number}"); - set(&ctx, &kv, balance_key, new_balance.to_string()).await; - } else { - error!("Unable to save projection for withdrawal on account {account_number}"); - } - - Ok(()) -} - -/// Records a withdrawal from an account by adding a withdrawal ledger item to the -/// ledger and recording the new balance -pub async fn record_funds_withdrawn(event: FundsWithdrawn) -> Result<()> { - debug!("Recording withdrawal in account {}", event.account_number); - let account_number = event.account_number.to_string(); - - let kv = KeyValueSender::new(); - let ledger_key = format!("ledger.{account_number}"); - - let ctx = Context::default(); - - // Note:the aggregate would prevent the creation of an event that would violate - // business rules, so we can safely do the subtraction here without any guards - - let new_ledger = get(&ctx, &kv, &ledger_key).await.map(|ledger_raw| { - serde_json::from_str::(&ledger_raw).map(|mut ledger| { - let last_balance = ledger.ledger_lines.last().unwrap().effective_balance; - ledger.ledger_lines.push(LedgerLine { - amount: event.amount as u32, - tx_type: TransactionType::Withdrawal, - effective_balance: last_balance - event.amount as u32, - }); - ledger - }) - }); - if let Some(Ok(ledger)) = new_ledger { - let new_balance = ledger - .ledger_lines - .last() - .map(|l| l.effective_balance) - .unwrap_or(0); - set_ledger(&ctx, &kv, ledger_key, ledger).await; - let balance_key = format!("balance.{account_number}"); - set(&ctx, &kv, balance_key, new_balance.to_string()).await; - } else { - error!("Unable to save projection for withdrawal on account {account_number}"); - } - - Ok(()) -} - -async fn set(ctx: &Context, kv: &KeyValueSender, key: String, value: String) { - if let Err(e) = kv - .set( - ctx, - &SetRequest { - key: key.clone(), - value, - expires: 0, - }, - ) - .await - { - error!("Failed to set {key} in store: {e}"); - } -} - -async fn set_ledger( - ctx: &Context, - kv: &KeyValueSender, - key: String, - ledger: AccountLedger, -) { - set(ctx, kv, key, serde_json::to_string(&ledger).unwrap()).await -} - -async fn get(ctx: &Context, kv: &KeyValueSender, key: &str) -> Option { - match kv.get(ctx, key).await { - Ok(GetResponse { - value: v, - exists: true, - }) => Some(v), - Ok(GetResponse { exists: false, .. }) => None, - Err(e) => { - error!("Failed to get {key} from store: {e}"); - None - } - } -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -struct AccountLedger { - pub account_number: String, - pub ledger_lines: Vec, - pub holds: HashMap, -} - -impl AccountLedger { - fn new(account_number: String, initial_balance: u32) -> AccountLedger { - AccountLedger { - account_number, - holds: HashMap::new(), - ledger_lines: vec![LedgerLine { - amount: initial_balance, - tx_type: TransactionType::Deposit, - effective_balance: initial_balance, - }], - } - } -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -struct LedgerLine { - pub amount: u32, - pub tx_type: TransactionType, - pub effective_balance: u32, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -enum TransactionType { - Withdrawal, - Deposit, - Transfer, - FundsReserve, - FundsRelease, - Unknown, -} diff --git a/projector/wasmcloud.toml b/projector/wasmcloud.toml deleted file mode 100644 index 48b8c46..0000000 --- a/projector/wasmcloud.toml +++ /dev/null @@ -1,7 +0,0 @@ -name = "BankAccountProjector" -language = "rust" -type = "actor" - -[actor] -key_directory = "./.keys" -claims = ["cosmonic:eventsourcing", "wasmcloud:keyvalue", "wasmcloud:builtin:logging"] diff --git a/wadm.yaml b/wadm.yaml index 641300c..3897375 100644 --- a/wadm.yaml +++ b/wadm.yaml @@ -3,14 +3,14 @@ kind: Application metadata: name: bank-account annotations: - version: v0.3.0 + version: v0.0.0 description: "The concordance bank account example" spec: components: - name: catalog type: actor properties: - image: ghcr.io/cosmonic/cosmonic-gitops/bankaccount_catalog:0.3.0 + image: ghcr.io/cosmonic/cosmonic-gitops/bankaccount_catalog:0.0.0 traits: - type: spreadscaler properties: @@ -18,70 +18,6 @@ spec: - type: linkdef properties: target: httpserver - - name: projector - type: actor - properties: - image: ghcr.io/cosmonic/cosmonic-gitops/bankaccount_projector:0.3.0 - traits: - - type: spreadscaler - properties: - replicas: 3 - - type: linkdef - properties: - target: concordance - values: - NAME: bankaccount_projector - ROLE: projector - INTEREST: account_created,funds_deposited,funds_released,funds_reserved,funds_withdrawn,wire_transfer_initiated - - type: linkdef - properties: - target: keyvalue - - - name: aggregate - type: actor - properties: - image: ghcr.io/cosmonic/cosmonic-gitops/bankaccount_aggregate:0.3.0 - traits: - - type: spreadscaler - properties: - replicas: 3 - - type: linkdef - properties: - target: concordance - values: - ROLE: aggregate - INTEREST: bankaccount - NAME: bankaccount - KEY: accountNumber - - - name: processmanager - type: actor - properties: - image: ghcr.io/cosmonic/cosmonic-gitops/wiretransfer_processmanager:0.3.0 - traits: - - type: spreadscaler - properties: - replicas: 3 - - type: linkdef - properties: - target: concordance - values: - ROLE: process_manager - KEY: wireTransferId - NAME: interbankxfer - INTEREST: '{"start":"wire_transfer_initiated","advance":["funds_reserved","wire_transfer_succeeded","wire_transfer_failed"],"stop":["funds_committed","funds_released"]}' - - - name: concordance - type: capability - properties: - contract: cosmonic:eventsourcing - image: registry.hub.docker.com/cosmonic/concordance:0.1.0 - link_name: default - - name: keyvalue - type: capability - properties: - image: cosmonic.azurecr.io/builtin_keyvalue:0.2.5 - contract: wasmcloud:keyvalue - name: httpserver type: capability properties: