const typeWrapper = type => { const wrapper = function() { return { __type: type, __args: Array.from(arguments) } } wrapper.__type = type return wrapper } const Sequelize = { 'ABSTRACT': typeWrapper('ABSTRACT'), 'STRING': typeWrapper('STRING'), 'CHAR': typeWrapper('CHAR'), 'TEXT': typeWrapper('TEXT'), 'NUMBER': typeWrapper('NUMBER'), 'TINYINT': typeWrapper('TINYINT'), 'SMALLINT': typeWrapper('SMALLINT'), 'MEDIUMINT': typeWrapper('MEDIUMINT'), 'INTEGER': typeWrapper('INTEGER'), 'BIGINT': typeWrapper('BIGINT'), 'FLOAT': typeWrapper('FLOAT'), 'TIME': typeWrapper('TIME'), 'DATE': typeWrapper('DATE'), 'DATEONLY': typeWrapper('DATEONLY'), 'BOOLEAN': typeWrapper('BOOLEAN'), 'NOW': typeWrapper('NOW'), 'BLOB': typeWrapper('BLOB'), 'DECIMAL': typeWrapper('DECIMAL'), 'NUMERIC': typeWrapper('NUMERIC'), 'UUID': typeWrapper('UUID'), 'UUIDV1': typeWrapper('UUIDV1'), 'UUIDV4': typeWrapper('UUIDV4'), 'HSTORE': typeWrapper('HSTORE'), 'JSON': typeWrapper('JSON'), 'JSONB': typeWrapper('JSONB'), 'VIRTUAL': typeWrapper('VIRTUAL'), 'ARRAY': typeWrapper('ARRAY'), 'NONE': typeWrapper('NONE'), 'ENUM': typeWrapper('ENUM'), 'RANGE': typeWrapper('RANGE'), 'REAL': typeWrapper('REAL'), 'DOUBLE': typeWrapper('DOUBLE'), 'DOUBLE PRECISION': typeWrapper('DOUBLE PRECISION'), 'GEOMETRY': typeWrapper('GEOMETRY'), 'GEOGRAPHY': typeWrapper('GEOGRAPHY'), } let tooLate = false const cruds = [] const register = (opts) => { if (tooLate) throw new Error('Crud registered too late.') cruds.push(opts) } const _getCruds = () => { if (tooLate) throw new Error('_getCruds called twice.') tooLate = true return cruds } module.exports = { Sequelize, register, _getCruds }