From 594f46529d7476f8f2345e9deaa43938d7d52a47 Mon Sep 17 00:00:00 2001 From: shamsartem Date: Mon, 18 Sep 2023 18:39:59 +0200 Subject: [PATCH] feat: export types from aqua-api (#904) * feat: export types from aqua-api * improve --- api/api-npm/index.d.ts | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/api/api-npm/index.d.ts b/api/api-npm/index.d.ts index 10346ace..5612af80 100644 --- a/api/api-npm/index.d.ts +++ b/api/api-npm/index.d.ts @@ -1,11 +1,11 @@ import { ServiceDef, FunctionCallDef } from "@fluencelabs/interfaces"; -class AquaFunction { +export class AquaFunction { funcDef: FunctionCallDef; script: string; } -class GeneratedSource { +export class GeneratedSource { name: string; tsSource?: string; jsSource?: string; @@ -43,20 +43,26 @@ type CodeString = { code: string; }; +export type CompileFromStringArgs = CommonArgs & CodeString; +export type CompileFromStringReturnType = Omit; + /** Compile aqua code from a string */ export declare function compileFromString( - args: CommonArgs & CodeString, -): Promise>; + args: CompileFromStringArgs, +): Promise; type FilePath = { /** Path to the aqua file to be compiled */ filePath: string; }; +export type CompileFromPathArgs = CommonArgs & FilePath; +export type CompileFromPathReturnType = Omit; + /** Compile aqua code from a file */ export declare function compileFromPath( - args: CommonArgs & FilePath, -): Promise>; + args: CompileFromPathArgs, +): Promise; type FuncCall = { /** Function call you want to compile. Example: someFunc("someArg") */ @@ -65,14 +71,20 @@ type FuncCall = { data?: Record | undefined; }; +export type CompileFuncCallFromStringArgs = CommonArgs & CodeString & FuncCall; +export type CompileFuncCallFromStringReturnType = Required; + /** Compile aqua function call from a string */ export declare function compileAquaCallFromString( - args: CommonArgs & CodeString & FuncCall, -): Promise>; + args: CompileFuncCallFromStringArgs, +): Promise; + +export type CompileFuncCallFromPathArgs = CommonArgs & FilePath & FuncCall; +export type CompileFuncCallFromPathReturnType = Required; /** Compile aqua function call from a file */ export declare function compileAquaCallFromPath( - args: CommonArgs & FilePath & FuncCall, -): Promise>; + args: CompileFuncCallFromPathArgs, +): Promise; export {};