UNPKG

1.6 kBTypeScriptView Raw
1import doctrine from 'doctrine';
2import * as TS from 'ts-simple-ast';
3import * as TJS from 'typescript-json-schema';
4/**
5 * Core FTS function definition that fully specifies the configuration, parameters,
6 * and return type for an FTS function.
7 */
8export interface Definition {
9 /** Name of the function */
10 title: string;
11 /** Brief description of the function */
12 description?: string;
13 /** Language and runtime-specific information */
14 config: Config;
15 /** FTS version that generated this definition */
16 version: string;
17 params: {
18 /** JSON Schema describing the function parameters */
19 schema: TJS.Definition;
20 /** Ordering of the function parameters */
21 order: string[];
22 /** Whether or not the function takes in a context parameter */
23 context: boolean;
24 };
25 returns: {
26 /** JSON Schema describing the function return type */
27 schema: TJS.Definition;
28 /** Whether or not the function returns an async Promise */
29 async: boolean;
30 };
31}
32export interface Config {
33 language: string;
34 defaultExport: boolean;
35 namedExport?: string;
36}
37export interface DefinitionOptions {
38 emit?: boolean;
39 emitOptions?: TS.EmitOptions;
40 compilerOptions?: TS.CompilerOptions;
41 jsonSchemaOptions?: TJS.PartialArgs;
42}
43export declare type PartialDefinitionOptions = Partial<DefinitionOptions>;
44export interface DefinitionBuilder {
45 sourceFile: TS.SourceFile;
46 main: TS.FunctionDeclaration;
47 docs?: doctrine.Annotation;
48 title: string;
49 definition: Partial<Definition>;
50}