import { SchemaManager } from '../../providers/schema-manager';
import type { QueryResolvers } from './../../../../__generated__/types';

export const schemaVersionForActionId: NonNullable<
  QueryResolvers['schemaVersionForActionId']
> = async (_, args, { injector }) => {
  return injector.get(SchemaManager).getSchemaVersionByCommit({
    commit: args.actionId, // @note actionId is a misnomer here. It is the commit/external ID
    target: args.target ?? null,
  });
};
