import { HttpClient } from '@angular/common/http'; import { Injectable, inject } from '@angular/core'; import { Observable, map, shareReplay } from 'rxjs'; import { ConnectorInfo } from './api.types'; /** GET /imports/connectors: what the server can read. Fetched once per app. */ @Injectable({ providedIn: 'root' }) export class ConnectorsApi { private readonly http = inject(HttpClient); private readonly connectors$ = this.http.get<{ connectors: ConnectorInfo[] }>('/imports/connectors').pipe( map((response) => response.connectors), shareReplay({ bufferSize: 1, refCount: false }), ); list(): Observable { return this.connectors$; } }