Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 1x 1x 3x 3x 3x 2x 2x 1x | import { validate, isValidationError } from './jsonSchema.js'
import { Contract, Output } from './types.js'
import { loadJSON, baseSchemaLocation } from '../util.js'
export const transform = async (data:Contract | any): Promise<Output> => {
const valid = await validate(await loadJSON(`${await baseSchemaLocation()}singleContractSchema.json`), data)
if (isValidationError(valid)) return valid
const contractData: Contract = data
return {
type: 'result',
key: contractData.name,
results: [
{
name: contractData.name,
authentication: contractData.authentication,
manageFields: {},
method: contractData.type || 'GET',
arguments: data.arguments,
returns: data.returns
}
]
}
}
export default transform
|