Automatically configure new Flatfile Spaces by cloning an existing Space Template, including workbooks, documents, and settings.
space:configure
event, which is triggered when a new Space is created. Upon activation, the plugin finds the oldest Space Template associated with the current Flatfile App, and then copies its workbooks, documents, and settings (including metadata, actions, labels, etc.) into the new Space.
This is particularly useful for scenarios where you need to consistently provision new Spaces with a predefined structure and configuration, ensuring a uniform starting point for all users. It should be deployed in a server-side listener.
configureSpaceFromTemplate
function.
Parameter | Type | Description | Default |
---|---|---|---|
callback | Function (optional) | An asynchronous function executed after the Space and its Workbooks have been successfully created from the template. Receives the original event , an array of the new workbookIds , and a tick function to report progress. | No additional logic executed |
event
: The FlatfileEvent object that triggered the jobworkbookIds
: An array of strings, where each string is the ID of a workbook created in the new Spacetick
: A function to update the job’s progress with signature (progress: number, message?: string) => Promise<void>
appId
from the event contextcreatedAt
date). It is not possible to specify which template to use if multiple exist. The first one created will always be chosenspaces:list
, spaces:update
, workbooks:list
, workbooks:create
, documents:list
, and documents:create
space:configure
event, which typically runs only once for a given Space. Re-running the job may lead to duplicate workbooks or unexpected behaviorjobHandler
. A generic error is thrown to fail the job, and the specific error is logged to the server console for debugging. There is no built-in mechanism for custom error handling; failures are managed by the Flatfile Job system.