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

@gandalf-network/eyeofsauron

v1.0.12

Published

eyeofsauron is a command-line tool designed to generate the necessary files that makes it super easy to interact with the Sauron API. It completely abstracts away the complexity of authentication and interacting with the GraphQL APIs.

Downloads

31

Readme

eyeofsauron

eyeofsauron is a command-line tool designed to generate the necessary files that makes it super easy to interact with the Sauron API. It completely abstracts away the complexity of authentication and interacting with the GraphQL APIs.

Features

  • Generate necessary files required for interacting with the Sauron API
  • Automatically install required dependencies

Installation

Prerequisites

  • NodeJS - version 18.x or higher

Installing eyeofsauron


npm install -g @gandalf-network/eyeofsauron

Usage


eyeofsauron generate

Flags

  • -f, --folder [folder]: Set the destination folder for the generated files

  • -esm, --esModules : Generate JavaScript files as ESModules, utilizing import statements for module imports.

  • -c, --commonJS : Generate JavaScript files as CommonJS modules, using require statements for module imports.

  • -ts, --typescript : Generate TypeScript files.

Using the Generated Files

Once you have successfully generated the necessary files and installed the required dependencies using eyeofsauron, you can proceed to use these files to interact with the API.

Initialization

// Typescript

// Change eyeofsauron to whatever name you specified for the file generation
import Eye, { Source } from './eyeofsauron';

const privateKey = process.env.PRIVATE_KEY
const eye = new Eye({ privateKey })
// ESModules

// Change eyeofsauron to whatever name you specified for the file generation
import Eye, { Source } from './eyeofsauron/index.js'

const privateKey = process.env.PRIVATE_KEY
const eye = new Eye({ privateKey })
// CommonJS

// Change eyeofsauron to whatever name you specified for the file generation
const Eye = require('./eyeofsauron').default
const { Source } = require('./eyeofsauron')

const privateKey = process.env.PRIVATE_KEY
const eye = new Eye({ privateKey })

Get Activity

// index.ts

try {
    const { data } = await eye.getActivity({
        dataKey: "MY_DATA_KEY",
        source: Source.Netflix,
        limit: 10,
        page: 1,
    })

    console.log(data)
    /*
    Returns
    {
        limit: 10,
        total: 3409,
        page: 1,
        __typename: "ActivityResponse",
        data: [
            {
                id: 'ACTIVITY_ID',
                metadata: {
                    title: "Judge Dee's Mystery: Season 1: Episode 3",
                    subject: [
                        { value: 'tt31473598', identifierType: 'IMDB' },
                        { value: '10296096', identifierType: 'TVDB'}
                    ],
                    lastPlayedAt: '01/01/2024',
                    __typename: 'NetflixActivityMetadata'
                },
                __typename: 'Activity'
            }
            ...,
        ]
    }
    */

} catch (error: any) {
    console.log(error)
}

Lookup Activity

// index.ts

try {
    const { data: activity } = await eye.lookupActivity({
        dataKey: "MY_DATA_KEY",
        activityId: "ACTIVITY_ID",
    })

    console.log(activity)
    /*
    Returns
        {
            id: 'ACTIVITY_ID',
            metadata: {
                title: "Judge Dee's Mystery: Season 1: Episode 3",
                subject: [
                    { value: 'tt31473598', identifierType: 'IMDB' },
                    { value: '10296096', identifierType: 'TVDB'}
                ],
                lastPlayedAt: '01/01/2024',
                __typename: 'NetflixActivityMetadata'
            },
            __typename: 'Activity'
        }
    */

} catch (error: any) {
    console.log(error)
}

Get Traits

// index.ts

try {
    const { data: traits } = await eye.getTraits({
        dataKey: "MY_DATA_KEY",
        source: Source.UBEREATS,
        labels: [TraitLabel.RATING, TraitLabel.TRIP_COUNT],
    })

    console.log(trait)
    /*
    Returns
        [
            {
                id: 'TRAIT_ID',
                source: 'UBER',
                label: 'RATING',
                value: '4.8',
                timestamp: '2024-06-11T11:41:00.552647Z',
                __typename: 'Trait'
            },
            {
                id: 'TRAIT_ID',
                source: 'UBER',
                label: 'TRIP_COUNT',
                value: '76',
                timestamp: '2024-06-11T11:41:00.552647Z',
                __typename: 'Trait'
            },
        ]
    */
} catch (error: any) {
    console.log(error)
}

Lookup Traits

// index.ts

try {
    const { data: trait } = await eye.lookupTrait({
        dataKey: "MY_DATA_KEY",
        traitId: "TRAIT_ID",
    })

    console.log(trait)
    /*
    Returns
        {
            id: 'TRAIT_ID',
            source: 'UBER',
            label: 'RATING',
            value: '4.8',
            timestamp: '2024-06-11T11:41:00.552647Z',
            __typename: 'Trait'
        },
    */
} catch (error: any) {
    console.log(error)
}

Contributing

Contributions are welcome, whether they're feature requests, bug fixes, or documentation improvements.