@servable/tools
Version:
Servable tools is a utility that builds a protocol's manifest and documents it.
24 lines (20 loc) • 592 B
JavaScript
import templateDataForId from './templateDataForId.js'
import extractItem from './extractItem.js'
import { DataTemplateType } from '../data/1.0.0/enums.js'
import ServableClass from "../../domain/servable/index.js"
export default async ({
path,
dataTemplateType = DataTemplateType.Protocol
}) => {
const reference = {}
if (!global.Servable) {
global.Servable = new ServableClass()
}
const item = await templateDataForId({ id: dataTemplateType, path })
const tree = await extractItem({
item,
reference,
parentLeafPath: path
})
return { reference, tree }
}