fix: resolve data error on issuance using shared agent#332
Conversation
Signed-off-by: sujitaw <sujit.sutar@ayanworks.com>
WalkthroughCredential event processing now conditionally uses tenant-scoped agents when a non-default contextCorrelationId is present; connection records and credential format data are retrieved via the tenant agent in that case, otherwise the global agent is used, before emitting webhooks and optional WebSocket notifications. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/events/CredentialEvents.ts (1)
23-48: Consider extracting tenant-aware execution pattern.The tenant-check-and-execute pattern is duplicated. A helper would reduce repetition and ensure consistent handling:
async function withContextAgent<T>( agent: Agent<RestMultiTenantAgentModules>, contextId: string | undefined, action: (ctx: typeof agent) => Promise<T> ): Promise<T> { if (contextId && contextId !== 'default') { let result: T await agent.modules.tenants.withTenantAgent({ tenantId: contextId }, async (tenantAgent) => { result = await action(tenantAgent as typeof agent) }) return result! } return action(agent) }Then usage becomes:
connectionRecord = await withContextAgent(agent, event.metadata.contextCorrelationId, (ctx) => ctx.connections.findById(record.connectionId) )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/events/CredentialEvents.ts(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/events/CredentialEvents.ts (1)
src/cliAgent.ts (1)
RestMultiTenantAgentModules(115-115)
🪛 ESLint
src/events/CredentialEvents.ts
[error] 7-8: Delete ⏎
(prettier/prettier)
[error] 35-36: Delete ⏎
(prettier/prettier)
🪛 GitHub Actions: Continuous Integration
src/events/CredentialEvents.ts
[error] 7-7: Delete ⏎ prettier/prettier
🪛 GitHub Check: SonarCloud Code Analysis
src/events/CredentialEvents.ts
[warning] 28-28: This assertion is unnecessary since the receiver accepts the original type of the expression.
[warning] 32-32: This assertion is unnecessary since the receiver accepts the original type of the expression.
[warning] 39-39: Unexpected negated condition.
[warning] 24-24: Unexpected negated condition.
🪛 GitHub Check: Validate
src/events/CredentialEvents.ts
[failure] 7-7:
Delete ⏎
[failure] 35-35:
Delete ⏎
Signed-off-by: sujitaw <sujit.sutar@ayanworks.com>
|
* fix/get formatted data error Signed-off-by: sujitaw <sujit.sutar@ayanworks.com> * fix/ellipse comments Signed-off-by: sujitaw <sujit.sutar@ayanworks.com> --------- Signed-off-by: sujitaw <sujit.sutar@ayanworks.com> Signed-off-by: kinxa0 <kinzangdorji@bhutanndi.bt>



what
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.