Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/shaggy-ladybugs-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@credo-ts/didcomm": minor
"@credo-ts/core": minor
---

`MessagePickupRepository` has been refactored to `QueueTransportRepository`, and now belongs to DIDComm module configuration. As a result, MessagePickupRepository injection symbol has been dropped. If you want to retrieve current QueueTransportRepository instance, resolve DidCommModuleConfig and get `queueTransportRepository`.

All methods in QueueTransportRepository now include `AgentContext` as their first argument.
8 changes: 1 addition & 7 deletions packages/core/src/agent/__tests__/Agent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { BasicMessagesApi } from '../../../../didcomm/src/modules/basic-messages
import { ConnectionRepository, ConnectionsApi } from '../../../../didcomm/src/modules/connections'
import { CredentialRepository } from '../../../../didcomm/src/modules/credentials'
import { CredentialsApi } from '../../../../didcomm/src/modules/credentials/CredentialsApi'
import { InMemoryMessagePickupRepository, MessagePickupApi } from '../../../../didcomm/src/modules/message-pickup'
import { MessagePickupApi } from '../../../../didcomm/src/modules/message-pickup'
import { ProofRepository, ProofsApi } from '../../../../didcomm/src/modules/proofs'
import {
MediationRecipientApi,
Expand Down Expand Up @@ -140,9 +140,6 @@ describe('Agent', () => {

// Symbols, interface based
expect(container.resolve(InjectionSymbols.Logger)).toBe(agentOptions.config.logger)
expect(container.resolve(InjectionSymbols.MessagePickupRepository)).toBeInstanceOf(
InMemoryMessagePickupRepository
)

// Agent
expect(container.resolve(MessageSender)).toBeInstanceOf(MessageSender)
Expand Down Expand Up @@ -181,9 +178,6 @@ describe('Agent', () => {

// Symbols, interface based
expect(container.resolve(InjectionSymbols.Logger)).toBe(container.resolve(InjectionSymbols.Logger))
expect(container.resolve(InjectionSymbols.MessagePickupRepository)).toBe(
container.resolve(InjectionSymbols.MessagePickupRepository)
)
expect(container.resolve(InjectionSymbols.StorageService)).toBe(
container.resolve(InjectionSymbols.StorageService)
)
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export const InjectionSymbols = {
MessagePickupRepository: Symbol('MessagePickupRepository'), // TODO: Move to DIDComm
StorageService: Symbol('StorageService'),
Logger: Symbol('Logger'),
AgentContextProvider: Symbol('AgentContextProvider'),
Expand Down
12 changes: 12 additions & 0 deletions packages/didcomm/src/DidCommModuleConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DID_COMM_TRANSPORT_QUEUE } from './constants'
import { InMemoryQueueTransportRepository, QueueTransportRepository } from './transport'
import { DidCommMimeType } from './types'

/**
Expand All @@ -12,15 +13,18 @@ export interface DidCommModuleConfigOptions {
processDidCommMessagesConcurrently?: boolean
didCommMimeType?: string
useDidKeyInProtocols?: boolean
queueTransportRepository?: QueueTransportRepository
}

export class DidCommModuleConfig {
private options: DidCommModuleConfigOptions
private _endpoints?: string[]
private _queueTransportRepository: QueueTransportRepository

public constructor(options?: DidCommModuleConfigOptions) {
this.options = options ?? {}
this._endpoints = options?.endpoints
this._queueTransportRepository = options?.queueTransportRepository ?? new InMemoryQueueTransportRepository()
}

public get endpoints(): [string, ...string[]] {
Expand Down Expand Up @@ -65,4 +69,12 @@ export class DidCommModuleConfig {
public get useDidKeyInProtocols() {
return this.options.useDidKeyInProtocols ?? true
}

/**
* Allows to specify a custom queue transport queue. It defaults to an in-memory queue
*
*/
public get queueTransportRepository() {
return this._queueTransportRepository
}
}
Loading
Loading