MCPcopy Create free account
hub / github.com/ReAPI-com/mcp-openapi / constructor

Method constructor

src/core/SpecService.ts:49–78  ·  view source on GitHub ↗
(
    private readonly scanner: ISpecScanner,
    config: SpecServiceConfig,
    logger?: Logger
  )

Source from the content-addressed store, hash-verified

47 private catalog: SpecCatalogEntry[] = [];
48
49 constructor(
50 private readonly scanner: ISpecScanner,
51 config: SpecServiceConfig,
52 logger?: Logger
53 ) {
54 this.config = {
55 basePath: config.basePath,
56 catalogDir: config.catalogDir || "_catalog",
57 dereferencedDir: config.dereferencedDir || "_dereferenced",
58 retryAttempts: config.retryAttempts || 3,
59 retryDelay: config.retryDelay || 1000,
60 cache: {
61 maxSize: config.cache?.maxSize || 500,
62 ttl: config.cache?.ttl || 60 * 60 * 1000, // 1 hour
63 },
64 };
65
66 this.logger = logger || new ConsoleLogger();
67 this.folderPath = this.config.basePath;
68 this.catalogPath = path.join(this.folderPath, this.config.catalogDir);
69 this.dereferencedPath = path.join(
70 this.folderPath,
71 this.config.dereferencedDir
72 );
73
74 this.specCache = new SimpleCache<string, OpenAPIV3.Document>({
75 maxSize: this.config.cache.maxSize,
76 ttl: this.config.cache.ttl,
77 });
78 }
79
80 private async ensureDirectory(dir: string) {
81 try {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected