@flatfile/plugin-constraints


The @flatfile/plugin-constraints plugin provides a way to register external constraints for Blueprint. By setting up an event listener for the commit:created event, this plugin seamlessly integrates with the data processing flow.



Event Type:


listener.on('commit:created')

Parameters

validator
string

The validator parameter is …

callback
function

The callback parameter takes a function that will be run on …

Imported NPM Packages

Usage

Install

Setup Fields

// blueprint field
{
  key: 'email',
  type: 'string',
  label: 'Email',
  constraints: [
    {
      type: 'external',
      validator: 'email',
      config: { emailRegex: '^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$' },
    },
  ],
}

Import

Pass externalConstraint to a Flatfile data listener and provide a function to run when data is added or updated.

Listen for data changes

Set up a listener to configure Flatfile and respond to data Events. Then use this plugin to set up a hook that responds to data changes.

See the code