import { GraphQLError } from 'graphql';
import { ChargesMatcherProvider } from '../providers/charges-matcher.provider.js';
export const autoMatchChargesResolver = {
    Mutation: {
        autoMatchCharges: async (_, __, { injector }) => {
            try {
                const result = await injector.get(ChargesMatcherProvider).autoMatchCharges();
                return result;
            }
            catch (e) {
                if (e instanceof GraphQLError) {
                    throw e;
                }
                const message = e?.message ??
                    e?.errors.map(e => e.message).toString() ??
                    'Unknown error';
                throw new GraphQLError(message);
            }
        },
    },
};
//# sourceMappingURL=auto-match-charges.resolver.js.map