From c3eba6a73cc7da113a81de7f3e76cf0f03c70175 Mon Sep 17 00:00:00 2001 From: Akim Mamedov Date: Fri, 17 Nov 2023 19:09:23 +0700 Subject: [PATCH] Fix types --- .../interfaces/src/compilerSupport/aquaTypeDefinitions.ts | 4 +++- packages/core/js-client/src/compilerSupport/conversions.ts | 5 ++++- packages/core/js-client/src/jsPeer/FluencePeer.ts | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/core/interfaces/src/compilerSupport/aquaTypeDefinitions.ts b/packages/core/interfaces/src/compilerSupport/aquaTypeDefinitions.ts index d86abb4e..2ad90707 100644 --- a/packages/core/interfaces/src/compilerSupport/aquaTypeDefinitions.ts +++ b/packages/core/interfaces/src/compilerSupport/aquaTypeDefinitions.ts @@ -264,6 +264,8 @@ export interface ServiceDef { * List of functions which the service consists of */ functions: - | LabeledProductType>> + | LabeledProductType< + ArrowType | UnlabeledProductType> + > | NilType; } diff --git a/packages/core/js-client/src/compilerSupport/conversions.ts b/packages/core/js-client/src/compilerSupport/conversions.ts index 72ab57f3..85ee33d3 100644 --- a/packages/core/js-client/src/compilerSupport/conversions.ts +++ b/packages/core/js-client/src/compilerSupport/conversions.ts @@ -22,6 +22,7 @@ import { NonArrowSimpleType, ScalarType, SimpleTypes, + UnlabeledProductType, } from "@fluencelabs/interfaces"; import { ParticleContext } from "../jsServiceHost/interfaces.js"; @@ -203,7 +204,9 @@ export function js2aqua( export const wrapFunction = ( func: ServiceImpl[string], - schema: ArrowWithoutCallbacks | ArrowType>, + schema: + | ArrowWithoutCallbacks + | ArrowType | UnlabeledProductType>, ): ServiceImpl[string] => { return async (...args) => { // eslint-disable-next-line @typescript-eslint/consistent-type-assertions diff --git a/packages/core/js-client/src/jsPeer/FluencePeer.ts b/packages/core/js-client/src/jsPeer/FluencePeer.ts index 9d43bfc1..0adb4dbd 100644 --- a/packages/core/js-client/src/jsPeer/FluencePeer.ts +++ b/packages/core/js-client/src/jsPeer/FluencePeer.ts @@ -548,7 +548,7 @@ export abstract class FluencePeer { ) == null ) { // try to finish script if fire-and-forget enabled - item.onSuccess({}); + item.onSuccess(null); } }) .catch((e: unknown) => { @@ -638,7 +638,9 @@ export abstract class FluencePeer { ) == null ) { // try to finish script if fire-and-forget enabled - item.onSuccess({}); + setTimeout(() => { + item.onSuccess(null); + }, 0); } }