Forest Admin - API reference
    Preparing search index...

    Allow to create a new Forest Admin agent from scratch. Builds the application by composing and configuring all the collection decorators.

    Minimal code to add a datasource

    new AgentBuilder(options)
    .addDataSource(new SomeDataSource())
    .start();

    Type Parameters

    Index

    Constructors

    Properties

    compositeDataSource: CompositeDatasource<Collection>
    stack: DecoratorsStack

    Accessors

    Methods

    • Allow to interact with a decorated collection

      Type Parameters

      • N extends string

      Parameters

      • name: N

        the name of the collection to manipulate

      • handle: (collection: CollectionCustomizer<S, N>) => unknown

        a function that provide a collection builder on the given collection name

      Returns this

      .customizeCollection('books', books => books.renameField('xx', 'yy'))
      
    • Remove collections from the exported schema (they will still be usable within the agent).

      Parameters

      • ...names: Extract<keyof S, string>[]

        the collections to remove

      Returns this

      .removeCollection('aCollectionToRemove', 'anotherCollectionToRemove');
      
    • Parameters

      • typingsPath: string
      • typingsMaxDepth: number
      • Optionallogger: Logger

      Returns Promise<void>

    • Load a plugin across all collections

      Type Parameters

      • TOptions

      Parameters

      • plugin: Plugin<TOptions>

        instance of the plugin

      • Optionaloptions: TOptions

        options which need to be passed to the plugin

      Returns this

      import { advancedExport } from '@forestadmin/plugin-advanced-export';

      dataSourceCustomizer.use(advancedExportPlugin, { format: 'xlsx' });