const { bundle } = require('../../../../lib/binary');
const { sequence } = require('../../../../lib/db');

module.exports = async function (req, res, next) {

	try {
		const json = await sequence.get(req.params.project, null, req.query);
		const data = bundle(json, {type: req.query.type ?? 2});
		console.log("bundle", data);

		res.status(200).send(Buffer.from(data));
		next();
	} catch (err) {
		next(err);
	}

};
