Browse Source

Task/migrate tablemark to v4

pull/5809/head
David Requeno 1 week ago
parent
commit
7fe5382dad
  1. 14
      apps/api/src/app/endpoints/ai/ai.service.ts
  2. 7652
      package-lock.json
  3. 2
      package.json

14
apps/api/src/app/endpoints/ai/ai.service.ts

@ -1,5 +1,3 @@
import { PortfolioService } from '@ghostfolio/api/app/portfolio/portfolio.service';
import { PropertyService } from '@ghostfolio/api/services/property/property.service';
import {
PROPERTY_API_KEY_OPENROUTER,
PROPERTY_OPENROUTER_MODEL
@ -10,7 +8,10 @@ import type { AiPromptMode } from '@ghostfolio/common/types';
import { Injectable } from '@nestjs/common';
import { createOpenRouter } from '@openrouter/ai-sdk-provider';
import { generateText } from 'ai';
import tablemark, { ColumnDescriptor } from 'tablemark';
import type { ColumnDescriptor } from 'tablemark';
import { PropertyService } from '../../../services/property/property.service';
import { PortfolioService } from '../../portfolio/portfolio.service';
@Injectable()
export class AiService {
@ -92,6 +93,13 @@ export class AiService {
}
);
// Dynamic import to load ESM module from CommonJS context
// eslint-disable-next-line @typescript-eslint/no-implied-eval
const dynamicImport = new Function('s', 'return import(s)') as (
s: string
) => Promise<typeof import('tablemark')>;
const { tablemark } = await dynamicImport('tablemark');
const holdingsTableString = tablemark(holdingsTableRows, {
columns: holdingsTableColumns
});

7652
package-lock.json

File diff suppressed because it is too large

2
package.json

@ -138,7 +138,7 @@
"rxjs": "7.8.1",
"stripe": "18.5.0",
"svgmap": "2.12.2",
"tablemark": "3.1.0",
"tablemark": "4.1.0",
"twitter-api-v2": "1.23.0",
"uuid": "11.1.0",
"yahoo-finance2": "3.10.0",

Loading…
Cancel
Save