UNPKG

fql-toolkit

Version:
28 lines 861 B
export const FQL_VALID_TYPES = [ 'text', 'number', 'boolean', 'password', 'email', 'date', 'reference', ]; export const FQL_DURING_EVENTS = ['create', 'remove', 'modify']; /** * Maps JavaScript-friendly type names to their canonical FQL equivalents. */ const TYPE_ALIASES = { string: 'text', str: 'text', int: 'number', integer: 'number', float: 'number', double: 'number', bool: 'boolean', }; /** * Normalizes a type name: passes valid FQL types through unchanged, * resolves JS aliases, and throws on unknown values. */ export function normalizeType(type) { const resolved = (TYPE_ALIASES[type] ?? type); if (!FQL_VALID_TYPES.includes(resolved)) { throw new Error(`Invalid FQL type: "${type}". Valid types: ${FQL_VALID_TYPES.join(', ')}`); } return resolved; } //# sourceMappingURL=constants.js.map