import native from '../../native.js';
import { concatUint8Arr } from '@saulx/utils';
import { defToBuffer } from './toByteCode/toBuffer.js';
import { handleErrors } from './validation.js';
export const registerQuery = (q) => {
    if (!q.id) {
        const b = defToBuffer(q.db, q.def);
        const buf = concatUint8Arr(b);
        let id = native.crc32(buf);
        q.id = id;
        q.buffer = buf;
        handleErrors(q.def);
        return buf;
    }
    handleErrors(q.def);
    return q.buffer;
};
//# sourceMappingURL=registerQuery.js.map