| 58 | } |
| 59 | |
| 60 | async load(configs: DataSourceConfig | DataSourceConfig[]): Promise<void> { |
| 61 | const sources = Array.isArray(configs) ? configs : [configs]; |
| 62 | if (sources.length !== 1) { |
| 63 | throw new Error(`PythonEngine currently supports exactly one data source, received ${sources.length}`); |
| 64 | } |
| 65 | const config = sources[0]; |
| 66 | await this.dispose(); |
| 67 | this.lifetime = new AbortController(); |
| 68 | this.source = sourceSchema.parse(config); |
| 69 | } |
| 70 | |
| 71 | async schema(signal?: AbortSignal): Promise<Schema> { |
| 72 | if (!this.source) throw new Error('No data loaded. Please call source() first.'); |