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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@aqls/server

v1.0.6

Published

An intelligent full-stack GraphQL subscription and analytics module. Server-side analytics processing, self-auditing router, and resolver plugins.

Downloads

10

Readme

Aqls - Server

Overview

GraphQL analytics toolkit and dashboard that integrate with Apollo Client and Apollo Server Express. It is an easy to use analytics suite that monitors GraphQL subscriptions concurrency, latency, errors, and resolver frequency. Our integrated dashboard displays your GraphQL analytics on dynamic and interactive charts.

This package is for setting up your server. For the client-side package please refer to the Aqls-client package.

Note: Aqls is currently in BETA and improvements will continue to be implemented. If any issues are encountered while using our application, please submit a PR.

Requirements

  • Node.js version 12.18.3+
  • apollo-server-express version 2.18.1+

Install

With npm:

npm install --save @aqls/server

Getting Started

  • [ ] 1. Import Traql, traqlAudit, and analyticsRouter into your server file:
const { Traql, traqlAudit, analyticsRouter } = require('@aqls/server');

  • [ ] 2. Initialize a constant for your resolvers:
const resolvers = { Mutation, Query, Subscription };

  • [ ] 3. Create a new instance of Traql passing in the resolvers and your user token:
const traql = new Traql(resolvers, 'INSERT USER TOKEN HERE IN QUOTES');

This will keep track of the number of subscription resolvers in the system and will calculate the number of current subscribers. You can get your User Token from Aqls.io by signing up through Github OAuth. This token is needed to view your analytics in the developer dashboard at Aqls.io.

  • [ ] 4. Add to your Apollo Server:
const server = new ApolloServer({
  typeDefs,
  resolvers,
  context: { db, pubsub, traql },
});

Make sure that context is added to your server. Be sure to pass in BOTH pubsub and traql to server context.

  • [ ] 5. Invoke the traqlAudit function passing in traql:
setInterval(() => traqlAudit(traql), 5000);

traqlAudit is invoked every 5 seconds to audit each traql entry and ensure that there are no errors before sending the data to be displayed on the dashboard.

  • [ ] 6. Instantiate an endpoint to send analytics to Aqls server:
app.use('/aqlsanalytics', analyticsRouter(traql));

Note: Please ensure the endpoint is '/aqlsanalytics' and invoke analyticsRouter passing in traql.

Update Schema and Mutation Tracking

  • [ ] 1. Add AQL and AQLInput to schema file:
type AQL {
  mutationSendTime: String,
  mutationReceived: String,
  subscriberReceived: String,
  mutationId: ID,
  resolver: String,
  userToken: String,
}
input AQLInput {
  mutationSendTime: String,
  mutationReceived: String,
  subscriberReceived: String,
  mutationId: ID,
  resolver: String,
  userToken: String,
}

  • [ ] 2. Add AQLInput type to any mutation type that you want to track:
type Mutation {
  newColor(colorArg: String, aql: AQLInput): Color
  newLuckyNumber(numberArg: Int, aql: AQLInput): LuckyNumber
}

  • [ ] 3. Add AQL type to any payload that you want to track:
type UpdatedColorPayload {
  cssColor: String!
  id: ID!
  aql: AQL
}

Mutation Tracking

  • [ ] 1. Import newAqlPayload in mutation resolver file:
const { newAqlPayload } = require('@aqls/server');
  • [ ] 2. Pass invocation of newAqlPayload to pubsub publish property:
function newColor(parent, args, { db, pubsub, traql }, info) {
  db.color.cssColor = args.colorArg;
  const payload = {
    updatedColor: {
      ...db.color,
    },
  };
  pubsub.publish('COLOR_MUTATED', newAqlPayload(payload, args, traql, pubsub));
  return db.color;
}

Note: Pass in payload as first argument, be sure to include resolver arguments and the traql and pubsub from server context.

  • [ ] Lastly, Connect with the Aqls Team!

[email protected]

Case Simmons: Case's Github and Case's LinkedIn

Julie Pinchak: Julie's Github and Julie's LinkedIn

Michael O'Halloran: Michael's Github and Michael's LinkedIn

Rocio Infante: Rocio's Github and Rocio's LinkedIn