( templates: T[] | undefined, root: string, reader: Reader, isCustomDs: IsCustomDs<T, T & BaseCustomDataSource> )
| 275 | } |
| 276 | |
| 277 | export async function loadProjectTemplates<T extends BaseTemplateDataSource>( |
| 278 | templates: T[] | undefined, |
| 279 | root: string, |
| 280 | reader: Reader, |
| 281 | isCustomDs: IsCustomDs<T, T & BaseCustomDataSource> |
| 282 | ): Promise<T[]> { |
| 283 | if (!templates || !templates.length) { |
| 284 | return []; |
| 285 | } |
| 286 | |
| 287 | const templateIsCustomDs = (template: T): template is T & BaseCustomDataSource => |
| 288 | isCustomDs(template) && 'name' in template; |
| 289 | const dsTemplates = await updateDataSourcesV1_0_0(templates, reader, root, templateIsCustomDs); |
| 290 | return dsTemplates.map((ds, index) => ({ |
| 291 | ...ds, |
| 292 | name: templates[index].name, |
| 293 | })); |
| 294 | } |
| 295 | |
| 296 | export function getStartHeight(dataSources: BaseDataSource[]): number { |
| 297 | const startBlocksList = dataSources.map((item) => item.startBlock || 1); |
no test coverage detected