π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: change mastra instance to import
Nevo Davida3a6aa3926a4
diff --git a/libraries/nestjs-libraries/src/chat/mastra.service.ts b/libraries/nestjs-libraries/src/chat/mastra.service.tsindex 27f1b0a36..daa88da5d 100644--- a/libraries/nestjs-libraries/src/chat/mastra.service.ts+++ b/libraries/nestjs-libraries/src/chat/mastra.service.ts@@ -1,4 +1,4 @@-import { Mastra } from '@mastra/core/mastra';+import { type Mastra } from '@mastra/core/mastra';import { ConsoleLogger } from '@mastra/core/logger';import { pStore } from '@gitroom/nestjs-libraries/chat/mastra.store';import { Injectable } from '@nestjs/common';@@ -9,17 +9,22 @@ export class MastraService {static mastra: Mastra;constructor(private _loadToolsService: LoadToolsService) {}async mastra() {- MastraService.mastra =- MastraService.mastra ||- new Mastra({- storage: pStore,- agents: {- postiz: await this._loadToolsService.agent(),- },- logger: new ConsoleLogger({- level: 'info',- }),- });+ if (MastraService.mastra) {+ return MastraService.mastra;+ }++ const MastraInstance = await import('@mastra/core/mastra').then(+ (m) => m.Mastra+ );+ MastraService.mastra = new MastraInstance({+ storage: pStore,+ agents: {+ postiz: await this._loadToolsService.agent(),+ },+ logger: new ConsoleLogger({+ level: 'info',+ }),+ });return MastraService.mastra;}