Skip to content

Releases: thaitype/data-viewer

v1.0.0

07 Feb 14:41
277ca53
Compare
Choose a tag to compare

Major Changes

  • cfd28b1: Release first stable version

    Breaking Changes

    • Type changed from ServerOptions to DataViewerOptions
    • Moved logger?: LoggerOptions; from DataViewerOptions to StartOptions with new option name loggerOption?: LoggerOptions; for start method
    • Used logger?: Logger; in DataViewerOptions for custom logger
    • Moved port from DataViewerOptions to start method (with type StartOptions)
      DataViewerOptions is now dataViewer.addOption
    • TableComponent interface data property is allow (Record<string, unknown> | object)[]; type.

    New Features

    Create Data Container

    Sometimes, you may want to create a data container and add data to it later.

    export function myReport() {
      const container = new Container();
      container.addHeader('My Header');
      return container.get();
    }
    
    dataViewer.addContainer(myReport());
    dataViewer.start();

    Support Custom Server

    You can use the registerMiddleware method to integrate with your existing server.

    const getUsers = async () => (await fetch('https://jsonplaceholder.typicode.com/users')).json();
    
    const dataViewer = new DataViewer({
      path: '/viewer',
    });
    
    dataViewer.addHeader('User Table');
    dataViewer.addTable(await getUsers());
    
    const app = express();
    dataViewer.registerMiddleware(app);
    
    app.listen(3000, async () => console.log(`Already servered on http://localhost:3000/viewer`));

    Support Custom Logger

    You can use the logger option to integrate with your existing log,
    this example uses pino log

    import pino from 'pino';
    const logger = pino();
    
    const stringLogger = {
      log: (message: string) => logger.info(message),
      debug: (message: string) => logger.debug(message),
      info: (message: string) => logger.info(message),
      warn: (message: string) => logger.warn(message),
      error: (message: string) => logger.error(message),
    };
    
    const dataViewer = new DataViewer({
      path: '/viewer',
      logger: stringLogger,
    }).start();

v0.2.2

13 Jan 08:42
Compare
Choose a tag to compare

Change Summary

  • Fix npm dependencies

Full Changelog: v0.2.1...v0.2.2

v0.2.1

15 Jan 01:23
Compare
Choose a tag to compare

Change Summary

  • Fix default Buffer Cell formatter function

Full Changelog: v0.2.0...v0.2.1

v0.2.0

15 Jan 01:22
Compare
Choose a tag to compare

Change Summary

  • Support custom cell formatter function
  • Add default formatter for Buffer data type
  • Show no data when table array length is 0
  • Fix realtime event to be more stable

Support custom cell formatter function,

example:

const getUsers = async () => (await fetch('https://jsonplaceholder.typicode.com/users')).json();
dataViewer
  .setOption({
    cellFormatter: cell => {
      if (typeof cell === 'object') {
        return JSON.stringify(cell);
      }
      return String(cell);
    },
  })
  .addHeader('User Table')
  .addTable(await getUsers())
  .start();

Full Changelog: v0.1.1...v0.2.0

v0.1.1

13 Jan 03:13
Compare
Choose a tag to compare

Improved stability for day-to-day use.

Full Changelog: v0.1.0...v0.1.1

v0.1.0

13 Jan 03:11
Compare
Choose a tag to compare
v0.1.0 Pre-release
Pre-release

Proof of concept EJS template work with express server as packages

Added

  • Initial stable release.
  • Web-based table viewer for Node.js data.
  • Live Reload feature for automatic updates after server restart.
  • Dynamic Table Support for Record<string, unknown>[] data type with simple headers.

What's Changed

New Contributors

Full Changelog: https://github.com/thaitype/data-viewer/commits/v0.1.0