diff --git a/patches/@credo-ts+core+0.5.3+007+outofband-connection-fix.patch b/patches/@credo-ts+core+0.5.3+007+outofband-connection-fix.patch new file mode 100644 index 00000000..da489746 --- /dev/null +++ b/patches/@credo-ts+core+0.5.3+007+outofband-connection-fix.patch @@ -0,0 +1,40 @@ +diff --git a/node_modules/@credo-ts/core/build/modules/oob/OutOfBandApi.js b/node_modules/@credo-ts/core/build/modules/oob/OutOfBandApi.js +index 141bc8d..e84e210 100644 +--- a/node_modules/@credo-ts/core/build/modules/oob/OutOfBandApi.js ++++ b/node_modules/@credo-ts/core/build/modules/oob/OutOfBandApi.js +@@ -432,17 +432,30 @@ let OutOfBandApi = class OutOfBandApi { + } + else { + // Wait until the connection is ready and then pass the messages to the agent for further processing +- this.connectionsApi +- .returnWhenIsConnected(connectionRecord.id, { timeoutMs }) +- .then((connectionRecord) => this.emitWithConnection(outOfBandRecord, connectionRecord, messages)) +- .catch((error) => { ++ // this.connectionsApi ++ // .returnWhenIsConnected(connectionRecord.id, { timeoutMs }) ++ // .then((connectionRecord) => this.emitWithConnection(outOfBandRecord, connectionRecord, messages)) ++ // .catch((error) => { ++ // if (error instanceof rxjs_1.EmptyError) { ++ // this.logger.warn(`Agent unsubscribed before connection got into ${connections_1.DidExchangeState.Completed} state`, error); ++ // } ++ // else { ++ // this.logger.error('Promise waiting for the connection to be complete failed.', error); ++ // } ++ // }); ++ ++ try{ ++ connectionRecord = await this.connectionsApi.returnWhenIsConnected(connectionRecord.id, { timeoutMs }) ++ await this.emitWithConnection(outOfBandRecord, connectionRecord, messages); ++ ++ }catch(error){ + if (error instanceof rxjs_1.EmptyError) { + this.logger.warn(`Agent unsubscribed before connection got into ${connections_1.DidExchangeState.Completed} state`, error); + } + else { + this.logger.error('Promise waiting for the connection to be complete failed.', error); + } +- }); ++ } + } + } + return { outOfBandRecord, connectionRecord }; diff --git a/src/controllers/multi-tenancy/MultiTenancyController.ts b/src/controllers/multi-tenancy/MultiTenancyController.ts index 9fe90c2f..cb8fc7bc 100644 --- a/src/controllers/multi-tenancy/MultiTenancyController.ts +++ b/src/controllers/multi-tenancy/MultiTenancyController.ts @@ -638,6 +638,22 @@ export class MultiTenancyController extends Controller { } } + @Example(ConnectionRecordExample) + @Security('apiKey') + @Delete('/connections/:connectionId/:tenantId') + public async deleteConnectionById(@Path('tenantId') tenantId: string, @Path('connectionId') connectionId: RecordId) { + try { + const connectionRecord = await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + const connection = await tenantAgent.connections.deleteById(connectionId) + return JsonTransformer.toJSON(connection) + }) + + return connectionRecord + } catch (error) { + throw ErrorHandlingService.handle(error) + } + } + @Security('apiKey') @Post('/create-invitation/:tenantId') public async createInvitation(