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

@workerhive/flow-provider

v2.1.22

Published

Connecting all the pipes together to make a big beautiful graph that can be searched with graphql

Downloads

91

Readme

Workhub Flow Provider

Connecting all the pipes together to make a big beautiful graph that can be searched with graphql

  • Auto CRUD with GraphQL Directives
  • Define input types from your type defintiions
  • Configurable decorator for objects allowing user defined resolvers

Usage

The following snippet generates an apollo-server configured with a SensitiveType and a Hash no resolvers are set up for the hash but the SensitiveType will now have resolvers for

  • sensitiveTypes: [SensitiveType]
  • sensitiveType(id: ID): SensitiveType
  • addSensitiveType(sensitiveType: SensitiveTypeInput) : SensitiveType
  • updateSensitiveType(id: ID, sensitiveType: SensitiveTypeInput) : SensitiveType
  • deleteSensitiveType(id: ID): Boolean

these will be routed by default to the app store provided, if the configurable directive has been set the user can choose which store they would like to use

const Flow = require('@workerhive/flow-provider')

const typeDefs = `
    type MergedType @crud @configurable{
        id: ID
        name: String @input
        description: String @input
        applicationField: String
    }

    type SensitiveType @crud @configurable{
        id: ID
        name: String @input
        description: String @input
        sensitiveKey: Int
    }
`

let flowDefs = {
    MergedType: {
        id: "app:MergedTypes:_id",
        name: "app:MergedTypes:JobName",
        description: "app:MergedType:description",
        applicationField: "app:MergedType:applicationField",
        refs: {
            "id": ["app:MergedType:_id"],
        }
    },
    SensitiveType: {
        name: "app:Sensitive:name",
        sensitiveKey: "app:Sensitive:key",
        refs: {
            "id": ["app:Sensitive:_id"],
        }
    }
}

let resolvers = {

}

let server = Flow(typeDefs, flowDefs, resolvers)

server.listen({port: 4001}).then((conn) => {
    const {url} = conn;
    console.log(`🚀 Server ready at ${url}`);
})

Type Definitions

Type definitions follow normal GraphQL syntax with the addition of a few directives baked into the flow-provider

@crud

The crud directive informs the flow provider to set up routes for CRUD operations following the naming convention $operation$TypeName and to setup input types based on the keys in the type with the @input directive

@configurable

Lets the flow provider know it should allow these types to be configured by flow definitions

@input

Signals relevant fields to be used for input type setup

Flow Definitions

Flow definitions are a JSON description of where a model is storing key values and how it should go about retrieving them

Example

{
    $TypeName: {
        $modelKey: "$store:$pathway:$key",
        $otherKey: "$otherstore:$pathway:$key2"
    }
}