Migration Guide

ⓘ Reach out to your Flatfile support team to make sure your plan has access to version 2.0.

If you're looking to move to Flatfile Portal version 2.0 from version 1, then this guide will show you the recommended steps to upgrade and the differences in configuration.

Estimated conversion time: 5-30 minutes

If you're on version 1 and using NPM, make sure that you update your NPM package using the following command.

npm update flatfile-csv-importer

After updating, your package.json should reflect version 0.2.6 or higher.

{
"dependencies": {
"flatfile-csv-importer": "^0.2.6"
}
}

If you're loading Flatfile via CDN, you're all ready to go.

Configuration Changes

We've updated how some of the configuration works to consolidate everything into only one way to initialize features. Here are the specifics:

label:

All of configurations within fields must now have a label.

// Before
fields: [
{
key: 'name'
}
]
// After
fields: [
{
label: 'Name',
key: 'name'
}
]

validator:

We've deprecated the single validator configuration, and now all validators will be used in the validators configuration.

// Before
{
label: 'Name',
key: 'name',
validator: {validate: 'required'}
}
// After
{
label: 'Name',
key: 'name',
validators: [
{validate: 'required'}
]
}

isRequired:

The isRequired configuration key has been deprecated, and all validators will need to be put within the validators array.

// Before
{
label: 'Name',
key: 'name',
isRequired: true
}
// After
{
label: 'Name',
key: 'name',
validators: [
{validate: 'required'}
]
}

allowCustom:

This feature is temporarily unavailable as we work to improve it.

Regex changes

All regex shorthands (email, boolean, numeric) have been deprecated.

// Before
validators: [
{
validate: 'regex_matches',
regex: 'numeric',
error: 'must be a number'
}
]
// After
validators: [
{
validate: 'regex_matches',
regex: '^[0-9]+$',
error: 'must be a number'
}
]

All regex values now need to be a string. Because of this, there can be issues with escaping certain characters. Use this tool, click here.

// Before
validators: [
{
validate: 'regex_matches',
regex: ^[0-9]+$,
error: 'must be a number'
}
]
// After
validators: [
{
validate: 'regex_matches',
regex: '^[0-9]+$',
error: 'must be a number'
}
]

Select Options

Options may no longer use an array of strings, and must all use an array of objects with both value and label keys.

// Before
{
label: 'Color',
key: 'color',
description: 'Color Options',
type: 'select',
options: ['High', 'Medium', 'Low'] // deprecated
}
// After
{
label: 'Color',
key: 'color',
description: 'Color Options',
type: 'select',
options: [
{ value: 0, label: 'High' },
{ value: 1, label: 'Medium' },
{ value: 2, label: 'Low' }
]
}

Once you've updated your version and changed your Flatfile config, you're free to start using some of the new features on version 2.