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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dosvit/server-toolkit

v3.2.2-beta.8

Published

```js import {someSpecialArticle, someSpecialArticles} from './resolvers/customResolvers'

Downloads

620

Readme

API example

import {someSpecialArticle, someSpecialArticles} from './resolvers/customResolvers'

const filePathResolver = ({filename})=>`articles/${md5(new Date + filename) + path.extname(filename)}`;

export default function (entityBuilder: EntityBuilder) {
  entityBuilder
      .addSchema(path.resolve('./schema.graphql'))
      // transform a db type to Upload —  so you can simply import entity type from generated schema
      // and not copy-paste and edit inputs
      .convertInputToUpload('File')
      // apply a custom schema transformer
      .transform(mySchemaTransformer);

  entityBuilder.Query
      // forward with arguments
      .resolve('articles', {where: {publishedAt_lte: "2017-10-10"}, orderBy: "publishedAt_ASC"})
      // or pass arguments with callback, will receive args and ctx from request
      .resolve('articles', {where: ()=>({publishedAt_lte: moment().format()}), orderBy: "publishedAt_ASC"})
      .resolve('articles', {where: (args)=>({...args?.where, publishedAt_lte: moment().format()}), orderBy: "publishedAt_ASC"})
      // custom resolvers
      .resolve('someSpecialArticle',  someSpecialArticle)
      .resolve('someSpecialArticles',  someSpecialArticles)
      // OR short notation:
      .resolve({someSpecialArticle, someSpecialArticles})
      // One can generate translations shortcuts if follows convention
      // all types translated types and resolvers in app schema should have postfixTranslated
      // all parent types should have relation `translations` that accepts {where: {lang: 'en'}}
      .translate('articles')

  entityBuilder.Mutation
      // guard all mutations (maybe should be a default)
      // matching engine https://www.npmjs.com/package/minimatch
      .guard('*',  ["is_admin"])
      // remove guard from some mutations
      .unguard('guestVote')
      // some custom resolver
      .resolve('someMutationWithLogic', someMutationWithLogic)
      // validation using http://validatejs.org/
      // constraints may be an object, or a function returning an object that accepts (args, ctx) args
      .validate('createArticle', constraints)
      // enable uploads. can be default for Upload type props in schema with generic name resolver (md5 in root)
      .upload('createArticle', 'mainImage', filePathResolver)
      .upload('updateArticle', 'mainImage', filePathResolver)
      // add custom HOF
      .decorate('updateArticle',  myHigherOrderFunction);

  // Root types are caught by Proxy object
  entityBuilder.Article
      .resolve('author', resolveAuthorFromAnotherService);

  // The same as `entityBuilder.AnotherType`
  entityBuilder.type('AnotherType').resolve('foo', bar);
}