UNPKG

@credo-ts/core

Version:

<p align="center"> <br /> <img alt="Credo Logo" src="https://github.com/openwallet-foundation/credo-ts/blob/c7886cb8377ceb8ee4efe8d264211e561a75072d/images/credo-logo.png" height="250px" /> </p> <h1 align="center"><b>Credo - Core</b></h1

43 lines (42 loc) • 1.19 kB
import { InjectionSymbols } from "../../constants.mjs"; import { AgentConfig } from "../AgentConfig.mjs"; //#region src/agent/context/AgentContext.ts var AgentContext = class { constructor({ dependencyManager, contextCorrelationId, isRootAgentContext = false }) { this._isInitialized = false; this.dependencyManager = dependencyManager; this.contextCorrelationId = contextCorrelationId; this.isRootAgentContext = isRootAgentContext; } get isInitialized() { return this._isInitialized; } /** @internal */ set isInitialized(value) { this._isInitialized = value; } /** * Convenience method to access the agent config for the current context. */ get config() { return this.dependencyManager.resolve(AgentConfig); } /** * End session the current agent context */ async endSession() { await this.dependencyManager.resolve(InjectionSymbols.AgentContextProvider).endSessionForAgentContext(this); } toJSON() { return { contextCorrelationId: this.contextCorrelationId }; } /** * Resolve a dependency */ resolve(token) { return this.dependencyManager.resolve(token); } }; //#endregion export { AgentContext }; //# sourceMappingURL=AgentContext.mjs.map