Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mockingbird 4 #62

Merged
merged 51 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
92aab89
feat: tramvai update
Metastasis Feb 23, 2024
6af4453
feat: i18n was added
Metastasis Feb 23, 2024
010748e
feat: Language picker was added
Metastasis Mar 24, 2024
3468533
Rhino-based js sandbox
danslapman Dec 6, 2022
faeb28a
Circe <-> Rhino conversions
danslapman Dec 7, 2022
baee4d7
Remove instruction count limit
danslapman Dec 8, 2022
bff219e
Use GraalVM instead of rhino
danslapman Dec 8, 2022
bed2165
Re-implement builtin pseudofunctions
danslapman Dec 9, 2022
64fcc3a
Allow port 8228 for local development
danslapman Dec 11, 2022
237678a
Replace pseudofunction mechanism with JS sandboxing
danslapman Dec 11, 2022
9d9c5f4
Re-format code
danslapman Jan 20, 2023
b606a92
Update graal-js
danslapman Nov 27, 2023
d323b91
Update polyglot-js, native-image now builds!
danslapman Feb 9, 2024
12d1698
Disable memory limit
danslapman Feb 9, 2024
fc1b8b8
Fix path to compose-test
danslapman Feb 10, 2024
c93fd61
Fix readStr
danslapman Feb 10, 2024
f51488c
Update pattern format in test
danslapman Feb 10, 2024
9d03070
Add proper reflection configuration for java classes available to JS …
danslapman Feb 15, 2024
85531a4
Support evaluating and returning Json in GraalJsSandbox
danslapman Feb 17, 2024
a01e0bc
Additional test for literals
danslapman Feb 21, 2024
ea7b676
Eval JS in XML
danslapman Feb 21, 2024
871af86
Remove unused regexes
danslapman Feb 21, 2024
17def78
Remove FunRx
danslapman Feb 21, 2024
5db8363
Support Js evaluation in substitutions
danslapman Feb 21, 2024
0033f34
Tests for string transformations
danslapman Feb 22, 2024
58ef6cc
Optics for header templating
danslapman Feb 22, 2024
37928a1
Simpler optic implementation
danslapman Mar 10, 2024
ee4ab9f
Support templates in response headers
danslapman Mar 10, 2024
00119ab
Update readme
danslapman Mar 24, 2024
251fc9f
Post-rebase fix
danslapman Mar 24, 2024
3ddba91
Translate readme
danslapman Mar 24, 2024
2992299
Translate manuals
danslapman Mar 25, 2024
8ff6671
Translate examples
danslapman Mar 31, 2024
e812efd
Translate CatsFacts
danslapman Mar 31, 2024
222f876
Translate build definition
danslapman Mar 31, 2024
d8e8c47
Translate field descriptions
danslapman Mar 31, 2024
1fee964
Translate descriptions and messages
danslapman Mar 31, 2024
b041416
lintAll
danslapman Mar 31, 2024
da4fedf
Update error message
danslapman Mar 31, 2024
041c27a
Fix edsl tests
danslapman Mar 31, 2024
8848c61
Translate all the rest
danslapman Mar 31, 2024
5b4da59
Lint edsl
danslapman Mar 31, 2024
1a71903
Remove xcdata extractor
danslapman Mar 31, 2024
a89babb
Update cats-effect & fs2-cron
danslapman Mar 31, 2024
0481357
Introduce Resource, reuse Graal's context
danslapman Apr 1, 2024
72d91ba
Introduce `Lazy`
danslapman Apr 1, 2024
976c613
Use lean Resource for JsSandbox
danslapman Apr 1, 2024
f59dda4
Optimize eval in json transformations
danslapman Apr 1, 2024
2aeabe5
Optimize eval in xml transformations
danslapman Apr 1, 2024
d882a5f
Remove `eval` method, adjust tests
danslapman Apr 1, 2024
542bf3b
Add note
danslapman Apr 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions backend/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ThisBuild / semanticdbEnabled := true
val utils = (project in file("utils"))
.settings(Settings.common)
.settings(
libraryDependencies ++= Dependencies.zio ++ Dependencies.scalatest ++ Dependencies.metrics
libraryDependencies ++= Dependencies.cats ++ Dependencies.zio ++ Dependencies.scalatest ++ Dependencies.metrics
)

val circeUtils = (project in file("circe-utils"))
Expand Down Expand Up @@ -67,7 +67,7 @@ val mockingbird = (project in file("mockingbird"))
"com.lihaoyi" %% "scalatags" % "0.9.1",
"tf.tofu" %% "derevo-circe" % Versions.derevo,
"org.webjars.npm" % "swagger-ui-dist" % "3.32.5",
"eu.timepit" %% "fs2-cron-core" % "0.2.2",
"eu.timepit" %% "fs2-cron-cron4s" % "0.9.0",
"com.softwaremill.sttp.client4" %% "zio" % Versions.sttp,
"com.softwaremill.sttp.client4" %% "circe" % Versions.sttp,
"org.apache.tika" % "tika-core" % "2.1.0",
Expand All @@ -78,7 +78,10 @@ val mockingbird = (project in file("mockingbird"))
"com.github.os72" % "protobuf-dynamic" % "1.0.1",
"com.github.geirolz" %% "advxml-core" % "2.5.1",
"com.github.geirolz" %% "advxml-xpath" % "2.5.1",
"io.estatico" %% "newtype" % "0.4.4"
"io.estatico" %% "newtype" % "0.4.4",
"org.mozilla" % "rhino" % "1.7.14",
"org.graalvm.polyglot" % "js" % "23.1.2",
"org.slf4j" % "slf4j-api" % "1.7.30" % Provided
),
Compile / unmanagedResourceDirectories += file("../frontend/dist")
)
Expand All @@ -90,9 +93,9 @@ val mockingbird = (project in file("mockingbird"))
)

/*
Отдельный подпроект был создан ради того, чтобы не отключать coursier во всём проекте.
См. https://github.com/coursier/coursier/issues/2016
Так как netty-tranport-epoll больше не используется можно перенести код отсюда в mockingbird
A separate subproject was created to avoid disabling coursier throughout the entire project.
See https://github.com/coursier/coursier/issues/2016.
Since netty-transport-epoll is no longer used, the code from here can be moved to mockingbird.
*/
lazy val `mockingbird-api` = (project in file("mockingbird-api"))
.enablePlugins(BuildInfoPlugin)
Expand Down Expand Up @@ -140,7 +143,6 @@ lazy val `mockingbird-native` = (project in file("mockingbird-native"))
Compile / packageDoc / mappings := Seq(),
GraalVMNativeImage / mainClass := Some("ru.tinkoff.tcb.mockingbird.Mockingbird"),
GraalVMNativeImage / graalVMNativeImageOptions ++= Seq(
"-J-Xmx6144m", // Required to fit native-image runtime heap in Standard GitHub-hosted runners
"-H:+StaticExecutableWithDynamicLibC",
"--gc=G1"
).filter(_ => dockerize.value),
Expand Down Expand Up @@ -194,6 +196,7 @@ val examples = (project in file("examples"))
).flatten,
libraryDependencies ++= Seq(
"dev.zio" %% "zio-cli" % "0.5.0",
"org.typelevel" %% "cats-effect" % "3.5.4"
),
Test / parallelExecution := false,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final case class JsonOptic private[optics] (private val jsonPath: Seq[PathPart])
def set(v: Json): Json => Json = jsonPath.foldRight[Json => Json](_ => v)((part, f) => modifyPart(v)(part)(f))

/**
* Если передан Some(..) - обновляет поддерево, если передан None - удаляет существующее
* Updates subtress if arg is Some(..), removes subtree otherwise
*/
def setOpt(vo: Option[Json]): Json => Json = vo match {
case Some(j) => set(j)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ package object circe {
}

object JsonNull {
def unapply(arg: Json): Option[Unit] = arg.asNull
def unapply(arg: Json): Boolean = arg.isNull
}

object JsonDocument {
Expand Down Expand Up @@ -53,8 +53,8 @@ package object circe {
if (baseArr.length >= patchArr.length)
Json.fromValues((baseArr zip patchArr).map(mrgPair.tupled))
else Json.fromValues(baseArr.zipAll(patchArr, Json.Null, patchArr.last).map(mrgPair.tupled))
case (p, JsonNull(())) if arraySubvalues => p
case (_, p) => p
case (p, JsonNull()) if arraySubvalues => p
case (_, p) => p
}

implicit class JsonOps(private val json: Json) extends AnyVal {
Expand All @@ -71,20 +71,20 @@ package object circe {
transformKeys(in => "_([a-z\\d])".r.replaceAllIn(in, _.group(1).toUpperCase)).result

/**
* Производит слияние двух json объектов
* Merges two Json objects
*
* json1 :+ json2
*
* В случае совпадения значений по определённому ключу приоритетными являются значения из json1
* In case of conflicts values from json1 take precedence
*/
@inline def :+(other: Json): Json = merge(other, json, false)

/**
* Производит слияние двух json объектов
* Merges two Json objects
*
* json1 +: json2
*
* В случае совпадения значений по определённому ключу приоритетными являются значения из json2
* In case of conflicts values from json2 take precedence
*/
@inline def +:(other: Json): Json = merge(other, json, false)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ package object bson {
private type PartialEndo2[A, B] = PartialFunction[(A, B), (A, B)]

/*
Экстракторы
Extractors
*/

object BUndef {
Expand Down Expand Up @@ -108,7 +108,7 @@ package object bson {
}

/*
Расширения
Extensions
*/

implicit final class BsonDocumentObjExt(private val doc: BsonDocument.type) extends AnyVal {
Expand All @@ -123,20 +123,20 @@ package object bson {
@inline def decodeOpt[T: BsonDecoder]: Option[T] = decodeAs[T].toOption

/**
* Производит слияние двух bson значений
* Merges two bson values
*
* bson1 :+ bson2
*
* В случае совпадения значений по определённому ключу приоритетными являются значения из bson1
* In case of conflicts values from bson1 take precedence
*/
@inline def :+(other: BsonValue): BsonValue = merge(other, bv, false)

/**
* Производит слияние двух bson значений
* Merges two bson values
*
* bson1 :+ bson2
*
* В случае совпадения значений по определённому ключу приоритетными являются значения из bson2
* In case of conflicts values from bson2 take precedence
*/
@inline def +:(other: BsonValue): BsonValue = merge(other, bv, false)
}
Expand Down
Loading