mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 06:30:17 +00:00
VarModel -> VarRaw in collect
functions (#405)
This commit is contained in:
parent
f795edfaf7
commit
255c1f61b5
@ -2,6 +2,7 @@ version = 3.3.1
|
||||
runner.dialect = scala3
|
||||
|
||||
docstrings.style = Asterisk
|
||||
docstrings.wrap = no
|
||||
|
||||
maxColumn = 100
|
||||
|
||||
|
@ -5,14 +5,14 @@ import aqua.js.{CallJsFunction, CallServiceHandler, FluencePeer}
|
||||
import aqua.model.{LiteralModel, VarModel}
|
||||
import aqua.raw.ops
|
||||
import aqua.raw.ops.{Call, CallServiceTag}
|
||||
import aqua.raw.value.LiteralRaw
|
||||
import aqua.raw.value.{LiteralRaw, VarRaw}
|
||||
|
||||
import scalajs.js
|
||||
import scala.concurrent.Promise
|
||||
|
||||
// Service that can return argument to use it from a code
|
||||
case class ArgumentGetter(serviceId: String, value: VarModel, arg: scalajs.js.Dynamic)
|
||||
extends ServiceFunction {
|
||||
case class ArgumentGetter(serviceId: String, value: VarRaw, arg: scalajs.js.Dynamic)
|
||||
extends ServiceFunction {
|
||||
|
||||
def registerService(peer: FluencePeer): Unit = {
|
||||
CallJsFunction.registerService(
|
||||
@ -44,6 +44,6 @@ object ArgumentGetter {
|
||||
|
||||
val ServiceId = "getDataSrv"
|
||||
|
||||
def apply(value: VarModel, arg: scalajs.js.Dynamic): ArgumentGetter =
|
||||
def apply(value: VarRaw, arg: scalajs.js.Dynamic): ArgumentGetter =
|
||||
ArgumentGetter(ServiceId, value, arg)
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ object RunOpts extends Logging {
|
||||
args: List[ValueRaw],
|
||||
data: Option[js.Dynamic]
|
||||
): ValidatedNec[String, Map[String, ArgumentGetter]] = {
|
||||
val vars = args.collect { case v @ VarModel(_, _, _) =>
|
||||
val vars = args.collect { case v @ VarRaw(_, _, _) =>
|
||||
v
|
||||
// one variable could be used multiple times
|
||||
}.distinctBy(_.name)
|
||||
|
@ -18,11 +18,11 @@ import scala.concurrent.ExecutionContext
|
||||
import scala.scalajs.js
|
||||
|
||||
class Runner(
|
||||
funcName: String,
|
||||
funcCallable: FuncArrow,
|
||||
args: List[ValueRaw],
|
||||
config: RunConfig,
|
||||
transformConfig: TransformConfig
|
||||
funcName: String,
|
||||
funcCallable: FuncArrow,
|
||||
args: List[ValueRaw],
|
||||
config: RunConfig,
|
||||
transformConfig: TransformConfig
|
||||
) {
|
||||
|
||||
def resultVariableNames(funcCallable: FuncArrow, name: String): List[String] =
|
||||
@ -54,9 +54,9 @@ class Runner(
|
||||
|
||||
// Generates air from function, register all services and make a call through FluenceJS
|
||||
private def genAirAndMakeCall[F[_]: Async](
|
||||
wrapped: FuncArrow,
|
||||
consoleService: Console,
|
||||
finisherService: Finisher
|
||||
wrapped: FuncArrow,
|
||||
consoleService: Console,
|
||||
finisherService: Finisher
|
||||
)(implicit ec: ExecutionContext): F[Unit] = {
|
||||
val funcRes = Transform.funcRes(wrapped, transformConfig)
|
||||
val definitions = FunctionDef(funcRes)
|
||||
@ -134,7 +134,7 @@ class Runner(
|
||||
|
||||
val vars = args
|
||||
.zip(funcCallable.arrowType.domain.toList)
|
||||
.collect { case (VarModel(n, _, _), argType) =>
|
||||
.collect { case (VarRaw(n, _, _), argType) =>
|
||||
(n, argType)
|
||||
}
|
||||
.distinctBy(_._1)
|
||||
|
Loading…
Reference in New Issue
Block a user