UNPKG

1.8 kBTypeScriptView Raw
1import doctrine from 'doctrine';
2import * as TS from 'ts-morph';
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 /** Enables a fallback to disable type-checking for raw HTTP requests */
23 http: boolean;
24 /** Whether or not the function takes in a context parameter */
25 context: boolean;
26 };
27 returns: {
28 /** JSON Schema describing the function return type */
29 schema: TJS.Definition;
30 /** Whether or not the function returns an async Promise */
31 async: boolean;
32 /** Enables a fallback to disable type-checking for raw HTTP responses */
33 http: boolean;
34 };
35}
36export interface Config {
37 language: string;
38 defaultExport: boolean;
39 namedExport?: string;
40}
41export interface DefinitionOptions {
42 emit?: boolean;
43 emitOptions?: TS.EmitOptions;
44 compilerOptions?: TS.CompilerOptions;
45 jsonSchemaOptions?: TJS.PartialArgs;
46}
47export declare type PartialDefinitionOptions = Partial<DefinitionOptions>;
48export interface DefinitionBuilder {
49 sourceFile: TS.SourceFile;
50 main: TS.FunctionDeclaration;
51 docs?: doctrine.Annotation;
52 title: string;
53 definition: Partial<Definition>;
54}