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

@statoscope/stats-extension-custom-reports

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@statoscope/stats-extension-custom-reports

Statoscope extension to store custom reports in stats

  • 5.25.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Statoscope Package Custom Reports

npm version Financial Contributors on Open Collective

Statoscope extension to store custom reports in stats.

A custom report is:

export type Report<TData, TContext> = {
  id: string; // report id
  name?: string; // report title
  compilation?: string | null; // if specified then a report will be shown only in specific compilation
  data?: TData | (() => Promise<TData> | TData); // raw data for the report or a function that produces a data (may return promise)
  view: string | ViewConfig<TData, TContext>; // any DiscoveryJS. String turns to script to eval
};

View as a script

Sometimes we need to make a report with more complex view (e.g. with event handling).

JSON can't handle functions, but you can pass any script source into view-property instead of JSON.

This source will be evaled on client and should return any DiscoveryJS view.

my-custom-report-view.js:

(() => [
  {
    view: 'button',
    data: {
      text: 'Click me',
    },
    onClick() {
      alert('It works!');
    },
  },
])();

Report config:

({
  id: 'foo',
  view: fs.readFileSync('./my-custom-report-view.js', 'utf8')
})

FAQs

Package last updated on 17 Feb 2023

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