@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
101 lines • 4.74 kB
text/typescript
import { Constructor } from "../utils/mixins.mjs";
import { CacheModule } from "../modules/cache/CacheModule.mjs";
import "../modules/cache/index.mjs";
import { DcqlModule } from "../modules/dcql/DcqlModule.mjs";
import { DifPresentationExchangeModule } from "../modules/dif-presentation-exchange/DifPresentationExchangeModule.mjs";
import "../types.mjs";
import { X509Module } from "../modules/x509/X509Module.mjs";
import "../modules/x509/index.mjs";
import { SdJwtVcModule } from "../modules/sd-jwt-vc/SdJwtVcModule.mjs";
import "../modules/sd-jwt-vc/index.mjs";
import { MdocModule } from "../modules/mdoc/MdocModule.mjs";
import "../modules/dif-presentation-exchange/index.mjs";
import { W3cCredentialsModule } from "../modules/vc/W3cCredentialsModule.mjs";
import { W3cV2CredentialsModule } from "../modules/vc/W3cV2CredentialsModule.mjs";
import "../modules/vc/index.mjs";
import { KeyManagementModule } from "../modules/kms/KeyManagementModule.mjs";
import "../modules/kms/index.mjs";
import { DidsModule } from "../modules/dids/DidsModule.mjs";
import "../modules/dids/index.mjs";
import { GenericRecordsModule } from "../modules/generic-records/GenericRecordsModule.mjs";
import "../modules/generic-records/index.mjs";
import { TokenStatusListModule } from "../modules/token-status-list/TokenStatusListModule.mjs";
import { W3cDataIntegrityModule } from "../modules/w3c-di/W3cDataIntegrityModule.mjs";
import "../modules/w3c-di/index.mjs";
import { Module } from "../plugins/Module.mjs";
import "../plugins/index.mjs";
//#region src/agent/AgentModules.d.ts
/**
* Simple utility type that represent a map of modules. This is used to map from moduleKey (api key) to the api in the framework.
*/
export type ModulesMap = {
[key: string]: Module;
};
export type EmptyModuleMap = {};
/**
* Default modules can be optionally defined to provide custom configuration. This type makes it so that it is not
* possible to use a different key for the default modules
*/
export type AgentModulesInput = ModulesMap;
/**
* Type that represents the default agent modules. This is the {@link ModulesMap} variant for the default modules in the framework.
* It uses the return type of the {@link getDefaultAgentModules} method to automatically infer which modules are always available on
* the agent and in the agent. namespace.
*/
export type DefaultAgentModules = { [moduleKey in keyof ReturnType<typeof getDefaultAgentModules>]: ReturnType<ReturnType<typeof getDefaultAgentModules>[moduleKey]>; };
export type WithoutDefaultModules<Modules extends ModulesMap> = { [moduleKey in Exclude<keyof Modules, keyof DefaultAgentModules>]: Modules[moduleKey]; };
export type ModuleApiInstance<M extends Module> = M['api'] extends Constructor<unknown> ? InstanceType<M['api']> : undefined;
/**
* Type that represents the api object of the agent (`agent.xxx`). It will extract all keys of the modules and map this to the
* registered {@link Module.api} class instance. If the module does not have an api class registered, the property will be removed
* and won't be available on the api object.
*
* @example
* If the following AgentModules type was passed:
* ```ts
* {
* connections: DidCommConnectionsModule
* indy: IndyModule
* }
* ```
*
* And we use the `AgentApi` type like this:
* ```ts
* type MyAgentApi = AgentApi<{
* connections: DidCommConnectionsModule
* indy: IndyModule
* }>
* ```
*
* the resulting agent api will look like:
*
* ```ts
* {
* connections: ConnectionsApi
* }
* ```
*
* The `indy` module has been ignored because it doesn't define an api class.
*/
export type AgentApi<Modules extends ModulesMap> = { [moduleKey in keyof Modules as Modules[moduleKey]['api'] extends Constructor<unknown> ? moduleKey : never]: ModuleApiInstance<Modules[moduleKey]>; };
/**
* Method to get the default agent modules to be registered on any agent instance. It doens't configure the modules in any way,
* and if that's needed the user needs to provide the module in the agent constructor
*/
declare function getDefaultAgentModules(): {
readonly dcql: () => DcqlModule;
readonly genericRecords: () => GenericRecordsModule;
readonly dids: () => DidsModule;
readonly w3cCredentials: () => W3cCredentialsModule;
readonly w3cV2Credentials: () => W3cV2CredentialsModule;
readonly w3cDataIntegrity: () => W3cDataIntegrityModule;
readonly cache: () => CacheModule;
readonly pex: () => DifPresentationExchangeModule;
readonly sdJwtVc: () => SdJwtVcModule;
readonly x509: () => X509Module;
readonly mdoc: () => MdocModule;
readonly kms: () => KeyManagementModule;
readonly tokenStatusList: () => TokenStatusListModule;
};
//#endregion
//# sourceMappingURL=AgentModules.d.mts.map