npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@aexol/axolotl-apollo-server

v1.0.6

Published

Apollo Server adapter for Axolotl. It wires Axolotl resolvers, scalars and directives into an Apollo Server instance.

Readme

@aexol/axolotl-apollo-server

Apollo Server adapter for Axolotl. It wires Axolotl resolvers, scalars and directives into an Apollo Server instance.

What It Does

  • Translates Axolotl resolver signatures to Apollo resolvers
  • Loads schema from file/content and builds an executable schema
  • Applies GraphQL directives via @graphql-tools/utils mapping

Types Provided

  • Resolver input tuple: [Source, Args, ContextValue, Info]
  • Directive mapper: SchemaMapper = (schema: GraphQLSchema, getDirective: typeof getDirectiveFn) => SchemaMapperInitial
  • Adapter type: AxolotlAdapter<[any, any, any, any], SchemaMapper>
  • Return value: ApolloServer instance with pre-built schema

Scalars

  • Define scalars with createScalars from axolotl-core and pass them to the adapter: apolloServerAdapter({ resolvers, scalars }).
  • Scalars are merged into the executable schema alongside resolvers.
  • Full guide: packages/core/README.md:1 (Scalars section).

Directives

  • Define directive mappers with createDirectives from axolotl-core.
  • Each directive is a function (schema, getDirective) => SchemaMapperInitial used with @graphql-tools/utils.mapSchema.
  • Pass them to the adapter as { directives }.

Example @auth directive (checks contextValue.user):

import { createDirectives } from '@aexol/axolotl-core';
import { defaultFieldResolver } from 'graphql';
import { MapperKind } from '@graphql-tools/utils';

const directives = createDirectives({
  auth: (schema, getDirective) => ({
    [MapperKind.OBJECT_FIELD]: (fieldConfig) => {
      const has = getDirective(schema, fieldConfig, 'auth');
      if (!has) return fieldConfig;
      const { resolve = defaultFieldResolver } = fieldConfig as any;
      return {
        ...fieldConfig,
        resolve: async (src: any, args: any, ctx: any, info: any) => {
          if (!ctx.user) throw new Error('Unauthorized');
          return resolve(src, args, ctx, info);
        },
      } as any;
    },
  }),
});

// Include in adapter
apolloServerAdapter({ resolvers, directives });

See core README for a deeper explanation and additional notes.

Quick Start

import { Axolotl } from '@aexol/axolotl-core';
import { apolloServerAdapter } from '@aexol/axolotl-apollo-server';

const { createResolvers } = Axolotl(apolloServerAdapter)<{
  Query: { hello: string };
}>();

const resolvers = createResolvers({
  Query: { hello: () => 'world' },
});

const server = apolloServerAdapter({ resolvers });
await server.listen({ port: 4000 });

Quick Start With Scalars

import { Axolotl } from '@aexol/axolotl-core';
import { apolloServerAdapter } from '@aexol/axolotl-apollo-server';
import { GraphQLScalarType } from 'graphql';

type ScalarModels = { URL: unknown };

const { createResolvers, createScalars } = Axolotl(apolloServerAdapter)<
  { Query: { hello: string } },
  ScalarModels
>();

const scalars = createScalars({
  URL: new GraphQLScalarType({
    name: 'URL',
    serialize: (v) => new URL(String(v)).toString(),
    parseValue: (v) => (v == null ? v : new URL(String(v))),
  }),
});

const resolvers = createResolvers({
  Query: { hello: () => 'world' },
});

const server = apolloServerAdapter({ resolvers, scalars });
await server.listen({ port: 4000 });

See adapters/apollo-server/index.ts:1 for the adapter implementation.