-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Timo Glastra <[email protected]> BREAKING CHANGE: To make AFJ multi-tenancy ready, all services and repositories have been made stateless. A new `AgentContext` is introduced that holds the current context, which is passed to each method call. The public API hasn't been affected, but due to the large impact of this change it is marked as braking.
- Loading branch information
1 parent
938a889
commit 999a888
Showing
161 changed files
with
3,861 additions
and
2,768 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type { DependencyManager } from '../plugins' | ||
import type { Wallet } from '../wallet' | ||
|
||
import { InjectionSymbols } from '../constants' | ||
|
||
import { AgentConfig } from './AgentConfig' | ||
|
||
export class AgentContext { | ||
/** | ||
* Dependency manager holds all dependencies for the current context. Possibly a child of a parent dependency manager, | ||
* in which case all singleton dependencies from the parent context are also available to this context. | ||
*/ | ||
public readonly dependencyManager: DependencyManager | ||
|
||
public constructor({ dependencyManager }: { dependencyManager: DependencyManager }) { | ||
this.dependencyManager = dependencyManager | ||
} | ||
|
||
/** | ||
* Convenience method to access the agent config for the current context. | ||
*/ | ||
public get config() { | ||
return this.dependencyManager.resolve(AgentConfig) | ||
} | ||
|
||
/** | ||
* Convenience method to access the wallet for the current context. | ||
*/ | ||
public get wallet() { | ||
return this.dependencyManager.resolve<Wallet>(InjectionSymbols.Wallet) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.