UNPKG

@flatfile/plugin-convert-json-schema

Version:

A plugin for converting JSON Schema to Flatfile Blueprint and configuring a Flatfile Space.

28 lines (24 loc) 1.69 kB
import * as _flatfile_listener from '@flatfile/listener'; import { FlatfileEvent } from '@flatfile/listener'; import { TickFunction } from '@flatfile/plugin-job-handler'; import { Flatfile } from '@flatfile/api'; import { Setup } from '@flatfile/plugin-space-configure'; type JsonSetupFactory = { workbooks: PartialWorkbookConfig[]; space?: Partial<Flatfile.spaces.SpaceConfig>; }; interface PartialWorkbookConfig extends Omit<Flatfile.CreateWorkbookConfig, 'sheets'> { sheets: PartialSheetConfig[]; } interface PartialSheetConfig extends Omit<Flatfile.SheetConfig, 'fields' | 'name'> { name?: string; source: object | string | (() => object | Promise<object>); } declare function generateSetup(setupFactory: JsonSetupFactory): Promise<Setup>; declare function generateFields(data: any): Promise<Flatfile.Property[]>; declare function getPropertyType(schema: any, property: any, parentKey: string, isRequired: boolean, origin: string): Promise<Flatfile.Property[]>; declare function resolveReference(schema: any, ref: string, origin: string): Promise<any>; declare function resolveLocalReference(schema: any, ref: string): any; declare function fetchExternalReference(url: string): Promise<any>; declare function configureSpaceWithJsonSchema(setupFactory: JsonSetupFactory, callback?: (event: FlatfileEvent, workbookIds: string[], tick: TickFunction) => any | Promise<any>): (listener: _flatfile_listener.FlatfileListener) => void; export { type JsonSetupFactory, type PartialSheetConfig, type PartialWorkbookConfig, configureSpaceWithJsonSchema, fetchExternalReference, generateFields, generateSetup, getPropertyType, resolveLocalReference, resolveReference };