
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@flatfile/plugin-autocast
Advanced tools
Automatically cast values in Flatfile to their appropriate types with this plugin.
The @flatfile/plugin-autocast plugin is an opinionated transformer that will
automatically convert the data in the Sheet to match the type defined by the
Blueprint.
Event Type:
listener.on('commit:created')
Supported field types:
number, boolean, date
sheetSlug - string - (required)The sheetSlug indicates the slug name of the sheet you want to monitor.
fieldFilters - string[]Use the fieldFilters parameter to select specific fields to monitor. Without
any specified fieldFilters, the plugin will automatically monitor
all castable fields, including strings, numbers, booleans, and dates.
options.chunkSize - default: "10_000" - numberThe chunkSize parameter allows you to specify the quantity of records to in
each chunk.
options.parallel - default: "1" - numberThe parallel parameter allows you to specify the number of chunks to process
in parallel.
api.sheets.getThe autocast plugin will listen for the commit:created event and cast strings, numbers, booleans,
and dates to the appropriate Blueprint type. Note that the recordHook and bulkRecordHook plugins
listen for the same event type. Plugins will fire in the order they are placed in the listener.
Numbers and booleans are transformed from strings to their respective types (i.e., '1' to 1, "true" to true).
String numbers (i.e '1'), string decimals (i.e '1.1'), and string numbers with commas (i.e '1,000')
are interpreted as numbers.
'1', 'yes', 'true', 'on', 't', 'y', and 1 are interpreted as truthy values.
'-1', '0', 'no', 'false', 'off', 'f', 'n', 0, -1 are interpreted as falsy values.
Date strings and numbers are cast to UTC strings. For example, YYYY-MM-DD... formats are treated as ISO 8601 dates (UTC), whereas other formats are considered local time and converted to UTC:
'2023-08-16' => 'Wed, 16 Aug 2023 00:00:00 GMT''08-16-2023' => 'Wed, 16 Aug 2023 00:00:00 GMT''08/16/2023' => 'Wed, 16 Aug 2023 00:00:00 GMT''Aug 16, 2023' => 'Wed, 16 Aug 2023 00:00:00 GMT''August 16, 2023' => 'Wed, 16 Aug 2023 00:00:00 GMT''2023-08-16T00:00:00.000Z' => 'Wed, 16 Aug 2023 00:00:00 GMT'1692144000000 => 'Wed, 16 Aug 2023 00:00:00 GMT'install
npm i @flatfile/plugin-autocast
import
import { autocast } from "@flatfile/plugin-autocast";
listener.js
listener.use(autocast("sheetSlug"));
listener.js w/ fieldFilters
listener.use(autocast("sheetSlug", ["numberField", "dateField"]));
listener.js w/ fieldFilters & options
listener.use(
autocast("sheetSlug", ["numberField", "dateField"], {
chunkSize: 10_000,
parallel: 2,
})
);
FAQs
A plugin for automatically casting values in Flatfile.
We found that @flatfile/plugin-autocast demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 16 open source maintainers collaborating on the project.
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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.