(
sessionStore: { close?(): Promise<void> },
runtimePersistence: { close(): void },
extras: {
agentRunStore?: Pick<DurableAgentRunStore, 'close'>;
conversationOperationalStateStore?: Pick<ConversationOperationalStateStore, 'close'>;
messageReceiptStore?: { close(): void };
interactionStore?:
| InteractiveInteractionStoreReaderFacade
| InteractiveInteractionStoreWriterFacade;
} = {},
)
| 622 | } |
| 623 | |
| 624 | async function closeExecutionStorePersistence( |
| 625 | sessionStore: { close?(): Promise<void> }, |
| 626 | runtimePersistence: { close(): void }, |
| 627 | extras: { |
| 628 | agentRunStore?: Pick<DurableAgentRunStore, 'close'>; |
| 629 | conversationOperationalStateStore?: Pick<ConversationOperationalStateStore, 'close'>; |
| 630 | messageReceiptStore?: { close(): void }; |
| 631 | interactionStore?: |
| 632 | | InteractiveInteractionStoreReaderFacade |
| 633 | | InteractiveInteractionStoreWriterFacade; |
| 634 | } = {}, |
| 635 | ): Promise<void> { |
| 636 | const errors: unknown[] = []; |
| 637 | try { |
| 638 | runtimePersistence.close(); |
| 639 | } catch (error) { |
| 640 | errors.push(error); |
| 641 | } |
| 642 | try { |
| 643 | await sessionStore.close?.(); |
| 644 | } catch (error) { |
| 645 | errors.push(error); |
| 646 | } |
| 647 | try { |
| 648 | extras.agentRunStore?.close?.(); |
| 649 | } catch (error) { |
| 650 | errors.push(error); |
| 651 | } |
| 652 | try { |
| 653 | extras.conversationOperationalStateStore?.close(); |
| 654 | } catch (error) { |
| 655 | errors.push(error); |
| 656 | } |
| 657 | try { |
| 658 | extras.messageReceiptStore?.close(); |
| 659 | } catch (error) { |
| 660 | errors.push(error); |
| 661 | } |
| 662 | try { |
| 663 | if (extras.interactionStore) { |
| 664 | closeSqliteInteractionStoreFacade(extras.interactionStore); |
| 665 | } |
| 666 | } catch (error) { |
| 667 | errors.push(error); |
| 668 | } |
| 669 | if (errors.length > 0) { |
| 670 | throw new AggregateError(errors, 'Unable to close execution store persistence'); |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | function invalidExecutionStores( |
| 675 | kind: StorageRootKind, |
no test coverage detected