Socket
Socket
Sign inDemoInstall

@unifig/validation-presenter-table

Package Overview
Dependencies
25
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @unifig/validation-presenter-table

Table validation presenter for unifig


Version published
Maintainers
1
Created

Changelog

Source

1.1.1 (2024-05-16)

Bug Fixes

  • core: omitting custom object deep copy (385ceab)

Readme

Source

Table validation presenter for Unifig

Transforms configuration validation errors into clear table.

Table of Contents

Installation

npm i @unifig/validation-presenter-table
# or
yarn add @unifig/validation-presenter-table

Quick Start

// main.ts
import { Config, PlainConfigAdapter } from '@unifig/core';
import { toTable } from '@unifig/validation-presenter-table';

function bootstrap() {
  const validationError = Config.registerSync({
    templates: [StorageOptions, NetworkOptions],
    adapter: new PlainConfigAdapter({}),
  });
  if (validationError) {
    console.error(toTable(validationError));
    process.exit(1);
  }
}

bootstrap();

Example output

┌──────────────────┬─────────────┬────────┬─────────────┬───────────────┬────────────────────┐
│ Template         │ Property    │ Type   │ Source      │ Current Value │ Failed constraints │
├──────────────────┼─────────────┼────────┼─────────────┼───────────────┼────────────────────┤
│                  │ port        │ Number │ PORT        │ "not-a-port"  │ isInt              │
│                  ├─────────────┼────────┼─────────────┼───────────────┼────────────────────┤
│ TemplateMock     │ db.url      │ String │ DB_URL      │ undefined     │ isString           │
│                  ├─────────────┼────────┼─────────────┼───────────────┼────────────────────┤
│                  │ db.password │ String │ DB_PASSWORD │ undefined     │ isString           │
└──────────────────┴─────────────┴────────┴─────────────┴───────────────┴────────────────────┘

Source column presents where property value was taken from.

Example: from env variables in case of Env Adapter.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

FAQs

Last updated on 16 May 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc