UNPKG

@flatfile/plugin-space-configure-from-template

Version:

A plugin for configuring a Flatfile Space from a Space Template.

22 lines (19 loc) 1.21 kB
import { FlatfileEvent, FlatfileListener } from '@flatfile/listener'; import { TickFunction } from '@flatfile/plugin-job-handler'; /** * `configureSpaceFromTemplate` is a higher-order function that creates a plugin to configure a * workspace using the Flatfile API. This function takes a setup factory that may either * be a static setup configuration or a function that creates a setup configuration * given a FlatfileEvent. * * When the job:ready for space:configure is emitted, the plugin will extract the necessary IDs, create a * configuration using the provided setup factory, create a workbook with this configuration, * and update the space with the workbook ID as the primary workbook ID. * * @param {Function} callback - A callback function that is called after the workbook is created. * * @returns {Function} Returns a function that takes a FlatfileListener, adding a "space:configure" event listener * and configuring the space when the event is emitted. */ declare function configureSpaceFromTemplate(callback?: (event: FlatfileEvent, workbookIds: string[], tick: TickFunction) => any | Promise<any>): (listener: FlatfileListener) => void; export { configureSpaceFromTemplate };