import { FederatedResourceSchema } from './gql/federation.js';
import { namespace } from './interfaces.js';
import { ResourceSrvGrpcClient } from './grpc/index.js';
import { createFacadeModuleFactory } from '../../utils.js';
export const resourceModule = createFacadeModuleFactory(namespace, (facade, config) => {
    const resource = {
        client: new ResourceSrvGrpcClient(config.config.client.address, {
            ...config.config.client,
            logger: facade.logger,
        })
    };
    facade.addApolloService({
        name: namespace,
        schema: FederatedResourceSchema(config.config)
    });
    facade.koa.use(async (ctx, next) => {
        ctx.master_data = resource;
        await next();
    });
});
//# sourceMappingURL=index.js.map