Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

evidence-connector-js

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

evidence-connector-js

This is a JavaScript source plugin for Evidence. It allows you to run arbitrary JavaScript code as a data source. It's meant to be a quick way to get data into Evidence without having to create a new connector.

  • 0.0.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Evidence JS Source Plugin

This is a JavaScript source plugin for Evidence. It allows you to run arbitrary JavaScript code as a data source. It's meant to be a quick way to get data into Evidence without having to create a new connector.

  1. Install this plugin in an Evidence app with
    npm install evidence-connector-js
    
  2. Register the plugin in your project in your evidence.plugins.yaml file with
    datasources:
      evidence-connector-js: {}
    
  3. Launch the development server with npm run dev and navigate to the settings menu (localhost:3000/settings) to add a data source using this plugin.
  4. Create a new source in the sources directory with a .js file like pokedex.js. The JS file should export a data object.
    let url = 'https://pokeapi.co/api/v2/pokemon/'
    
    const response = await fetch(url)
    const json = await response.json()
    const data = json.results
    
    export { data }
    
  5. You can then reference your data in markdown queries.
    ```sql pokedex
    select * from pokedex
    ```
    

Credentials

You can pass credentials via environment variables to your JS file. They must be prefixed with EVIDENCE_.

let key = process.env.EVIDENCE_API_KEY
let url = 'https://whatever.com/api'

const response = await fetch(url, {
    headers: {
        'x-api-key': key
    }
})

const json = await response.json()
const data = json.results

export { data }

Keywords

FAQs

Package last updated on 18 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc