import { isPresent, isType } from '@jscrpt/common';
import { isRelationsComponentType } from '../../decorators';
/**
 * Extracts dynamic relations from default locations
 *
 * - relations export
 * - default export
 */
export const relationsExportExtractor = (module, logger) => {
    const localModule = module;
    logger?.debug('relationsExportExtractor: trying to extract dynamic relations');
    if (isPresent(localModule.relations) && isType(localModule.relations) && isRelationsComponentType(localModule.relations)) {
        return {
            data: localModule.relations
        };
    }
    if (isPresent(localModule.default) && isType(localModule.default) && isRelationsComponentType(localModule.default)) {
        return {
            data: localModule.default
        };
    }
    return null;
};
//# sourceMappingURL=relations.extractor.js.map