Using forward-declared target API of cds.odata

This commit is contained in:
Daniel
2021-02-01 10:04:15 +01:00
parent a11aadc8f0
commit f3f554396c
2 changed files with 46 additions and 32 deletions

View File

@@ -2,11 +2,25 @@ const fs = require("fs");
const path = require("path");
const peg = require("pegjs");
const pegGrammarPath = path.join(__dirname, "/odata2cqn.pegjs");
const odataPegGrammar = fs.readFileSync(pegGrammarPath, {
encoding: "utf8",
flag: "r",
});
const parser = peg.generate(odataPegGrammar);
module.exports = { parser };
module.exports = {
parse: {
url: parser.parse,
},
to: {
cqn: parser.parse,
url: (cqn) => pending(cqn)
},
serialize: (data) => pending(data),
deserialize: (body) => pending(body),
}
const pending = ()=>{
throw new Error ('Not yet implemented')
}