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

62 lines (61 loc) • 2.76 kB
import { Constructor } from "../utils/mixins.mjs"; import { DependencyManager } from "./DependencyManager.mjs"; import { Update } from "../storage/migration/updates.mjs"; import { AgentContext } from "../agent/context/AgentContext.mjs"; import "../agent/index.mjs"; //#region src/plugins/Module.d.ts interface Module { api?: Constructor<unknown>; register(dependencyManager: DependencyManager): void; /** * Method that will be called to initialize a module. This method is only called once on startup * with the root agent context. It is meant to initialize services and requirements that are used * globally within the agent, such as a connection to an external ledger. * * For context specific dependencies it is recommened to use `onInitializeContext`, which will be * called for every context that is initialized. */ initialize?(agentContext: AgentContext): Promise<void>; /** * Method that will be called to shutdown a module. This method is only called once on shutdown * with the root agent context. It is meant to shutdown services and requirements that are used * globally within the agent, such as a connection to an external ledger. * * For context specific dependencies it is recommened to use `onCloseContext`, which will be * called for every context that is closed. */ shutdown?(agentContext: AgentContext): Promise<void>; /** * Method that will be called when an agent context is deleted, and will allow for cleanup of * data related to this agent context. */ onDeleteContext?(agentContext: AgentContext): Promise<void>; /** * Method that will be called when an agent context is provisioned/created, and will allow for setting * up of required services, data or other dependencies for an agent context. * * NOTE: this method will NOT be called for the root agent context as the framework * does not know whether we are provisioning or initializing an existing agent. */ onProvisionContext?(agentContext: AgentContext): Promise<void>; /** * Method that will be called when an agent context is initialized, and will allow for * setting up of required services, data or other dependencies for an agent context. */ onInitializeContext?(agentContext: AgentContext): Promise<void>; /** * Method that will be called when an agent context is closed, and will allow for * closing of e.g. database sessions. */ onCloseContext?(agentContext: AgentContext): Promise<void>; /** * List of updates that should be executed when the framework version is updated. */ updates?: Update[]; } interface ApiModule extends Module { api: Constructor<unknown>; } //#endregion export { ApiModule, Module }; //# sourceMappingURL=Module.d.mts.map