MCPcopy Create free account
hub / github.com/subquery/subql / loadProjectTemplates

Function loadProjectTemplates

packages/node-core/src/utils/project.ts:277–294  ·  view source on GitHub ↗
(
  templates: T[] | undefined,
  root: string,
  reader: Reader,
  isCustomDs: IsCustomDs<T, T & BaseCustomDataSource>
)

Source from the content-addressed store, hash-verified

275}
276
277export 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
296export function getStartHeight(dataSources: BaseDataSource[]): number {
297 const startBlocksList = dataSources.map((item) => item.startBlock || 1);

Callers 1

createMethod · 0.90

Calls 2

updateDataSourcesV1_0_0Function · 0.85
mapMethod · 0.80

Tested by

no test coverage detected