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 | 1x 1x 6x 6x 6x 5x 3x 2x 1x 1x 1x | import { Output, CrudContract, Contract } from './types.js'
import { transform as crudTransform } from './crud.js'
import { transform as singleTransform } from './single.js'
export const transform = async (contract: CrudContract | Contract | object): Promise<Output> => {
const data: any = contract
if (!data.$schema) { return { type: 'error', errors: "Schema files must contain $schema that point to it's type" } }
if (data.$schema.endsWith('singleContractSchema.json')) {
return singleTransform(data)
} else if (data.$schema.endsWith('crudContractSchema.json')) {
return crudTransform(data)
}
return { type: 'error', errors: `Unsupported schema for declaration: ${data.$schema}` }
}
export default transform
|