Compare commits

...

280 Commits

Author SHA1 Message Date
Anatolios Laskaris
31a3ec9eae
chore: Update renovate (#1185)
Update renovate
2024-09-04 19:36:15 +03:00
renovate[bot]
3f4abfbf4f
chore(deps): update dependency com.eed3si9n:sbt-buildinfo to v0.12.0 (#1168)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-15 11:10:09 +00:00
renovate[bot]
cc269aec4d
chore(deps): update dependency com.eed3si9n:sbt-assembly to v2.2.0 (#1167)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-15 10:37:02 +00:00
renovate[bot]
1d8019ed87
chore(deps): update dependency sbt/sbt to v1.10.1 (#1170)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-15 13:06:15 +03:00
InversionSpaces
b0f3a8c21e
fix(compiler): Fix CRDT Map in array handling [LNG-370] (#1171)
* Stricten CollectibleType

* Add test

* Add comment
2024-07-12 16:06:14 +07:00
fluencebot
af3fc24adb
chore(main): release aqua 0.14.11 (#1158)
* chore(main): release aqua 0.14.11

* chore: Bump aqua version to 0.14.11
2024-07-05 15:34:20 +02:00
InversionSpaces
1c76f75d80
feat(compiler): Allow renaming imports with qualified names [LNG-361] (#1136)
* Reverse ability search order

* Gather arrows from imported services

* Add test

* Refactor AquaContext

* Add test for abilities

* Rewrite parsing

* Update cache

* Make method private

* Use only PName in pick

* Rewrite picking (Compilation savepoint)

* Fix PName.value

* Linearize modules, make tests compile

* Make unit tests pass (Savepoint)

* Refactor a little

* Remove declared argument

* Refactor

* Move scoped to Picker

* Refactor locations to typed names

* Fix pickHeader

* Implement scoped for LspContext

* Refactor exports, rethink HeaderSem monoid

* Fix AquaContext (Savepoint)

* Fix import handling

* Remove println

* Remove unused fields

* Add header to SName.scala

* Add simple test

* Add merge test

* Add renaming test

* Refactor module to separate class

* Add comments

* Remove setAbility method

* Refactor exports handling

* Remove unnecessary variable

* Add integration tests
2024-07-03 20:41:31 +07:00
Dima
4d49279569
feat(compiler): Add feature to insert map from a function result with correct type [LNG-367] (#1159) 2024-07-01 19:58:29 +07:00
InversionSpaces
4ad0655da6
chore: Update files headers to AGPLv3 (#1161) 2024-06-24 12:20:27 +00:00
renovate[bot]
d6178f2203
chore(deps): update dependency org.scalatest:scalatest to v3.2.19 (#1165)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-24 11:32:03 +00:00
InversionSpaces
223a381a47
chore: Update LICENSE to AGPLv3 (#1160)
Update LICENSE to AGPLv3
2024-06-21 12:01:06 +00:00
Dima
77b7b9b4bd
fix(compiler): Push to stream in closures [LNG-365] (#1157) 2024-06-18 16:57:55 +03:00
fluencebot
1563f7cdd8
chore(main): release aqua 0.14.10 (#1152) 2024-06-07 09:35:50 +00:00
Dima
037532fb85
feat(api, lsp): Case classes exported to JS as normal JSONs (#1151) 2024-06-07 11:38:37 +03:00
fluencebot
af741c3141
chore(main): release aqua 0.14.9 (#1150) 2024-06-06 10:35:59 +00:00
Dima
934c20c98a
feat(compiler): CRDT-maps implementation (#1142) 2024-06-06 04:24:47 +00:00
renovate[bot]
dad8db54cf
chore(deps): update catsv to v2.12.0 (#1146)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-03 13:06:50 +00:00
Dima
40cf81efe2
chore(deps): update dependency scalajs to v0.16.0 (#1149)
update scalajs to 0.16
2024-06-03 12:31:43 +00:00
renovate[bot]
534ab1d952
chore(deps): update dependency prettier to v3.3.0 (#1147)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-03 12:29:13 +03:00
fluencebot
339400fe52
chore(main): release aqua 0.14.8 (#1145) 2024-05-29 06:35:44 +00:00
renovate[bot]
cff7f949cc
chore(deps): update dependency com.lihaoyi:sourcecode to v0.4.2 (#1143)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-28 17:49:50 +00:00
renovate[bot]
0d9b5241c7
chore(deps): update dependency ts-jest to v29.1.3 (#1144)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-28 17:11:00 +00:00
Dima
7468f6fd18
chore: Add extension to imports on preparing import tokens (#1139) 2024-05-20 07:55:09 +00:00
renovate[bot]
e0513a6218
chore(deps): update all github-actions (major) (#1141)
chore(deps): update all github-actions

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-20 06:54:49 +00:00
renovate[bot]
32b9043e81
chore(deps): update dependency scala to v3.4.2 (#1140)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-20 06:22:39 +00:00
fluencebot
aa986ca6e8
chore(main): release aqua 0.14.7 (#1133)
* chore(main): release aqua 0.14.7

* chore: Bump aqua version to 0.14.7
2024-05-14 12:21:03 +00:00
Dima
35db82c767
fix(lsp): Go-to-definition for used types (LNG-345) (#1128) 2024-05-14 11:36:25 +00:00
InversionSpaces
faf5b8071f
feat(compiler): Allow redeclaring services (and abilities) [LNG-360] (#1135)
* Reverse ability search order

* Gather arrows from imported services

* Add test

* Refactor AquaContext

* Add test for abilities

* Update cache
2024-05-10 12:43:52 +02:00
Dima
6cc068ac36
fix(lsp): Plugin throws OOM on big projects (#1134) 2024-05-07 11:58:37 +02:00
InversionSpaces
9c23a9d4ef
feat(compiler): Allow redeclaring functions [LNG-357] (#1127)
* Allow dots in use ... as

* Add tests

* Refactor implicits

* Use QName in module name

* Fix test

* Refactor declares

* Add PName

* Propagate nested abilities

* Fix compilation

* Do not propagate context

* Use alignCombine

* Add test

* Add more tests

* Refactor test

* Remove unused function

* Refactor test

* Refactor, add comments

* Checkout aqua-src
2024-04-25 10:40:55 +00:00
InversionSpaces
f0ad76189a
chore: Fix e2e (#1132)
Flox -> cli
2024-04-25 13:12:32 +03:00
fluencebot
04f8bd2f68
chore(main): release aqua 0.14.6 (#1111) 2024-04-19 10:03:27 +00:00
renovate[bot]
e9420878f8
chore(deps): update dependency com.github.sbt:sbt-native-packager to v1.10.0 (#1121)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-18 09:09:40 +00:00
renovate[bot]
1ba7ae38ec
chore(deps): update dependency com.lihaoyi:sourcecode to v0.4.1 (#1125)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-18 08:41:43 +00:00
Dima
e6c5d0039f
fix(compiler): Return error if SemanticError occures [LNG-356] (#1126) 2024-04-17 12:40:19 +00:00
InversionSpaces
f29e44e52a
fix(compiler): Refactor header semantics [LNG-352] (#1113)
* Initial

* Fix import

* Refactor RawSemantics

* Refactor RawSemantics

* Remove initCtx for export

* Add fromInit

* Remove setInit

* Use init ctx

* Add a hack to ModuleSem

* Remove initCtx

* Refactor HeaderSem finalization

* Remove RawContext#init

* Combine with semigroup op

* Remove unnecessary typeclass

* Remove unused typeclass

* Remove unnecessary typeclass

* Remove unnecessary monoid

* Remove contants from monoid

* Fix tests

* Remove unused monoids

* Refactor declares

* Refactor module sem

* Refactor module sem

* Update LspSemantics

* Remove unused typeclass

* Remove unnecessary method

* Add comments
2024-04-09 12:58:12 +02:00
Dima
07bea1a909
fix(lsp): Fix go-to-definition for abilities as arguments in functions [LNG-343] (#1116) 2024-04-08 12:43:30 +00:00
Dima
49729ac40a
fix(compiler): Ordering in option inliner [LNG-351] (#1114) 2024-04-08 09:24:55 +00:00
renovate[bot]
331d497eb5
fix(deps): update dependency @fluencelabs/fluence-network-environment to v1.2.1 (#1115)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-05 09:21:32 +00:00
InversionSpaces
9dc9e55973
fix: Allow spaces after aqua header (#1112)
* Allow spaces after aqua header

* Fix test, add spaces after star to parsing
2024-04-02 09:55:25 +00:00
Dima
8f06ac1cba
fix(compiler): Redeclare imports [LNG-344] (#1109) 2024-04-02 09:04:01 +00:00
renovate[bot]
cc69e696dc
chore(deps): update dependency co.fs2:fs2-io to v3.10.2 (#1106)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-02 08:22:54 +00:00
renovate[bot]
11498f0996
chore(deps): update dependency scala to v3.4.1 (#1107)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-02 07:52:53 +00:00
renovate[bot]
1ef0dafe2e
fix(deps): update dependency @fluencelabs/fluence-network-environment to v1.2.0 (#1110)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-02 07:26:46 +00:00
fluencebot
0a49f22365
chore(main): release aqua 0.14.5 (#1098)
* chore(main): release aqua 0.14.5

* chore: Bump aqua version to 0.14.5
2024-03-28 11:43:47 +00:00
Dima
14748c7646
fix(compiler): Create restrictions in inliner [LNG-346] (#1099) 2024-03-28 11:10:13 +00:00
renovate[bot]
320b516807
chore(deps): update dependency sbt/sbt to v1.9.9 (#1104)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-25 05:24:50 +00:00
renovate[bot]
d8b7c8cba3
chore(deps): update dependency co.fs2:fs2-io to v3.10.1 (#1105)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-25 07:08:35 +03:00
folex
92d0450481
fix(ci): disable system services in Nox (#1100) 2024-03-08 16:59:24 -03:00
renovate[bot]
6aa78eeb6f
fix(deps): update dependency @fluencelabs/js-client to v0.9.0 (#1088)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: drrtuy <drrtuy@gmail.com>
Co-authored-by: Valery Antopol <valery.antopol@gmail.com>
Co-authored-by: InversionSpaces <InversionSpaces@vivaldi.net>
2024-03-07 12:36:22 +00:00
InversionSpaces
5c7f6a89c6
feat(compiler): Reimplement noXor compiler flag [LNG-347] (#1096)
* Fix imports

* Remove constants

* Return constants

* Refactor

* Add config

* Do not propagate errors

* Do not propagate errors through on

* Rename hop ephemeral streams

* Add comments

* Add tests
2024-03-05 10:45:21 +07:00
fluencebot
c444d24f89
chore(main): release aqua 0.14.4 (#1095)
* chore(main): release aqua 0.14.4

* chore: Bump aqua version to 0.14.4
2024-03-01 10:24:02 +03:00
InversionSpaces
a6c8e75c27
fix(compiler): Import abilities with use [LNG-324] (#1077)
* Add IntoApply

* Savepoint

* Add backtrack

* Return ability name

* Add service resolution

* Return import ability

* Add test

* Rewrite toDottedName

* Rewrite ability resolution

* Fix offset

* Add tests

* Add test

* Add comments

* Add test

---------

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2024-02-29 14:56:05 +01:00
Dima
d7fef3db5f
fix(compiler): Bug in renaming [LNG-346] (#1094) 2024-02-29 09:23:34 +00:00
fluencebot
6e9689945d
chore(main): release aqua 0.14.3 (#1092) 2024-02-29 09:00:05 +00:00
InversionSpaces
23aba18c7d
fix(compiler): Change noEmptyResponse default to true (#1093)
Change noEmptyResponse default to true
2024-02-29 11:38:37 +03:00
renovate[bot]
96c1675350
chore(deps): update dependency @fluencelabs/interfaces to v0.12.0 (#1091)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-26 13:53:04 +00:00
renovate[bot]
5216637fcd
chore(deps): update dependency @fluencelabs/aqua-lib to v0.10.2 (#1090)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-26 13:28:59 +00:00
Dima
3e9d385668
fix(language-server): Name clashing in LSP [LNG-342] (#1089) 2024-02-26 13:00:25 +00:00
fluencebot
27f132f18a
chore(main): release aqua 0.14.2 (#1087) 2024-02-21 14:43:14 +03:00
Dima
b22762ca6d
fix(compiler): Recursively find abilities [LNG-338] (#1086) 2024-02-21 14:11:21 +03:00
fluencebot
df5eb29d92
chore(main): release aqua 0.14.1 (#1064) 2024-02-20 14:15:27 +00:00
Dima
245f6640f8
feat(language-server): Resolve paths for imports (#1079) 2024-02-20 12:52:54 +00:00
renovate[bot]
e2b150a786
chore(deps): update dependency @fluencelabs/aqua-lib to v0.10.1 (#1085)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-20 12:21:30 +00:00
renovate[bot]
82ac0b2d41
chore(deps): update dependency scala to v3.4.0 (#1081)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-20 11:48:59 +00:00
Dima
3cd31c5827
feat(language-server): Add types for types in LSP API (#1078) 2024-02-20 12:02:55 +01:00
renovate[bot]
9423ffc509
chore(deps): update dependency org.scalatest:scalatest to v3.2.18 (#1073)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-12 09:30:27 +00:00
renovate[bot]
9444ce745a
chore(deps): update dependency org.scalatestplus:scalacheck-1-17 to v3.2.18.0 (#1074)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-12 09:02:50 +00:00
renovate[bot]
f4cc7818f4
fix(deps): update dependency @fluencelabs/js-client to v0.8.3 (#1072)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-12 08:43:59 +00:00
Dima
17fb77c40f
fix(compiler): Use strict to check types availability [LNG-334] (#1071) 2024-02-12 09:23:14 +01:00
Dima
f7194f0a54
feat(language-server): Support declares and exports in LSP [LNG-304, LNG-319] (#1070)
Co-authored-by: InversionSpaces <inversionspaces@vivaldi.net>
2024-02-07 09:21:42 +00:00
renovate[bot]
d03211b492
fix(deps): update dependency @fluencelabs/js-client to v0.8.1 (#1065)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-07 07:27:52 +00:00
renovate[bot]
a8ae49b55b
fix(deps): update dependency @fluencelabs/js-client to v0.8.0 (#1063)
* fix(deps): update dependency @fluencelabs/js-client to v0.8.0

* Remove npm

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Akim Mamedov <akim99999999@gmail.com>
2024-01-31 23:57:56 +07:00
fluencebot
d30b6e1b38
chore(main): release aqua 0.14.0 (#1048) 2024-01-30 12:24:50 +03:00
Dima
1a0b3a22c1
fix(compiler): Streams in closures generates wrong AIR (#1055) 2024-01-30 11:34:50 +03:00
renovate[bot]
11f8d3b11b
fix(deps): update dependency @fluencelabs/js-client to v0.7.0 (#1056)
* fix(deps): update dependency @fluencelabs/js-client to v0.7.0

* fix(ci): nox:minimal_unstable => nox:unstable

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: folex <0xdxdy@gmail.com>
2024-01-29 15:30:50 +00:00
renovate[bot]
d828cbd3bd
chore(deps): update dependency loglevel to v1.9.1 (#1058)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-29 17:15:58 +03:00
renovate[bot]
3a79239022
chore(deps): update dependency @fluencelabs/interfaces to v0.11.0 (#1057)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-29 16:33:37 +03:00
renovate[bot]
0e44e7a0b1
chore(deps): update dependency @types/node to v18.19.10 (#1060)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-29 12:21:06 +00:00
renovate[bot]
d14d36215c
chore(deps): update dependency ts-jest to v29.1.2 (#1061)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-29 12:00:36 +00:00
renovate[bot]
f085d207bb
chore(deps): update jest monorepo (#1062)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-29 11:39:20 +00:00
renovate[bot]
7694514d29
chore(deps): update all github-actions (#1059)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-29 11:17:39 +00:00
InversionSpaces
7b6c7245ec
perf(compiler): Optimize Linker [LNG-321] (#1049)
* Refactor parser

* Refactor parser

* Refactor parser

* Refactor parser

* Savepoint

* Savepoint

* Refactor

* Fix unit test

* Remove file

* Filter exported modules

* Fix test

* Restore Test.scala

* Add comments
2024-01-22 16:01:54 +01:00
Dima
abcb63db3b
perf(compiler): Inliner optimization [LNG-322] (#1047) 2024-01-22 10:08:06 +00:00
renovate[bot]
27704a9169
chore(deps): update dependency @fluencelabs/interfaces to v0.10.0 (#1051)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-19 12:45:05 +00:00
renovate[bot]
f94f38327a
fix(deps): update dependency @fluencelabs/js-client to v0.6.0 (#1050)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-19 12:31:32 +00:00
renovate[bot]
e323368b69
chore(deps): update dependency org.scala-js:sbt-scalajs to v1.15.0 (#1040)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-19 12:17:19 +00:00
renovate[bot]
ff1800c674
chore(deps): update dependency co.fs2:fs2-io to v3.10-365636d (#1039)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-19 15:02:57 +03:00
InversionSpaces
d057a5e695
feat(compiler)!: Force aqua header [LNG-308] (#1028)
* Refactor

* deprecate `module`, force `aqua`, fix integration and unit tests

* fix ImportFromSpec

* Savepoint

* Fix

* Semantic error on module header

* Refactor

* Add begin token

* Fix tests

* Remove DHT examples

* Use git aqua-lib

* Fix headers

* Fix headers

* Fix headers

* Fix headers

* Fix headers

* Fix headers

* Fix headers

* Fix test

* Unignore tests

* Update aqua-lib

---------

Co-authored-by: DieMyst <dmitry.shakhtarin@fluence.ai>
2024-01-18 10:43:23 +01:00
InversionSpaces
34e274d45e
chore(tests): Remove usage of onConnectionStateChange [LNG-291] (#1046)
Remove usage of onConnectionStateChange
2024-01-16 13:19:09 +03:00
fluencebot
098fac79ba
chore(main): release aqua 0.13.4 (#1036) 2024-01-11 11:26:38 +03:00
Dima
85f3ecdf39
fix(compiler): Add outside context to closures [LNG-317] (#1038) 2024-01-11 11:00:32 +03:00
InversionSpaces
d46ee0347f
fix(compiler): Type check arrow calls on services and abilities [LNG-315] (#1037)
* Rewrite resolveIntoArrow

* Refactor

* Refactor resolveIntoCopy

* Refactor resolveIntoIndex

* Refactor resolveIntoField

* Fix test

* Remove package-lock.json

* Add tests

* Add comment
2024-01-10 11:36:20 +01:00
Dima
5241f522d8
fix(compiler): Passing closures with abilities [LNG-314] (#1035) 2024-01-09 19:31:37 +03:00
InversionSpaces
d5cd77bb86
feat(compiler): Enhance message of type error [LNG-313] (#1033) 2024-01-09 15:15:27 +03:00
InversionSpaces
ae32f80277
feat(compiler): for ... rec [LNG-307] (#1026)
* Add parser

* Add semantics

* Add inlining

* Add range test

* Rewrite to for ... rec

* Rewrite tests

* Fix import

* Add nested test

* Remove only

* Add yes|no test

* Add multi rec test

* Add pipeline test

* Unignore tests

* Change timeouts

* Add remote rec test

* Fix integration tests

* Add parser test

* Add semantics test

* Add inlining test

* Add comment
2024-01-09 12:48:02 +01:00
fluencebot
9aec470d38
chore(main): release aqua 0.13.3 (#1025) 2023-12-25 12:51:54 +00:00
renovate[bot]
851a66fb5f
fix(deps): update dependency @fluencelabs/js-client to v0.5.5 (#1020)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-22 14:32:26 +00:00
renovate[bot]
55836d5a9d
chore(deps): update dependency @fluencelabs/aqua-lib to v0.9.0 (#1030)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-21 18:00:09 +01:00
InversionSpaces
a4d8ee7083
fix(compiler): Do not generate hop back with empty response by default [LNG-305] (#1019)
Change default flag, add test
2023-12-21 11:17:50 +00:00
InversionSpaces
5bc01a9c02
feat(lsp-api): Fix interface definition [LNG-298] (#1027)
* Fix interface definition

* Fix comment
2023-12-19 17:01:34 +01:00
InversionSpaces
33a2ca87e0
feat(api): Refactor js api interfaces (#1024)
Change types
2023-12-18 12:48:03 +01:00
fluencebot
7fe0212761
chore(main): release aqua 0.13.2 (#1016)
* chore(main): release aqua 0.13.2

* chore: Bump aqua version to 0.13.2
2023-12-15 18:27:46 +00:00
InversionSpaces
6732f8f2cc
fix(tests): Lower tests size (#1018)
* Lower tests size

* Remove prints
2023-12-14 10:27:14 +01:00
renovate[bot]
bb013d79f7
chore(deps): update dependency @fluencelabs/aqua-lib to v0.8.2 (#1017)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-14 11:35:06 +03:00
InversionSpaces
f7bfa8317b
feat(api): Accept structured imports [LNG-288] (#989)
* Refactor sources

* Fix FuncCompiler compilation

* Normalize imports

* Add relative imports

* Remove Prelude

* Remove import

* Add a log

* Add more logs

* Use snapshot of fs2

* Remove prints

* Add comments

* Savepoint

* Rewrite imports resolution

* Fix relative import

* Add comment

* Added comments

* Fix comment

* Add comments

* Refactor

* Refactor

* Add tests

* Fix tests

* Update tests

* Add comment

* Lower number of tests

* Comment, rename

* Add comment

* Add emptiness check
2023-12-13 17:19:34 +01:00
renovate[bot]
00252fe8a7
chore(deps): update all github-actions (major) (#1014)
chore(deps): update all github-actions

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-13 11:46:28 +02:00
renovate[bot]
2f135e4fd2
chore(deps): update dependency com.outr:scribe to v3.13.0 (#1008)
* chore(deps): update dependency com.outr:scribe to v3.13.0

* Fix field

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: InversionSpaces <inversionspaces@vivaldi.net>
2023-12-11 12:26:15 +01:00
renovate[bot]
d97de9c83f
chore(deps): update dependency @types/node to v18.19.3 (#1012)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-11 11:46:35 +01:00
renovate[bot]
409570afde
chore(deps): update dependency typescript to v5.3.3 (#1013)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-11 09:58:51 +00:00
renovate[bot]
39a23db2bf
chore(deps): update dependency ts-node to v10.9.2 (#1010)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-11 09:43:11 +00:00
renovate[bot]
7689ee0fd9
chore(deps): update dependency prettier to v3.1.1 (#1015)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-11 09:29:09 +00:00
fluencebot
051aa41715
chore(main): release aqua 0.13.1 (#988) 2023-12-07 16:45:46 +03:00
Anatolios Laskaris
c474a77e76
chore: Fix fcli e2e (#1006)
Fix e2e
2023-12-07 15:02:01 +02:00
Dima
74d02e1f63
feat(language-server): Pass token types to LSP [LNG-285] (#999) 2023-12-07 12:06:51 +00:00
Dima
4cecab1a26
fix(compiler): Use correct empty stream as argument [LNG-280, LNG-292] (#967) 2023-11-28 10:45:12 +00:00
renovate[bot]
6329e42f56
chore(deps): update dependency @fluencelabs/aqua-lib to v0.8.1 (#976)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-11-27 12:04:23 +00:00
renovate[bot]
9d0fb2b841
fix(deps): update dependency @fluencelabs/js-client to v0.5.3 (#978)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-27 11:48:09 +00:00
InversionSpaces
e65836e3c8
fix(tests): Fix imports in integration tests (#998)
Fix imports
2023-11-27 12:35:15 +01:00
InversionSpaces
b24fcf686f
fix(e2e): Use main branch for fcli (#987)
Use main branch
2023-11-27 13:20:13 +02:00
renovate[bot]
4342812450
chore(deps): update dependency com.eed3si9n:sbt-assembly to v2.1.5 (#991)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-27 14:18:54 +03:00
renovate[bot]
011a1d7260
chore(deps): update dependency @fluencelabs/interfaces to v0.9.0 (#990)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-27 11:07:13 +00:00
Anatolios Laskaris
2ac69616b5
chore: Fix e2e (#997)
Fix e2e
2023-11-27 12:51:37 +02:00
InversionSpaces
2d4b2aece4
fix(compiler): Allow returning resolved service as ability [LNG-266] (#977)
* Refactor

* Refactor type system

* Remove println

* Fix renaming

* Add unit tests

* Do not convert to call arrow

* Check ability

* Refactor captured values resolution

* Remove println

* Fix fields gathering

* Remove println

* Remove println

* Fix renaming, export ability

* Rename only abilities

* Fix unit tests

* Fix captured arrows renaming

* Add comments

* Refactor

* Rename only arrows

* Add comments, refactor

* Add comments

* Rename method

* Add integration test

---------

Co-authored-by: Anatolios Laskaris <github_me@nahsi.dev>
Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-11-23 10:12:44 +00:00
fluencebot
d7023c0f10
chore(main): release aqua 0.13.0 (#944)
* chore(main): release aqua 0.13.0

* chore: Bump aqua version to 0.13.0
2023-11-22 15:21:38 +01:00
InversionSpaces
1e525fad35
feat(api): Use js.UndefOr for defaultServiceId (#980)
Use js.UndefOr
2023-11-22 13:44:34 +00:00
Anatolios Laskaris
3472f2016f
chore: Fix e2e after renaming flox to fcli (#986)
Fix e2e
2023-11-22 10:38:57 +02:00
InversionSpaces
cee444862a
feat(compiler): Generate empty calls to responseHandlerSrv [LNG-286] (#979)
* Add noEmptyResponse

* Fix tests
2023-11-17 10:43:13 +00:00
InversionSpaces
11c8970fd8
feat(compiler)!: Make nil option bottom [LNG-279] (#968)
* Make nil option of bottom

* Fix tests

* Make literals of data type

* Add unit tests

* Remove print
2023-11-14 11:02:58 +00:00
renovate[bot]
522d95b8e3
chore(deps): update dependency co.fs2:fs2-io to v3.9.3 (#969)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-13 12:17:48 +03:00
InversionSpaces
68425ed42a
feat(compiler)!: Prohibit mutating options [LNG-277] (#960)
* Parse any nested type

* Refactor type system

* Fix restriction

* Refactor type resolution

* Return stream definition

* Update examples

* Refactor

* Refactor

* Refactor integration tests

* Export service

* Add integration test

* Fix args provider

* Add parser unit tests

* Add type resolution unit tests

* Add more unit tests

* DataTypeToken -> CompositeTypeToken

* GeneralStreamType -> MutableStreamType

* Refactor

* Refactor TypeResolution

* colType -> collectionType

* Refactor

* Fix PushToStreamSem

* BasicTypeToken -> ScalarTypeToken

* CompositeTypeToken -> BasicTypeToken

* Fix for nil

* Make stream collectible

* Refactor collectible type

* Use internalError

* Add unit tests
2023-11-13 11:58:36 +03:00
renovate[bot]
313502ecae
fix(deps): update dependency @fluencelabs/js-client to v0.4.3 (#966)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-09 07:55:30 +03:00
Dima
a1576efad9
fix(compiler): Code generate wrong stream name in AIR [LNG-276] (#958) 2023-11-02 13:13:25 +00:00
Dima
6e6b567f8e
fix(compiler): Incorrect focus on error [LNG-274] (#959) 2023-11-02 12:38:19 +00:00
Anatolios Laskaris
3b0d31325a
chore: Make renovate care for unstable versions (#942)
Make renovate care for unstable versions

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-11-02 10:07:23 +02:00
renovate[bot]
e7ea1f80ac
chore(deps): update dependency sbt/sbt to v1.9.7 (#949)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-01 12:46:31 +00:00
renovate[bot]
7ce95d0a75
chore(deps): update dependency com.eed3si9n:sbt-assembly to v2.1.4 (#948)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-01 12:28:48 +00:00
InversionSpaces
5a3c5e6666
fix(compiler): Unknown service method call is ignored [LNG-273] (#957)
* Remove property token adjustment

* Revert "Remove property token adjustment"

This reverts commit 27d72f2bff4993fb58fd5125e0fe4ffae5c2aa77.

* Remove scope word

* Refactor

* Refactor, add error

* Add unit tests

* Fix specifier for struct
2023-11-01 14:55:59 +03:00
renovate[bot]
077dc8ff13
fix(deps): update dependency @fluencelabs/js-client to v0.4.2 (#956)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-01 10:24:31 +01:00
InversionSpaces
78ee753c7b
feat(compiler): Always generate last argument of fold [LNG-265] (#947)
* Always generate last in fold

* Fix unit tests

* Add methods
2023-10-30 12:58:51 +03:00
renovate[bot]
634b1c17b6
fix(deps): update dependency @fluencelabs/js-client to v0.4.1 (#945)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-30 08:46:50 +00:00
Dima
38f77285f5
fix(compiler): Throw an error when comparing an alias and a named type with the same name [LNG-231] (#946) 2023-10-27 11:18:44 +00:00
Dima
45ca7bbf3e
fix(compiler): Multiple closures in one function [LNG-262] (#941) 2023-10-27 09:24:52 +02:00
InversionSpaces
fcdb5b0fef
feat(compiler): Allow omitting field name in struct creation [LNG-261] (#943) 2023-10-25 09:12:09 +00:00
fluencebot
2f11a0649f
chore(main): release aqua 0.12.4 (#917)
* chore(main): release aqua 0.12.4

* chore: Bump aqua version to 0.12.4
2023-10-23 14:20:47 +00:00
Dima
fab46ee130
fix(compiler): Return ability arrow [LNG-258] (#935) 2023-10-23 16:59:55 +03:00
InversionSpaces
c83d69e689
fix(compiler): Passed function is not handled correctly [LNG-260] (#940)
* Fix renaming

* Add integration test
2023-10-23 11:54:09 +00:00
renovate[bot]
441c012e01
fix(deps): update dependency @fluencelabs/js-client to v0.3.0 (#936)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-23 13:34:46 +03:00
InversionSpaces
679d43f7eb
feat(dev): Add PR template (#934)
* Add PR template

* Add issue point

---------

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-10-17 17:22:05 +03:00
InversionSpaces
03d23eb577
feat(compiler): Handle error function exit in tracing mode [LNG-250] (#921)
* Wrap function calls with xor

* Do not detach tracing call in case of error exit

* Fix comment
2023-10-17 13:42:38 +00:00
renovate[bot]
030a0d464b
chore(deps): update dependency @fluencelabs/aqua-lib to v0.7.7 (#923)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-17 12:35:45 +00:00
renovate[bot]
14f3d92ef4
fix(deps): update dependency @fluencelabs/js-client to v0.2.1 (#930)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-17 15:20:32 +03:00
InversionSpaces
ba15d9e06a
fix(compiler): Fix topology for adjacent ons [LNG-257] (#929)
* Always enforce path

* Revert "Always enforce path"

This reverts commit 5ee1e37c9e1694ed739315af2e96d51322549a5d.

* Add integration test

* Force return to relay

* Remove unused import

* Add comment

* Add unit test

* Add TODO

* Remove println

* Fix typo
2023-10-17 11:59:30 +00:00
InversionSpaces
f39bca928a
chore(deps): Bump js-client to 0.2.0 (#928)
Bump js-client to 0.2.0
2023-10-11 14:21:42 +00:00
InversionSpaces
5f6c47ffea
feat(compiler): Optimize math in compile time [LNG-245] (#922)
* Move service calls for math to inlining

* Fix: add predo

* Introduce CallServiceRaw

* Add comment

* Add optimization to inlining

* Add tests

* map -> mapValues

* Refactor type

* Add optimization

* Add optimization test

* Fix unit tests

* Fix PR comments

* Restrict optimization

* Add substraction to optimization

* Apply optimizations in gate

* Fix sign, move optimization to unfold

* Fix type and tests

* Fix unit tests

* Add unit test

* Fix after merge

* Add optimization, fix unit tests

* Fix comment
2023-10-09 13:02:26 +03:00
InversionSpaces
b298eebf5e
fix(compiler): Fix gate inlining [LNG-253] (#924)
* Fix gate inlining

* Remake stream gate inlining, fix unit tests

* Fix: add flat inline

* Refactor, add comments
2023-10-08 12:52:54 +02:00
InversionSpaces
feb7a167a2
fix(compiler): fix typo (#916)
Fix typo
2023-09-28 15:20:28 +03:00
fluencebot
c109f37efa
chore(main): release aqua 0.12.3 (#912)
* chore(main): release aqua 0.12.3

* chore: Bump aqua version to 0.12.3
2023-09-28 10:12:26 +00:00
InversionSpaces
1e636cc076
feat(lsp-api): Add infoType (#915)
Add infoType
2023-09-28 13:00:53 +03:00
Dima
878990a837
feat: Create structs with stream maps [fixes LNG-244] (#893) 2023-09-27 15:07:22 +03:00
InversionSpaces
b2ca1d35bf
feat(tests): Add integration test for result error handling (#914)
* Add integration test

* Fix test

* Fix test
2023-09-27 13:14:50 +02:00
InversionSpaces
ca6cae96ad
feat(compiler): Make if propagate errors [fixes LNG-202] (#779)
* Change if inlining, add fail model

* Inline if

* Fix, add comments

* Add integration test

* Fix test

* Fix test

* toBe -> toEqual

---------

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-09-27 09:52:52 +00:00
InversionSpaces
f158074c4e
fix(compiler): Handle errors from result handling [fixes LNG-247] (#913)
Move args and return under try
2023-09-27 12:29:06 +03:00
InversionSpaces
a80033b81c
feat(compiler): Replace %last_error% with :error: [fixes LNG-239] (#883)
* %last_error% -> :error:

* Add integration test

* Fix integration tests

* Update integration test
2023-09-26 13:28:13 +03:00
fluencebot
91af0bf055
chore(main): release aqua 0.12.2 (#889) 2023-09-26 11:53:26 +03:00
InversionSpaces
27a781dd3f
feat(compiler): Add warnings subsystem [fixes LNG117] (#906)
* ErrorsAlgebra -> ReportAlgebra

* Refactor ReportAlgebra

* Refactor

* Refactor AquaError

* Fixes

* Add warnings, refactor

* Refactor parser

* Move semantics

* Savepoint

* Refactor semantics and compiler

* Refactor types

* Refactor compiler

* Refactor compiler

* Refactor types

* Refactor retunr types

* Return warnings

* Add simple warning

* Refactor to ValidatedNec

* Refactor

* Add comment

* Propagate warnings to LspContext

* Propagate warnings to LSP

* Add warnings to js api

* Update LSP js api

* Use export declare

* Add comment

* Refactor span rendering

* Remove variable name warning

* Add warning on unused call results

* Add unit tests

* Remove println
2023-09-25 13:00:43 +00:00
renovate[bot]
1c708c8bb0
fix(deps): update dependency @fluencelabs/js-client to v0.1.7 (#908)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-25 09:55:51 +00:00
shamsartem
66638afa2d
feat: rethrow errors to capture stacktrace (#907)
* feat: rethrow errors to capture stacktrace

* add null check
2023-09-20 18:56:09 +02:00
InversionSpaces
8741c910be
feat(compiler): Fail on internal error [fixes LNG-229] (#905)
* Refactor utils

* Add errors project

* logger.error -> internalError

* Add comment

* Suppress stack trace

---------

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-09-19 17:01:42 +02:00
renovate[bot]
fb75bc267e
fix(deps): update dependency @fluencelabs/js-client to v0.1.6 (#890)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-19 12:05:19 +00:00
InversionSpaces
ed9e708939
fix(compiler): Fix arrows capture in closures [fixes LNG-242] (#903)
* Fix arrows capture

* Add comment

* Add test

* Add integration test
2023-09-19 14:25:11 +03:00
InversionSpaces
feccffcb00
chore(docs): Update README (#892)
* Update README.md, add USAGE.md, delete INSTALL.md

* Add spaces

* fullBundleJS

---------

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-09-19 11:33:39 +03:00
shamsartem
594f46529d
feat: export types from aqua-api (#904)
* feat: export types from aqua-api

* improve
2023-09-18 16:39:59 +00:00
InversionSpaces
54ddcc8b62
fix(compiler): Do not restrict stream args when ability is present [fixes LNG-233] (#902)
Add test
2023-09-18 14:43:22 +00:00
renovate[bot]
bba6645e7a
chore(deps): update dependency com.eed3si9n:sbt-assembly to v2.1.3 (#900)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-18 11:49:07 +00:00
renovate[bot]
d1d5a35a42
chore(deps): update dependency sbt/sbt to v1.9.6 (#896)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-18 11:37:09 +00:00
renovate[bot]
ab9a511129
chore(deps): update dependency co.fs2:fs2-io to v3.9.2 (#895)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-18 14:22:01 +03:00
Anatolios Laskaris
f2c2c07cf2
chore(release-please): Set aqua-api version in tests (#901)
Set aqua-api version in tests
2023-09-18 12:01:25 +03:00
InversionSpaces
67d8151d94
feat(build): Implement custom bundle task (#894)
* Add link settings

* fix

* Rename to api-dist-js

* Correct import

* Update CI

* Implement bundleJS

* Add comments

* Add TODO

* Fix import

* Fix workflow

---------

Co-authored-by: Artsiom Shamsutdzinau <shamsartem@gmail.com>
2023-09-18 09:53:25 +02:00
InversionSpaces
3f916c78ab
feat(aqua-api): Use scala.js link instead of opt (#891)
* Add link settings

* fix

* Rename to api-dist-js

* Correct import

* Update CI

---------

Co-authored-by: Artsiom Shamsutdzinau <shamsartem@gmail.com>
2023-09-15 15:42:04 +02:00
InversionSpaces
6be2a3d5da
feat(compiler): Services as abilities [fixes LNG-206] (#873)
* Refactor ServiceSem

* Refactor AbilityIdSem

* Remove tokens from state

* Refactor

* Add mangler

* Fix tests

* Refactor valueToRaw

* ServiceIdTag

* AbilityId -> ServiceId

* Add ServiceType

* Fix defineServiceType

* Refactor resolveArrowDef

* Refactor TypesHelper

* Add ServiceIdTag inlining

* Implement resolution

* Add service as ability passing

* Fix importing services

* Fix cli

* Implement default service

* Remove println

* Fix capture

* Add integration test

* Fix id

* Fix test

* Fix test

* Refactor test

* Do not resolve id

* Refactor FuncArrow creation

* Refactor FuncArrow wrapper creation

* Add named arguments

* Add comment

* ensureIsString -> valueToStringRaw, refactor OnSem

* Resolve services as abilities

* Add name to varNames

* Remove service hack

* Capture services, do not rename captured

* Rename arrows along with values

* Fix CallArrowRaw.map

* Fix unit tests

* Remove service case

* Refactor abilities state

* Propagate rootServiceIds

* Remove unused

* Add comments

* Refactor

* Refactor

* Add test

---------

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-09-15 10:34:21 +02:00
Dima
f8b5017918
feat(language-server): Pass errors to lsp context [fixes LNG-243] (#888) 2023-09-14 15:19:16 +00:00
renovate[bot]
d6f879ef7a
fix(deps): update dependency @fluencelabs/js-client to v0.1.4 (#887)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-14 13:32:45 +00:00
Dima
404d5ffae2
chore: add code to run aqua (#886)
* add code to run aqua

* delete aqua-cli

* Apply suggestions from code review

---------

Co-authored-by: InversionSpaces <InversionSpaces@vivaldi.net>
2023-09-13 10:55:22 +00:00
Anatolios Laskaris
1e2e35ee88
chore: Remove aqua cli (#874)
* Remove aqua cli

* fix

* Fix

---------

Co-authored-by: DieMyst <dmitry.shakhtarin@fluence.ai>
2023-09-12 13:37:40 +03:00
Dima
9f863eae43
chore: Compile integration tests with aqua-api [fixes LNG-240] (#884) 2023-09-12 13:11:50 +03:00
fluencebot
03042a71f3
chore(main): release aqua 0.12.1 (#866)
* chore(main): release aqua 0.12.1

* chore: Bump aqua version to 0.12.1

---------

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-09-11 16:11:55 +03:00
renovate[bot]
148cb0004e
chore(deps): update actions/checkout action to v4 (#881)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-11 12:42:20 +00:00
renovate[bot]
cd863ff246
chore(deps): update dependency org.scalatest:scalatest to v3.2.17 (#877)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-11 15:30:26 +03:00
renovate[bot]
e219752c9c
chore(deps): update dependency scala to v3.3.1 (#878)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-11 12:13:48 +00:00
renovate[bot]
3419607e8c
fix(deps): update dependency @fluencelabs/aqua-lib to v0.7.3 (#882)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-11 14:59:47 +03:00
InversionSpaces
69a808e243
fix(compiler): Error on not arrow call after <- (#876)
* Add error report

* Add tests
2023-09-08 14:21:19 +02:00
renovate[bot]
df111adf21
fix(deps): update dependency @fluencelabs/js-client to v0.1.3 (#875)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-08 10:37:37 +02:00
renovate[bot]
c857807014
chore(deps): update dependency co.fs2:fs2-io to v3.9.1 (#867)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-05 15:00:32 +03:00
renovate[bot]
4365dcb899
chore(deps): update dependency @fluencelabs/interfaces to v0.8.2 (#859)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-05 14:41:58 +03:00
renovate[bot]
1f23545b49
fix(deps): update dependency @fluencelabs/js-client to v0.1.1 (#865)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-05 14:23:04 +03:00
InversionSpaces
c1fbea1a49
chore(compiler): Add PathFinder test (#872) 2023-09-04 11:22:57 +00:00
InversionSpaces
443e65e3d8
fix(compiler): Fix closure stream capture [fixes LNG-58] (#857) 2023-09-01 16:05:32 +03:00
renovate[bot]
77864202d1
chore(deps): update dependency sbt/sbt to v1.9.4 (#860)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-01 15:42:23 +03:00
fluencebot
5adbae0677
chore(main): release aqua 0.12.0 (#853)
* chore(main): release aqua 0.12.0

* chore: Bump aqua version to 0.12.0
2023-08-25 11:55:20 +03:00
Akim
0f9ede09fb
feat(js-client)!: Move to new js-client interface (#855)
* js-client.api -> js.client

* fix types

* Update js-client

* Remove redundant connect

* Set latest js-client
2023-08-25 11:39:10 +03:00
InversionSpaces
2a0b207633
feat(compiler): Restrict abilities usage [fixes LNG-208] (#854)
* Refactor

* Refactor

* Refactor

* Remove ScopeRaw

* Refactor, forbid exporting

* Add export checks

* Refactor

* Forbid exporting abilities

* Fix integration tests

* Forbid implicit ability export

* Simplify exports

* Fordbid using non data types in collections

* Forbid unappropriate struct field types

* Refactor

* Add export tests

* Add collection tests

* Add struct fields test

* Fixes

* Fix
2023-08-24 16:09:39 +03:00
Anatolios Laskaris
3b033852f9
chore: Use node 18 (#856)
Use node 18
2023-08-24 12:20:34 +02:00
InversionSpaces
bf0b51fa5b
fix(compiler): Fix nested abilities [fixes LNG-220] (#852)
* Fix fields gathering

* Remove println

* Add test

* Remove println

* Add comments

* Add comments
2023-08-22 11:53:06 +02:00
fluencebot
5db1282c1f
chore(main): release aqua 0.11.11 (#850)
* chore(main): release aqua 0.11.11

* chore: Bump aqua version to 0.11.11

---------

Co-authored-by: Anatoly Laskaris <github_me@nahsi.dev>
2023-08-21 16:40:35 +03:00
Anatolios Laskaris
badc7d7a45
chore(ci): Use fluencebot to bump versions (#851)
Use fluencebot to bump versions
2023-08-21 15:41:03 +03:00
Anatolios Laskaris
7a6fce27f7
chore: Revert release (#848)
* Revert "chore(main): release aqua 0.11.10 (#835)"

This reverts commit 071ba7d483db3defdb15605db76e0e131bdd7564.

* Release as 0.11.11
2023-08-21 14:37:49 +03:00
fluencebot
071ba7d483
chore(main): release aqua 0.11.10 (#835) 2023-08-21 14:11:02 +03:00
renovate[bot]
75b0b5760d
chore(deps): update catsv to v2.10.0 (#844)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-21 13:45:12 +03:00
Dima
8060695dbb
feat: parseq implementation (fixes LNG-223) (#840)
* parsec implementation

* add test code

* parsec expression

* Refactor

* Refactor

* Add return strategy to on

* Add ExitStrategy

* Add TopologyPath

* Add ExitStrategy.ToRelay

* Handle ToRelay

* Refactor

* Refactor

* Refactor

* Handle OnModel with Relay strategy

* parsec -> parseq

* parsec -> parseq

* Add semantics test

* Add topology tests

* Add comments

---------

Co-authored-by: InversionSpaces <InversionSpaces@vivaldi.net>
2023-08-21 14:26:30 +04:00
Dima
019611a89c
feat(compiler): Structural typing for data and abilities [fixes LNG-215] (#843) 2023-08-18 16:15:20 +03:00
InversionSpaces
eb4cdb0dd1
fix(compiler): Generate stream restriction for scoped exprs [fixes LNG-222] (#841)
* Add show for AST

* Update ForSem

* Fix if and try

* Fix else, otherwise, catch, add tests

* Add integration tests
2023-08-17 10:30:02 +04:00
InversionSpaces
f562bd40b6
fix(compiler): Refactor values [fixes LNG-57] (#821)
* Refactor parser

* Savepoint

* Refactor CliFunc and TypesInterpreter

* Fix CliFunc

* Fix parser tests

* Fix tests compilation

* Fix callArrowToRaw

* Fix co parsing, add tests

* Add par tests

* Fix field parsing, add test

* Return ability to CallArrowToken

* Fix names

* Refactor and add comments

* Refactor, add comments

* Fix
2023-08-15 13:33:34 +03:00
Anatolios Laskaris
6146f8e40a
fix: Fix release build command (#834)
Fix
2023-08-10 16:46:03 +03:00
fluencebot
49c9be6dd8
chore(main): release aqua 0.11.9 (#813) 2023-08-09 15:18:11 +00:00
renovate[bot]
731f424576
chore(deps): pin dependency @fluencelabs/interfaces to 0.8.1 (#833)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-09 15:02:45 +00:00
renovate[bot]
50e8bab3de
chore(deps): update dependency @fluencelabs/aqua-lib to v0.7.3 (#830)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-09 17:49:01 +03:00
shamsartem
c7fca40f67
feat: wrap aqua api (#807) 2023-08-09 17:32:27 +03:00
InversionSpaces
a5e9354aeb
feat(compiler): Add equality ops [fixes LNG-217] (#820)
* Add eq ops

* Fixed if

* Fix return

* Fix tests

* Add parser tests

* Fix types, add semantics tests

* Add integration tests

* Add integration test

* Remove comment
2023-08-09 13:38:24 +00:00
Dima
ef4b0143ac
fix(compiler): Runtime error on compilation exported functions with top types [fixes LNG-218] (#822) 2023-08-09 16:21:18 +03:00
Anatolios Laskaris
d2637976c1
chore: Exclude integration-tests during publishing (#824)
* Exclude integration-tests

* Rename package

---------

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-08-03 15:32:27 +03:00
Anatolios Laskaris
bc75611eb3
chore: Install without lockfile (#825)
Fix
2023-08-03 15:12:46 +03:00
Anatolios Laskaris
726230c987
chore(e2e): Override deps then install (#823)
Override deps then install
2023-08-03 14:04:08 +03:00
renovate[bot]
2d5d377967
chore(deps): update all github-actions (#810)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-01 13:35:04 +03:00
Dima
4e3e70f4fc
fix(compiler): Nested abilities [fixes LNG-214] (#816) 2023-07-31 14:40:06 +03:00
renovate[bot]
dba12b8277
chore(deps): update dependency sbt/sbt to v1.9.3 (#817)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-31 13:31:21 +03:00
InversionSpaces
a5b6102422
feat(compiler): Add boolean algebra [fixes LNG-211] (#814) 2023-07-27 14:11:36 +03:00
Dima
fabf8d7d61
feat(compiler): Restrict exporting functions that return arrow types or ability types [fixes LNG-209] (#815) 2023-07-26 12:55:16 +03:00
InversionSpaces
4c3c32b7c4
fix(compiler): Fix if with brackets parsing (#812) 2023-07-25 10:09:51 +00:00
InversionSpaces
50ba194b86
fix(compiler): Fix math ops for u64 [fixes LNG-204] (#811) 2023-07-25 12:53:50 +03:00
fluencebot
cb539f1332
chore(main): release aqua 0.11.8 (#805) 2023-07-20 18:28:33 +03:00
Anatolios Laskaris
c9bf77d53c
chore(release): Use pnpm instead of sed to bump version (#804)
Use pnpm instead of sed
2023-07-20 11:35:23 +03:00
Anatolios Laskaris
c097bedd47
chore(release): Bump aqua cli version in tests (#803)
Set aqua version in tests
2023-07-20 11:25:02 +03:00
Dima
63a9f42e86
feat(compiler): Abilities (#731) 2023-07-18 17:18:33 +00:00
renovate[bot]
ca52e2542c
fix(deps): update dependency @fluencelabs/fluence-network-environment to v1.1.2 (#786)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-17 19:03:02 +03:00
renovate[bot]
a804504522
chore(deps): update dependency sbt/sbt to v1.9.2 (#799)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-17 13:00:08 +03:00
InversionSpaces
33ab33d4c8
fix(compiler): Fix search for one element cycles (#797) 2023-07-14 15:06:21 +03:00
Anatolios Laskaris
0f9c40e9d1
chore: Fix release (#795)
Fix?
2023-07-14 10:09:03 +03:00
renovate[bot]
cc8610b3e6
chore(deps): update dependency org.portable-scala:sbt-scalajs-crossproject to v1.3.2 (#789)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-13 16:44:40 +03:00
InversionSpaces
b8b0fafda0
feat(compiler): Make on propagate errors [fixes LNG-203] (#788)
* Add fail model

* Make `on` propagate error

* Fix unit tests

* Fix TryTag inlining

* Update XorModel.wrap

* Add comments

* Remove wrapWithXor parameter

* Add unit tests

* Add integration tests

* Add comments

* Fix XorBranch topology
2023-07-12 16:18:47 +03:00
Anatolios Laskaris
a7dba14c7c
chore: Renaming things (#772)
* Renaming

* Use unstable

* Fix

* Fix

* Use main
2023-07-10 09:40:58 +03:00
InversionSpaces
c1fe24b04d
feat(compiler): Make topology hop with non-FFI snippet [fixes LNG-125] (#764)
* Remove MakeRes.canon

* Replace noop with hop

* Rewrite join

* Remove JoinModel, fix tests

* Share code between tests

* Pass type in RestrictionTag(Model)

* Fix MakeRes.hop

* Fix wrapping

* Rename vars, add comments

* Fix XorBranch topology

* Fix tests
2023-07-06 12:44:37 +03:00
folex
22f380a491
fix(ci): use unstable nox image (#780)
* fix(ci): use unstable nox image

* fix(integration-tests): js-client.node 0.7.0, .api 0.12.0

* fix: update pnpm-lock.yaml

* chore: remove aqua.js

---------

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-07-04 12:04:12 -06:00
renovate[bot]
cef7dff098
chore(deps): update dependency sbt/sbt to v1.9.1 (#782)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-04 16:45:23 +00:00
renovate[bot]
742d1f35b7
chore(deps): pin dependency multiaddr to 10.0.1 (#773)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-04 16:32:32 +00:00
renovate[bot]
a10d50407b
chore(deps): update dependency org.typelevel:cats-parse to v0.3.10 (#781)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-04 19:13:49 +03:00
InversionSpaces
667a8255d9
feat(compiler): Find and display link cycles (#787)
Find and display dependency cycles
2023-07-04 10:07:22 +00:00
InversionSpaces
8ba7021cd4
refactor(semantics): Refactor semantics to produce concrete tags [fixes LNG-201] (#776)
* Introduce IfTag, TryTag; Remove XorTag

* Add IfTag, TryTag inlining

* Fix test compilation

* Fix test

* Hack to fix topology

* Support try otherwise syntax

* Add comments

* Refactor diff show

* Handle ParTag.Par in single check, add tests
2023-06-29 16:20:47 +00:00
Dima
339d3a8217
refactor: ArrowInliner refactoring (#777) 2023-06-29 11:43:38 +00:00
InversionSpaces
2985baadfc
chore(tests): Fix typo (#778) 2023-06-29 13:12:59 +03:00
renovate[bot]
9fdf4e1005
chore(deps): update hashicorp/vault-action action to v2.7.0 (#762)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-28 14:46:38 +03:00
renovate[bot]
26f943177d
chore(deps): update dependency org.scala-js:sbt-scalajs to v1.13.2 (#774)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-28 12:31:13 +03:00
Anatolios Laskaris
46705754e6
chore: Fix default branch (#771)
Fix
2023-06-22 15:13:24 +03:00
Anatolios Laskaris
aa10706506
chore: Refactor CI after moving tests from aqua-playground [fixes FLU-352] (#763)
* move integration tests to repo

* Move aqua-playground CI

* Fix

* Use local aqua cli

* Move aqua tests to e2e

* Test new build.sbt

* Fix?

* Test

* Test

* Test

* Test

* Update

* Fix

* Fix

* Fix

* fix

* Fix

* Rename aqua-api to api directory for consistency

* Migrate to pnpm

* Add bump version script

* Test snapshot workflow

* fix

* Fix

* Fix

* Setup pnpm

* Update pnpm version

* Fix

* Do not publish tests

* Update

* Fix

* Fix?

* delete import

* Fix

* Fix

* Fix?

* Fix

* Fix

* Use main branch

* Fix quotes

* Fix

* Fix release

* Cleanup

* Remove compiled examples

* Cleanup

---------

Co-authored-by: DieMyst <dmitry.shakhtarin@fluence.ai>
2023-06-22 14:59:56 +03:00
Dima
6cc3a969d2
chore: move integration tests to repo [LNG-167] (#756) 2023-06-19 19:28:34 +03:00
InversionSpaces
b9d03cbcf0
refactor(compiler): Refactor Topology (#754)
* Separate files

* Refactor `capturedTopologies`

* Refactor pathOn

* Refactor firstExecutesOn, lastExecutesOn

* Refactor resolve

* Extract debug print

* Refactor cata and resolve

* Refactor through

* Refactor pathAfterAndPingNext

* Refactor For.beginsOn
2023-06-19 17:10:25 +02:00
renovate[bot]
4acbf4dc7e
chore(deps): update dependency org.typelevel:cats-parse to v0.3.9 (#760)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-19 13:20:27 +03:00
Anatolios Laskaris
a70da08bdf
chore: Readd fluence-cli to e2e (#759)
* Readd fluence-cli

* Use main
2023-06-19 12:23:26 +03:00
fluencebot
4fcfaf9c7c
chore(main): release aqua 0.11.7 (#758)
* chore(main): release aqua 0.11.7

* chore: Bump aqua version to 0.11.7
2023-06-16 15:41:56 +03:00
InversionSpaces
e22fff7c8a
fix(compiler): Fix incorrect service method renaming [fixes LNG-199] (#757)
* Rename only arrows, not service calls

* Add tests

* Fix comment
2023-06-16 15:05:41 +03:00
fluencebot
c73a98b7a0
chore(main): release aqua 0.11.6 (#753)
* chore(main): release aqua 0.11.6

* chore: Bump aqua version to 0.11.6
2023-06-15 08:03:46 -06:00
Dima
889c50734b
fix: generate JS in Aqua API properly (#755)
fix aqua API for JS
2023-06-15 08:01:26 -06:00
InversionSpaces
017eca7056
fix(compiler): Fix SO in Topology [fixes LNG-149] (#752)
* Skip `next` in `for` topology resolution

* Add tests
2023-06-15 13:17:15 +02:00
Anatolios Laskaris
bae5eed08a
chore: Exclude aqua-api-example directory from renovate (#751)
Exclude aqua-api-example directory from renovate
2023-06-15 10:07:33 +03:00
fluencebot
6c7147212d
chore(main): release aqua 0.11.5 (#749) 2023-06-14 18:34:49 +03:00
InversionSpaces
d6e3ec725c
refactor(compiler): Remove ShadowRaw (#742) 2023-06-14 16:41:38 +03:00
InversionSpaces
f1abd587b7
fix(compiler): Fix closure passing [fixes LNG-92] (#747) 2023-06-14 16:09:50 +03:00
InversionSpaces
739854a20b
fix(parser): Fix compare ops parsing (#748)
* Fix order of compare ops parse

* Add tests
2023-06-14 12:52:30 +00:00
fluencebot
45c44b3046
chore(main): release aqua 0.11.4 (#743) 2023-06-13 14:08:12 +03:00
InversionSpaces
c5534a964c
fix(compiler): Fix closure call compilation [fixes LNG-193] (#741) 2023-06-13 12:56:17 +03:00
Dima
8c2240d3b1
fix(aqua-api): Compilation to js/ts for file without exports [LNG-196] (#744) 2023-06-13 11:04:50 +02:00
InversionSpaces
e9c004452e
feat(tracing): Introduce function calls tracing [fixes LNG-169] (#732)
* Introduced MetaModel.CallArrowModel

* Fixed ArrowInlinerSpec

* Implemented trace calls injection

* Propagate TracingConfig

* Add tracing flag to js api

* Use detach instead of xor

* Write tests

* ScalarType -> LiteralType

* Add tests

* Fix after rebase

* Fixed tests

* Add tests

* Remove debug prints

* Clean up and add comments

* Fix issues

* Add tracing flag to js api

* Rename liftString -> quote

* Change literal type

* Use CallServiceModel constructor

* Fix js args

* Fixed tests

* Add tracing option to cli
2023-06-12 15:28:27 +02:00
fluencebot
e2f67b3c0f
chore(main): release aqua 0.11.3 (#737)
* chore(main): release aqua 0.11.3

* chore: Bump aqua version to 0.11.3
2023-06-09 13:43:20 +02:00
Dima
5f5fc494b6
fix(aqua-api): Add default constants to Aqua API [LNG-194] (#738) 2023-06-09 10:59:41 +00:00
InversionSpaces
62b16426de
feat(devcontainer): Add js-client to devcontainer (#736)
Add js-client to devcontainer
2023-06-09 08:44:54 +00:00
fluencebot
7410765606
chore(main): release aqua 0.11.2 (#734) 2023-06-07 16:05:10 +03:00
Dima
0b66aa96ec
feat(aqua-api): return JS and TS sources from API [LNG-164] (#730) 2023-06-07 14:07:14 +02:00
Dima
21cb3937ac
fix(language-server): Go-to definition for path in use expression [LNG-187] (#733)
add tokens for `use` and `use-from` expressions to language server
2023-06-06 14:40:26 -06:00
renovate[bot]
da0821d9d5
chore(deps): update dependency typescript to v5.1.3 (#729)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-05 15:15:49 +03:00
renovate[bot]
f9112851b4
chore(deps): update dependency sbt/sbt to v1.9.0 (#728)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-05 15:00:03 +03:00
705 changed files with 45564 additions and 41034 deletions

View File

@ -1,52 +1,54 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
"name": "Compiler Codespace",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers-contrib/features/sbt-sdkman:2": {},
"ghcr.io/devcontainers-contrib/features/scala-sdkman:2": {},
"ghcr.io/devcontainers/features/node:1": {
"version": "16"
}
},
// TODO: Consider writing setup script
"postCreateCommand": "bash -i -c \"npm -g install @fluencelabs/cli@latest\"",
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Configure tool-specific properties.
"customizations": {
"codespaces": {
"repositories": {
"fluencelabs/docs": {
"permissions": "write-all"
},
"fluencelabs/aqua-vscode": {
"permissions": "write-all"
},
"fluencelabs/examples": {
"permissions": "write-all"
},
"fluencelabs/aqua-playground": {
"permissions": "write-all"
}
}
},
"vscode": {
"extensions": [
"FluenceLabs.aqua",
"scala-lang.scala",
"scalameta.metals",
"yzhang.markdown-all-in-one"
]
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
"name": "Compiler Codespace",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers-contrib/features/sbt-sdkman:2": {},
"ghcr.io/devcontainers-contrib/features/scala-sdkman:2": {},
"ghcr.io/devcontainers/features/node:1": {
"version": "16"
}
},
// TODO: Consider writing setup script
"postCreateCommand": "bash -i -c \"npm -g install @fluencelabs/cli@latest\"",
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Configure tool-specific properties.
"customizations": {
"codespaces": {
"repositories": {
"fluencelabs/docs": {
"permissions": "write-all"
},
"fluencelabs/aqua-vscode": {
"permissions": "write-all"
},
"fluencelabs/examples": {
"permissions": "write-all"
},
"fluencelabs/aqua-tests": {
"permissions": "write-all"
},
"fluencelabs/js-client": {
"permissions": "write-all"
},
"fluencelabs/js-client-examples": {
"permissions": "write-all"
}
}
},
"vscode": {
"extensions": [
"FluenceLabs.aqua",
"scala-lang.scala",
"scalameta.metals",
"yzhang.markdown-all-in-one"
]
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

140
.github/e2e/docker-compose.yml vendored Normal file
View File

@ -0,0 +1,140 @@
networks:
nox:
driver: bridge
ipam:
config:
- subnet: 10.50.10.0/24
services:
nox-1:
image: ${NOX_IMAGE}
ports:
- 7771:7771
- 9991:9991
command:
- --enable-system-services=none
- --aqua-pool-size=2
- -t=7771
- -w=9991
- -x=10.50.10.10
- --external-maddrs
- /dns4/nox-1/tcp/7771
- /dns4/nox-1/tcp/9991/ws
- --allow-private-ips
- --local
# - --bootstraps=/dns/nox-1/tcp/7771
# 12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR
- -k=hK62afickoeP2uZbmSkAYXxxqP8ozq16VRN7qfTP719EHC5V5tjrtW57BSjUr8GvsEXmJRbtejUWyPZ2rZMyQdq
networks:
nox:
ipv4_address: 10.50.10.10
nox-2:
image: ${NOX_IMAGE}
ports:
- 7772:7772
- 9992:9992
command:
- --enable-system-services=none
- --aqua-pool-size=2
- -t=7772
- -w=9992
- -x=10.50.10.20
- --external-maddrs
- /dns4/nox-2/tcp/7772
- /dns4/nox-2/tcp/9992/ws
- --allow-private-ips
- --bootstraps=/dns/nox-1/tcp/7771
# 12D3KooWQdpukY3p2DhDfUfDgphAqsGu5ZUrmQ4mcHSGrRag6gQK
- -k=2WijTVdhVRzyZamWjqPx4V4iNMrajegNMwNa2PmvPSZV6RRpo5M2fsPWdQr22HVRubuJhhSw8BrWiGt6FPhFAuXy
networks:
nox:
ipv4_address: 10.50.10.20
nox-3:
image: ${NOX_IMAGE}
ports:
- 7773:7773
- 9993:9993
command:
- --enable-system-services=none
- --aqua-pool-size=2
- -t=7773
- -w=9993
- -x=10.50.10.30
- --external-maddrs
- /dns4/nox-3/tcp/7773
- /dns4/nox-3/tcp/9993/ws
- --allow-private-ips
- --bootstraps=/dns/nox-1/tcp/7771
# 12D3KooWRT8V5awYdEZm6aAV9HWweCEbhWd7df4wehqHZXAB7yMZ
- -k=2n2wBVanBeu2GWtvKBdrYK9DJAocgG3PrTUXMharq6TTfxqTL4sLdXL9BF23n6rsnkAY5pR9vBtx2uWYDQAiZdrX
networks:
nox:
ipv4_address: 10.50.10.30
nox-4:
image: ${NOX_IMAGE}
ports:
- 7774:7774
- 9994:9994
command:
- --enable-system-services=none
- --aqua-pool-size=2
- -t=7774
- -w=9994
- -x=10.50.10.40
- --external-maddrs
- /dns4/nox-4/tcp/7774
- /dns4/nox-4/tcp/9994/ws
- --allow-private-ips
- --bootstraps=/dns/nox-1/tcp/7771
# 12D3KooWBzLSu9RL7wLP6oUowzCbkCj2AGBSXkHSJKuq4wwTfwof
- -k=4zp8ucAikkjB8CmkufYiFBW4QCDUCbQG7yMjviX7W8bMyN5rfChQ2Pi5QCWThrCTbAm9uq5nbFbxtFcNZq3De4dX
networks:
nox:
ipv4_address: 10.50.10.40
nox-5:
image: ${NOX_IMAGE}
ports:
- 7775:7775
- 9995:9995
command:
- --enable-system-services=none
- --aqua-pool-size=2
- -t=7775
- -w=9995
- -x=10.50.10.50
- --external-maddrs
- /dns4/nox-5/tcp/7775
- /dns4/nox-5/tcp/9995/ws
- --allow-private-ips
- --bootstraps=/dns/nox-1/tcp/7771
# 12D3KooWBf6hFgrnXwHkBnwPGMysP3b1NJe5HGtAWPYfwmQ2MBiU
- -k=3ry26rm5gkJXvdqRH4FoM3ezWq4xVVsBQF7wtKq4E4pbuaa6p1F84tNqifUS7DdfJL9hs2gcdW64Wc342vHZHMUp
networks:
nox:
ipv4_address: 10.50.10.50
nox-6:
image: ${NOX_IMAGE}
ports:
- 7776:7776
- 9996:9996
command:
- --enable-system-services=none
- --aqua-pool-size=2
- -t=7776
- -w=9996
- --bootstraps=/dns/nox-1/tcp/7771
- -x=10.50.10.60
- --external-maddrs
- /dns4/nox-6/tcp/7776
- /dns4/nox-6/tcp/9996/ws
- --allow-private-ips
# 12D3KooWPisGn7JhooWhggndz25WM7vQ2JmA121EV8jUDQ5xMovJ
- -k=5Qh8bB1sF28uLPwr3HTvEksCeC6mAWQvebCfcgv9y6j4qKwSzNKm2tzLUg4nACUEo2KZpBw11gNCnwaAdM7o1pEn
networks:
nox:
ipv4_address: 10.50.10.60

21
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,21 @@
## Description
[Provide a brief description of the changes introduced by this pull request and the motivation behind them.]
## Proposed Changes
[List the specific changes and additions introduced by this pull request.]
## Implementation Details
[Provide additional details about the implementation that may be helpful to reviewers.]
## Checklist
- [ ] Corresponding issue has been created and linked in PR title.
- [ ] Proposed changes are covered by tests.
- [ ] Documentation has been updated to reflect the changes (if applicable).
- [ ] I have self-reviewed my code and ensured its quality.
- [ ] I have added/updated necessary comments to aid understanding.
## Reviewer Checklist
- [ ] Tests have been reviewed and are sufficient to validate the changes.
- [ ] Documentation has been reviewed and is up to date.
- [ ] Any questions or concerns have been addressed.

View File

@ -1,3 +1,3 @@
{
".": "0.11.1"
".": "0.14.11"
}

36
.github/renovate.json vendored
View File

@ -1,36 +1,8 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
":semanticCommitTypeAll(chore)"
"github>fluencelabs/renovate",
"github>fluencelabs/renovate:npm"
],
"enabledManagers": ["sbt", "npm", "github-actions"],
"rangeStrategy": "pin",
"schedule": "every weekend",
"packageRules": [
{
"matchManagers": ["npm"],
"matchPackagePatterns": [
"@fluencelabs/.*"
],
"semanticCommitType": "fix",
"semanticCommitScope": "deps",
"schedule": "at any time"
},
{
"matchDepTypes": ["devDependencies"],
"prPriority": -1,
"semanticCommitType": "chore",
"semanticCommitScope": "deps"
},
{
"matchUpdateTypes": ["major"],
"prConcurrentLimit": 1
},
{
"matchManagers": ["github-actions"],
"groupName": "all github-actions",
"prPriority": -1
}
]
"ignorePaths": ["api/aqua-api-example/**"],
"enabledManagers": ["npm"]
}

View File

@ -1,65 +0,0 @@
name: "Publish binary aqua"
on:
workflow_dispatch:
inputs:
runs-on:
type: string
required: true
arch:
type: string
required: true
os:
type: string
required: true
static:
type: boolean
required: true
workflow_call:
inputs:
runs-on:
type: string
required: true
arch:
type: string
required: true
os:
type: string
required: true
static:
type: boolean
required: true
jobs:
build:
name: "Publish aqua-native"
runs-on: ${{ inputs.runs-on }}
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: graalvm/setup-graalvm@v1
with:
version: '22.3.1'
java-version: '17'
set-java-home: true
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: coursier/cache-action@v6
- uses: coursier/setup-action@v1
with:
apps: sbt
- name: build
run: sbt "cli/GraalVMNativeImage/packageBin"
env:
COMPILE_STATIC: ${{ inputs.static }}
- uses: actions/upload-artifact@v3
with:
name: aqua-${{ inputs.os }}-${{ inputs.arch }}
path: cli/cli/.jvm/target/graalvm-native-image/cli

View File

@ -27,6 +27,7 @@ concurrency:
jobs:
aqua:
name: "aqua"
if: >
github.event_name == 'push' ||
contains(github.event.pull_request.labels.*.name, 'e2e')
@ -34,38 +35,20 @@ jobs:
with:
ref: ${{ github.ref }}
aqua-playground:
fcli-snapshot:
name: "fcli"
needs: aqua
uses: fluencelabs/aqua-playground/.github/workflows/tests.yml@master
uses: fluencelabs/cli/.github/workflows/snapshot.yml@main
with:
aqua-version: "${{ needs.aqua.outputs.aqua-version }}"
aqua-snapshots: "${{ needs.aqua.outputs.aqua-snapshots }}"
registry:
fcli:
needs: aqua
uses: fluencelabs/registry/.github/workflows/tests.yml@main
uses: fluencelabs/cli/.github/workflows/tests.yml@main
with:
aqua-version: "${{ needs.aqua.outputs.aqua-version }}"
aqua-snapshots: "${{ needs.aqua.outputs.aqua-snapshots }}"
fluence-cli:
needs: aqua
uses: fluencelabs/fluence-cli/.github/workflows/tests.yml@main
with:
aqua-version: "${{ needs.aqua.outputs.aqua-version }}"
aqua-native:
name: "aqua"
strategy:
matrix:
runner:
- runs-on: ubuntu-latest
arch: amd64
os: linux
static: true
needs:
- aqua
uses: ./.github/workflows/binary.yml
with:
runs-on: ${{ matrix.runner.runs-on }}
arch: ${{ matrix.runner.arch }}
os: ${{ matrix.runner.os }}
static: ${{ matrix.runner.static }}
# registry:
# needs:
# - fcli-snapshot
# uses: fluencelabs/registry/.github/workflows/tests.yml@main

View File

@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Lint actions
uses: reviewdog/action-actionlint@v1

View File

@ -18,13 +18,17 @@ env:
FORCE_COLOR: true
jobs:
compile:
publish:
runs-on: builder
timeout-minutes: 60
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag }}
@ -36,60 +40,11 @@ jobs:
with:
apps: sbt
- name: JS CLI build
run: sbt cliJS/fullLinkJS
- name: JS API build
run: sbt aqua-api/fullLinkJS
- name: JS LSP build
run: sbt language-server-apiJS/fullLinkJS
- name: Upload aqua-cli artifact
uses: actions/upload-artifact@v3
with:
name: aqua-cli
path: cli/cli/.js/target/scala-*/cli-opt/main.js
- name: Upload aqua-api artifact
uses: actions/upload-artifact@v3
with:
name: aqua-api
path: api/aqua-api/target/scala-*/aqua-api-opt/main.js
- name: Upload aqua-lsp artifact
uses: actions/upload-artifact@v3
with:
name: aqua-lsp
path: language-server/language-server-api/.js/target/scala-*/language-server-api-opt/main.js
aqua-cli:
name: "Publish aqua-cli"
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- compile
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.tag }}
- name: Download aqua-cli artifact
uses: actions/download-artifact@v3
with:
name: aqua-cli
- run: mv scala-*/*/main.js cli/cli-npm/aqua.js
- name: scala-js build
run: sbt ";language-server-apiJS/fullBundleJS;aqua-apiJS/fullBundleJS"
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
uses: hashicorp/vault-action@v3.0.0
with:
url: https://vault.fluence.dev
path: jwt/github
@ -101,148 +56,20 @@ jobs:
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
uses: actions/setup-node@v3
- name: Setup pnpm
uses: pnpm/action-setup@v4.0.0
with:
node-version: "16"
version: 8
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v4
with:
node-version: "18"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "cli/cli-npm/package-lock.json"
cache: "npm"
cache: "pnpm"
- run: npm i
working-directory: cli/cli-npm
- run: npm run build
working-directory: cli/cli-npm
- run: pnpm --filter='!integration-tests' -r i
- run: pnpm --filter='!integration-tests' -r build
- name: Publish to NPM registry
run: npm publish --access public --tag unstable
working-directory: cli/cli-npm
aqua-api:
name: "Publish aqua-api"
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- compile
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.tag }}
- name: Download aqua-api artifact
uses: actions/download-artifact@v3
with:
name: aqua-api
- run: mv scala-*/*/main.js api/aqua-api-npm/aqua-api.js
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "api/aqua-api-npm/package-lock.json"
cache: "npm"
- run: npm i
working-directory: api/aqua-api-npm
- name: Publish to NPM registry
run: npm publish --access public --tag unstable
working-directory: api/aqua-api-npm
aqua-lsp:
name: "Publish aqua-lsp"
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- compile
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.tag }}
- name: Download aqua-lsp artifact
uses: actions/download-artifact@v3
with:
name: aqua-lsp
- run: mv scala-*/*/main.js language-server/language-server-npm/aqua-lsp-api.js
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "language-server/language-server-npm/package-lock.json"
cache: "npm"
- run: npm i
working-directory: language-server/language-server-npm
- name: Publish to NPM registry
run: npm publish --access public --tag unstable
working-directory: language-server/language-server-npm
aqua-native:
name: "Publish aqua-native"
strategy:
matrix:
runner:
- runs-on: ubuntu-latest
arch: amd64
os: linux
static: true
- runs-on: macos-latest
arch: amd64
os: macos
static: false
needs:
- compile
uses: ./.github/workflows/binary.yml
with:
runs-on: ${{ matrix.runner.runs-on }}
arch: ${{ matrix.runner.arch }}
os: ${{ matrix.runner.os }}
static: ${{ matrix.runner.static }}
run: pnpm --filter='!integration-tests' publish --access public --tag unstable

View File

@ -24,7 +24,7 @@ jobs:
steps:
- name: Run release-please
id: release
uses: google-github-actions/release-please-action@v3
uses: google-github-actions/release-please-action@v4
with:
token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }}
command: manifest
@ -47,9 +47,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}
token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }}
- name: Get aqua version
id: version
@ -61,20 +62,36 @@ jobs:
run: |
sed -i 's/aquaVersion =.*/aquaVersion = "${{ steps.version.outputs.version }}"/g' build.sbt
- name: Set cli version
run: npm version ${{ steps.version.outputs.version }}
working-directory: cli/cli-npm
- name: Setup pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 8
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v4
with:
node-version: "18"
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- name: Set api version
run: npm version ${{ steps.version.outputs.version }}
working-directory: api/aqua-api-npm
run: pnpm version ${{ steps.version.outputs.version }}
working-directory: api/api-npm
- name: Set lsp version
run: npm version ${{ steps.version.outputs.version }}
run: pnpm version ${{ steps.version.outputs.version }}
working-directory: language-server/language-server-npm
- name: Set aqua version in tests
run: |
pnpm add @fluencelabs/aqua-api@${{ steps.version.outputs.version }} --save-workspace-protocol=false
working-directory: integration-tests
- name: Regenerate lock
run: pnpm -r i
- name: Commit version bump
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: Bump aqua version to ${{ steps.version.outputs.version }}"
branch: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}
@ -116,7 +133,7 @@ jobs:
echo "found any?:" "${{ steps.status.outputs.found }}"
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
uses: hashicorp/vault-action@v3.0.0
with:
url: https://vault.fluence.dev
path: jwt/github

View File

@ -21,6 +21,12 @@ concurrency:
cancel-in-progress: true
jobs:
sbt-tests:
name: "aqua"
uses: ./.github/workflows/sbt-tests.yml
with:
ref: ${{ github.ref }}
tests:
name: "aqua"
uses: ./.github/workflows/tests.yml

32
.github/workflows/sbt-tests.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Run sbt tests with workflow_call
on:
workflow_call:
inputs:
ref:
description: "git ref to checkout to"
type: string
default: "main"
jobs:
tests:
name: "Run sbt tests"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: fluencelabs/aqua
ref: ${{ inputs.ref }}
- name: Cache Scala
uses: coursier/cache-action@v6
- name: Setup Scala
uses: coursier/setup-action@v1
with:
apps: sbt
- name: Run tests
run: env JAVA_OPTS="-Xmx4G" sbt "headerCheckAll; test"

View File

@ -3,37 +3,35 @@ name: Publish snapshots
on:
workflow_call:
inputs:
fluence-js-version:
description: "@fluencejs/fluence version"
type: string
default: "null"
ref:
description: "git ref to checkout to"
type: string
default: "main"
outputs:
aqua-version:
description: "@fluencelabs/aqua version"
value: ${{ jobs.aqua-cli.outputs.version }}
aqua-lsp-version:
description: "@fluencelabs/aqua-language-server-api version"
value: ${{ jobs.aqua-lsp.outputs.version }}
aqua-api-version:
description: "@fluencelabs/aqua-api version"
value: ${{ jobs.aqua-api.outputs.version }}
aqua-snapshots:
description: "aqua snapshots"
value: ${{ jobs.publish.outputs.snapshots }}
env:
FORCE_COLOR: true
CI: true
jobs:
compile:
name: "Compile"
publish:
name: "Publish snapshots"
runs-on: builder
timeout-minutes: 60
permissions:
contents: read
id-token: write
outputs:
snapshots: "${{ steps.snapshot.outputs.snapshots }}"
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: fluencelabs/aqua
ref: ${{ inputs.ref }}
@ -50,69 +48,13 @@ jobs:
with:
apps: sbt
- name: JS CLI build
- name: scala-js build
env:
SNAPSHOT: ${{ steps.version.outputs.id }}
run: sbt cliJS/fastOptJS
- name: JS LSP build
env:
SNAPSHOT: ${{ steps.version.outputs.id }}
run: sbt language-server-apiJS/fastOptJS
- name: JS API build
env:
SNAPSHOT: ${{ steps.version.outputs.id }}
run: sbt aqua-api/fastOptJS
- name: Upload aqua-cli artifact
uses: actions/upload-artifact@v3
with:
name: aqua-cli
path: cli/cli/.js/target/scala-*/cli-fastopt.js
- name: Upload aqua-api artifact
uses: actions/upload-artifact@v3
with:
name: aqua-api
path: api/aqua-api/target/scala-*/aqua-api-fastopt.js
- name: Upload aqua-lsp artifact
uses: actions/upload-artifact@v3
with:
name: aqua-lsp
path: language-server/language-server-api/.js/target/scala-*/language-server-api-fastopt.js
aqua-cli:
name: "Publish aqua-cli"
runs-on: ubuntu-latest
timeout-minutes: 60
needs: compile
outputs:
version: "${{ steps.snapshot.outputs.version }}"
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: fluencelabs/aqua
ref: ${{ inputs.ref }}
- name: Download aqua-cli artifact
uses: actions/download-artifact@v3
with:
name: aqua-cli
- run: mv scala-*/cli-fastopt.js cli/cli-npm/aqua.js
run: sbt ";language-server-apiJS/fastBundleJS;aqua-apiJS/fastBundleJS"
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
uses: hashicorp/vault-action@v3.0.0
with:
url: https://vault.fluence.dev
path: jwt/github
@ -124,163 +66,28 @@ jobs:
secrets: |
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v3
- name: Setup pnpm
uses: pnpm/action-setup@v4.0.0
with:
node-version: "16"
version: 8
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v4
with:
node-version: "18"
registry-url: "https://npm.fluence.dev"
cache-dependency-path: "cli/cli-npm/package-lock.json"
cache: "npm"
cache: "pnpm"
- run: npm i
working-directory: cli/cli-npm
- run: pnpm --filter='!integration-tests' -r i
- name: Set fluence-js version from branch
if: inputs.fluence-js-version != 'null'
working-directory: cli/cli-npm
run: npm i --save -E @fluencelabs/fluence@${{ inputs.fluence-js-version }}
- name: Set package version
run: node ci.cjs bump-version ${{ steps.version.outputs.id }}
- run: npm run build
working-directory: cli/cli-npm
- name: Generate snapshot version
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main
- run: pnpm --filter='!integration-tests' -r build
- name: Publish snapshot
id: snapshot
uses: fluencelabs/github-actions/npm-publish-snapshot@main
uses: fluencelabs/github-actions/pnpm-publish-snapshot@main
with:
working-directory: cli/cli-npm
id: ${{ steps.version.outputs.id }}
aqua-api:
name: "Publish aqua-api"
runs-on: ubuntu-latest
timeout-minutes: 60
needs: compile
outputs:
version: "${{ steps.snapshot.outputs.version }}"
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: fluencelabs/aqua
ref: ${{ inputs.ref }}
- name: Download aqua-api artifact
uses: actions/download-artifact@v3
with:
name: aqua-api
- run: mv scala-*/aqua-api-fastopt.js api/aqua-api-npm/aqua-api.js
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://npm.fluence.dev"
cache-dependency-path: "api/aqua-api-npm/package-lock.json"
cache: "npm"
- run: npm i
working-directory: api/aqua-api-npm
- name: Set fluence-js version from branch
if: inputs.fluence-js-version != 'null'
working-directory: cli/cli-npm
run: npm i --save-dev -E @fluencelabs/fluence@${{ inputs.fluence-js-version }}
- name: Generate snapshot version
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main
- name: Publish snapshot
id: snapshot
uses: fluencelabs/github-actions/npm-publish-snapshot@main
with:
working-directory: api/aqua-api-npm
id: ${{ steps.version.outputs.id }}
aqua-lsp:
name: "Publish aqua-lsp"
runs-on: ubuntu-latest
timeout-minutes: 60
needs: compile
outputs:
version: "${{ steps.snapshot.outputs.version }}"
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: fluencelabs/aqua
ref: ${{ inputs.ref }}
- name: Download aqua-lsp artifact
uses: actions/download-artifact@v3
with:
name: aqua-lsp
- run: mv scala-*/language-server-api-fastopt.js language-server/language-server-npm/aqua-lsp-api.js
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://npm.fluence.dev"
cache-dependency-path: "language-server/language-server-npm/package-lock.json"
cache: "npm"
- run: npm i
working-directory: language-server/language-server-npm
- name: Generate snapshot version
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main
- name: Publish snapshot
id: snapshot
uses: fluencelabs/github-actions/npm-publish-snapshot@main
with:
working-directory: language-server/language-server-npm
id: ${{ steps.version.outputs.id }}
set-version: false

View File

@ -7,19 +7,72 @@ on:
description: "git ref to checkout to"
type: string
default: "main"
fluence-env:
description: "Fluence enviroment to run tests agains"
type: string
default: "local"
nox-image:
description: "nox image tag"
type: string
default: "fluencelabs/nox:unstable"
js-client-snapshots:
description: "js-client snapshots"
type: string
default: "null"
env:
FORCE_COLOR: true
NOX_IMAGE: "${{ inputs.nox-image }}"
FLUENCE_ENV: "${{ inputs.fluence-env }}"
jobs:
tests:
name: "Run sbt tests"
aqua:
name: "Run tests"
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Import secrets
uses: hashicorp/vault-action@v3.0.0
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
secrets: |
kv/docker-registry/basicauth/ci username | DOCKER_USERNAME ;
kv/docker-registry/basicauth/ci password | DOCKER_PASSWORD ;
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN;
kv/slack/node-alerts webhook | INCOMING_WEBHOOK_URL
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: docker.fluence.dev
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Checkout
uses: actions/checkout@v4
with:
repository: fluencelabs/aqua
ref: ${{ inputs.ref }}
- name: Pull nox image
run: docker pull $NOX_IMAGE
- name: Run nox
uses: isbang/compose-action@v2.0.0
with:
compose-file: ".github/e2e/docker-compose.yml"
down-flags: "--volumes"
- name: Cache Scala
uses: coursier/cache-action@v6
@ -28,5 +81,40 @@ jobs:
with:
apps: sbt
- name: Run tests
run: sbt test
- name: aqua-api build
run: sbt "aqua-apiJS/fastBundleJS"
- name: Setup pnpm
uses: pnpm/action-setup@v4.0.0
with:
version: 8
- name: Setup node with self-hosted registry
uses: actions/setup-node@v4
with:
node-version: "18"
registry-url: "https://npm.fluence.dev"
cache: "pnpm"
- name: Override dependencies
if: inputs.js-client-snapshots != 'null'
uses: fluencelabs/github-actions/pnpm-set-dependency@main
with:
dependencies: |
{
"@fluencelabs/js-client": "${{ fromJson(inputs.js-client-snapshots)['js-client'] }}"
}
- run: pnpm install --no-frozen-lockfile
working-directory: integration-tests
- name: Compile aqua
run: pnpm run compile-aqua
working-directory: integration-tests
- run: pnpm run test
working-directory: integration-tests
- name: Dump nox logs
if: always()
uses: jwalton/gh-docker-logs@v2

7
.gitignore vendored
View File

@ -9,5 +9,10 @@ project/target
.DS_Store
npm/aqua.js
language-server/language-server-npm/aqua-lsp-api.js
api/api-npm/aqua-api.js
integration-tests/src/compiled/*
**/dist
**/node_modules

View File

@ -62,9 +62,9 @@ runner {
}
}
rewrite {
rules = [
SortImports
]
}
rewrite.rules = [Imports]
rewrite.imports.sort = ascii
rewrite.imports.groups = [
["aqua\\..*"]
]
#runner.dialect = scala3

View File

@ -1,5 +1,428 @@
# Changelog
## [0.14.11](https://github.com/fluencelabs/aqua/compare/aqua-v0.14.10...aqua-v0.14.11) (2024-07-03)
### Features
* **compiler:** Add feature to insert map from a function result with correct type [LNG-367] ([#1159](https://github.com/fluencelabs/aqua/issues/1159)) ([4d49279](https://github.com/fluencelabs/aqua/commit/4d49279569b5cfbdf351e9236dd508d9bf51badc))
* **compiler:** Allow renaming imports with qualified names [LNG-361] ([#1136](https://github.com/fluencelabs/aqua/issues/1136)) ([1c76f75](https://github.com/fluencelabs/aqua/commit/1c76f75d80ae958a7eb2bf2aec5c58a5b92c438f))
### Bug Fixes
* **compiler:** Push to stream in closures [LNG-365] ([#1157](https://github.com/fluencelabs/aqua/issues/1157)) ([77b7b9b](https://github.com/fluencelabs/aqua/commit/77b7b9b4bd4e8964b6ceb681750fda27766c16b2))
## [0.14.10](https://github.com/fluencelabs/aqua/compare/aqua-v0.14.9...aqua-v0.14.10) (2024-06-07)
### Features
* **api, lsp:** Case classes exported to JS as normal JSONs ([#1151](https://github.com/fluencelabs/aqua/issues/1151)) ([037532f](https://github.com/fluencelabs/aqua/commit/037532fb858c9ef98ea536e72cc9f71e73a2cfc3))
## [0.14.9](https://github.com/fluencelabs/aqua/compare/aqua-v0.14.8...aqua-v0.14.9) (2024-06-06)
### Features
* **compiler:** CRDT-maps implementation ([#1142](https://github.com/fluencelabs/aqua/issues/1142)) ([934c20c](https://github.com/fluencelabs/aqua/commit/934c20c98a6296f12543d49fe3f438a6dcecbfaf))
## [0.14.8](https://github.com/fluencelabs/aqua/compare/aqua-v0.14.7...aqua-v0.14.8) (2024-05-29)
### Features
* **compiler:** Add extension to imports on preparing import tokens ([7468f6f](https://github.com/fluencelabs/aqua/commit/7468f6fd18a68eadfe1f94b98c19b1be9f38eee8))
## [0.14.7](https://github.com/fluencelabs/aqua/compare/aqua-v0.14.6...aqua-v0.14.7) (2024-05-14)
### Features
* **compiler:** Allow redeclaring functions [LNG-357] ([#1127](https://github.com/fluencelabs/aqua/issues/1127)) ([9c23a9d](https://github.com/fluencelabs/aqua/commit/9c23a9d4efea1b9467057645b6d31b7a0e3df95e))
* **compiler:** Allow redeclaring services (and abilities) [LNG-360] ([#1135](https://github.com/fluencelabs/aqua/issues/1135)) ([faf5b80](https://github.com/fluencelabs/aqua/commit/faf5b8071fc3e272e64355130a99cee9f2cc0f8d))
### Bug Fixes
* **lsp:** Go-to-definition for used types (LNG-345) ([#1128](https://github.com/fluencelabs/aqua/issues/1128)) ([35db82c](https://github.com/fluencelabs/aqua/commit/35db82c7676bbe2ff2b48d08dc604cfe7dd14b7f))
* **lsp:** Plugin throws OOM on big projects ([#1134](https://github.com/fluencelabs/aqua/issues/1134)) ([6cc068a](https://github.com/fluencelabs/aqua/commit/6cc068ac36a6af2a96a793278c8f721c8165b67d))
## [0.14.6](https://github.com/fluencelabs/aqua/compare/aqua-v0.14.5...aqua-v0.14.6) (2024-04-18)
### Bug Fixes
* Allow spaces after aqua header ([#1112](https://github.com/fluencelabs/aqua/issues/1112)) ([9dc9e55](https://github.com/fluencelabs/aqua/commit/9dc9e5597301d327c157780bbc2f58dda89a5e54))
* **compiler:** Ordering in option inliner [LNG-351] ([#1114](https://github.com/fluencelabs/aqua/issues/1114)) ([49729ac](https://github.com/fluencelabs/aqua/commit/49729ac40aba56d303e42fc8023170ae8b5f7fd8))
* **compiler:** Redeclare imports [LNG-344] ([#1109](https://github.com/fluencelabs/aqua/issues/1109)) ([8f06ac1](https://github.com/fluencelabs/aqua/commit/8f06ac1cba7f4ce8588c1df1befd6bb99d957f2a))
* **compiler:** Refactor header semantics [LNG-352] ([#1113](https://github.com/fluencelabs/aqua/issues/1113)) ([f29e44e](https://github.com/fluencelabs/aqua/commit/f29e44e52acd3d6519cd36feadf22414b328a6f0))
* **compiler:** Return error if SemanticError occures [LNG-356] ([#1126](https://github.com/fluencelabs/aqua/issues/1126)) ([e6c5d00](https://github.com/fluencelabs/aqua/commit/e6c5d0039f1556c9adafa1714ae048a25f252d29))
* **deps:** update dependency @fluencelabs/fluence-network-environment to v1.2.0 ([#1110](https://github.com/fluencelabs/aqua/issues/1110)) ([1ef0daf](https://github.com/fluencelabs/aqua/commit/1ef0dafe2eae21313311317cd6571d200d4a7739))
* **deps:** update dependency @fluencelabs/fluence-network-environment to v1.2.1 ([#1115](https://github.com/fluencelabs/aqua/issues/1115)) ([331d497](https://github.com/fluencelabs/aqua/commit/331d497eb5baee156a1aa09ea699e461d2d9b9c5))
* **lsp:** Fix go-to-definition for abilities as arguments in functions [LNG-343] ([#1116](https://github.com/fluencelabs/aqua/issues/1116)) ([07bea1a](https://github.com/fluencelabs/aqua/commit/07bea1a909d9d66b6eb4a32cb99a990458c3f77e))
## [0.14.5](https://github.com/fluencelabs/aqua/compare/aqua-v0.14.4...aqua-v0.14.5) (2024-03-28)
### Features
* **compiler:** Reimplement `noXor` compiler flag [LNG-347] ([#1096](https://github.com/fluencelabs/aqua/issues/1096)) ([5c7f6a8](https://github.com/fluencelabs/aqua/commit/5c7f6a89c60a199a73e7002481b9578c63ffce32))
### Bug Fixes
* **ci:** disable system services in Nox ([#1100](https://github.com/fluencelabs/aqua/issues/1100)) ([92d0450](https://github.com/fluencelabs/aqua/commit/92d04504819f75e93ac555fd8d28a02b5893d817))
* **compiler:** Create restrictions in inliner [LNG-346] ([#1099](https://github.com/fluencelabs/aqua/issues/1099)) ([14748c7](https://github.com/fluencelabs/aqua/commit/14748c7646dad9970058c298f8c919a04e54dfb7))
* **deps:** update dependency @fluencelabs/js-client to v0.9.0 ([#1088](https://github.com/fluencelabs/aqua/issues/1088)) ([6aa78ee](https://github.com/fluencelabs/aqua/commit/6aa78eeb6fae3ca7e2060ba962496b502ae54592))
## [0.14.4](https://github.com/fluencelabs/aqua/compare/aqua-v0.14.3...aqua-v0.14.4) (2024-02-29)
### Bug Fixes
* **compiler:** Bug in renaming [LNG-346] ([#1094](https://github.com/fluencelabs/aqua/issues/1094)) ([d7fef3d](https://github.com/fluencelabs/aqua/commit/d7fef3db5fda6c2dfeacac84c3cff2188538a35a))
* **compiler:** Import abilities with `use` [LNG-324] ([#1077](https://github.com/fluencelabs/aqua/issues/1077)) ([a6c8e75](https://github.com/fluencelabs/aqua/commit/a6c8e75c270efd358908f285310f1f1d177a65fb))
## [0.14.3](https://github.com/fluencelabs/aqua/compare/aqua-v0.14.2...aqua-v0.14.3) (2024-02-29)
### Bug Fixes
* **compiler:** Change `noEmptyResponse` default to `true` ([#1093](https://github.com/fluencelabs/aqua/issues/1093)) ([23aba18](https://github.com/fluencelabs/aqua/commit/23aba18c7d7fb86acd2470474f776f00a78ee9c6))
* **language-server:** Name clashing in LSP [LNG-342] ([#1089](https://github.com/fluencelabs/aqua/issues/1089)) ([3e9d385](https://github.com/fluencelabs/aqua/commit/3e9d3856685f74a6be5d0aa288cd7e4f95010901))
## [0.14.2](https://github.com/fluencelabs/aqua/compare/aqua-v0.14.1...aqua-v0.14.2) (2024-02-21)
### Bug Fixes
* **compiler:** Recursively find abilities [LNG-338] ([#1086](https://github.com/fluencelabs/aqua/issues/1086)) ([b22762c](https://github.com/fluencelabs/aqua/commit/b22762ca6d6ed443a930780c928c7b72ae6a50f6))
## [0.14.1](https://github.com/fluencelabs/aqua/compare/aqua-v0.14.0...aqua-v0.14.1) (2024-02-20)
### Features
* **language-server:** Add types for types in LSP API ([#1078](https://github.com/fluencelabs/aqua/issues/1078)) ([3cd31c5](https://github.com/fluencelabs/aqua/commit/3cd31c5827dfc8208a5cbed0722e3ddeabc7e31f))
* **language-server:** Resolve paths for imports ([#1079](https://github.com/fluencelabs/aqua/issues/1079)) ([245f664](https://github.com/fluencelabs/aqua/commit/245f6640f8f45b92338bb3bb20fbf2d73540b053))
* **language-server:** Support declares and exports in LSP [LNG-304, LNG-319] ([#1070](https://github.com/fluencelabs/aqua/issues/1070)) ([f7194f0](https://github.com/fluencelabs/aqua/commit/f7194f0a54f51b0cc8aa0b4a2b295ec027be8a63))
### Bug Fixes
* **compiler:** Use `strict` to check types availability [LNG-334] ([#1071](https://github.com/fluencelabs/aqua/issues/1071)) ([17fb77c](https://github.com/fluencelabs/aqua/commit/17fb77c40f14b6a1c9b773d58e719d3476fe5414))
* **deps:** update dependency @fluencelabs/js-client to v0.8.0 ([#1063](https://github.com/fluencelabs/aqua/issues/1063)) ([a8ae49b](https://github.com/fluencelabs/aqua/commit/a8ae49b55b86876ac3f961eb6e0b95f062466f70))
* **deps:** update dependency @fluencelabs/js-client to v0.8.1 ([#1065](https://github.com/fluencelabs/aqua/issues/1065)) ([d03211b](https://github.com/fluencelabs/aqua/commit/d03211b492725f37d5e76ffc55861f5161094aae))
* **deps:** update dependency @fluencelabs/js-client to v0.8.3 ([#1072](https://github.com/fluencelabs/aqua/issues/1072)) ([f4cc781](https://github.com/fluencelabs/aqua/commit/f4cc7818f4c9ba5b23ceaf771504bf697e767350))
## [0.14.0](https://github.com/fluencelabs/aqua/compare/aqua-v0.13.4...aqua-v0.14.0) (2024-01-30)
### ⚠ BREAKING CHANGES
* **compiler:** Force `aqua` header [LNG-308] ([#1028](https://github.com/fluencelabs/aqua/issues/1028))
### Features
* **compiler:** Force `aqua` header [LNG-308] ([#1028](https://github.com/fluencelabs/aqua/issues/1028)) ([d057a5e](https://github.com/fluencelabs/aqua/commit/d057a5e69583872f93cdb4d1220d62fe9dfdea50))
### Bug Fixes
* **compiler:** Streams in closures generates wrong AIR ([#1055](https://github.com/fluencelabs/aqua/issues/1055)) ([1a0b3a2](https://github.com/fluencelabs/aqua/commit/1a0b3a22c1ccfd07f884d04ba442899b84f1d7e2))
* **deps:** update dependency @fluencelabs/js-client to v0.6.0 ([#1050](https://github.com/fluencelabs/aqua/issues/1050)) ([f94f383](https://github.com/fluencelabs/aqua/commit/f94f38327a6c9d31ee54f44e35568aa23c8b4597))
* **deps:** update dependency @fluencelabs/js-client to v0.7.0 ([#1056](https://github.com/fluencelabs/aqua/issues/1056)) ([11f8d3b](https://github.com/fluencelabs/aqua/commit/11f8d3b11b17d682602750133d620b827cc926cf))
### Performance Improvements
* **compiler:** Inliner optimization [LNG-322] ([#1047](https://github.com/fluencelabs/aqua/issues/1047)) ([abcb63d](https://github.com/fluencelabs/aqua/commit/abcb63db3b1acbe68dd49539016b807071b24a4c))
* **compiler:** Optimize `Linker` [LNG-321] ([#1049](https://github.com/fluencelabs/aqua/issues/1049)) ([7b6c724](https://github.com/fluencelabs/aqua/commit/7b6c7245ecbce719027fffd97709b5648e15ed92))
## [0.13.4](https://github.com/fluencelabs/aqua/compare/aqua-v0.13.3...aqua-v0.13.4) (2024-01-11)
### Features
* **compiler:** `for ... rec` [LNG-307] ([#1026](https://github.com/fluencelabs/aqua/issues/1026)) ([ae32f80](https://github.com/fluencelabs/aqua/commit/ae32f8027729bfd463cddc57f857c307e1e3c709))
* **compiler:** Enhance message of type error [LNG-313] ([#1033](https://github.com/fluencelabs/aqua/issues/1033)) ([d5cd77b](https://github.com/fluencelabs/aqua/commit/d5cd77bb865433fdff46fefb48875bf8f5e585dc))
### Bug Fixes
* **compiler:** Add outside context to closures [LNG-317] ([#1038](https://github.com/fluencelabs/aqua/issues/1038)) ([85f3ecd](https://github.com/fluencelabs/aqua/commit/85f3ecdf3985c8bd3a4c68fb827968b79516f9b3))
* **compiler:** Passing closures with abilities [LNG-314] ([#1035](https://github.com/fluencelabs/aqua/issues/1035)) ([5241f52](https://github.com/fluencelabs/aqua/commit/5241f522d8bc58649f4048aada034e3cbe320eb7))
* **compiler:** Type check arrow calls on services and abilities [LNG-315] ([#1037](https://github.com/fluencelabs/aqua/issues/1037)) ([d46ee03](https://github.com/fluencelabs/aqua/commit/d46ee0347fee94055a6690a4d4b8d0e1cf29430c))
## [0.13.3](https://github.com/fluencelabs/aqua/compare/aqua-v0.13.2...aqua-v0.13.3) (2023-12-22)
### Features
* **api:** Refactor js api interfaces ([#1024](https://github.com/fluencelabs/aqua/issues/1024)) ([33a2ca8](https://github.com/fluencelabs/aqua/commit/33a2ca87e00eab7075772cce4a8c012c6a137167))
* **lsp-api:** Fix interface definition [LNG-298] ([#1027](https://github.com/fluencelabs/aqua/issues/1027)) ([5bc01a9](https://github.com/fluencelabs/aqua/commit/5bc01a9c02252add86c018fa90703cda287d1338))
### Bug Fixes
* **compiler:** Do not generate hop back with empty response by default [LNG-305] ([#1019](https://github.com/fluencelabs/aqua/issues/1019)) ([a4d8ee7](https://github.com/fluencelabs/aqua/commit/a4d8ee7083dcd050858602422986a28d6aaa9420))
* **deps:** update dependency @fluencelabs/js-client to v0.5.5 ([#1020](https://github.com/fluencelabs/aqua/issues/1020)) ([851a66f](https://github.com/fluencelabs/aqua/commit/851a66fb5fde5c448f8262fd0df8dbf15cc13d8a))
## [0.13.2](https://github.com/fluencelabs/aqua/compare/aqua-v0.13.1...aqua-v0.13.2) (2023-12-14)
### Features
* **api:** Accept structured imports [LNG-288] ([#989](https://github.com/fluencelabs/aqua/issues/989)) ([f7bfa83](https://github.com/fluencelabs/aqua/commit/f7bfa8317bb07e0dacf64343bb777c9ea8ff81b7))
### Bug Fixes
* **tests:** Lower tests size ([#1018](https://github.com/fluencelabs/aqua/issues/1018)) ([6732f8f](https://github.com/fluencelabs/aqua/commit/6732f8f2ccb5cfd371065f041b9ced5cca0d79e5))
## [0.13.1](https://github.com/fluencelabs/aqua/compare/aqua-v0.13.0...aqua-v0.13.1) (2023-12-07)
### Features
* **language-server:** Pass token types to LSP [LNG-285] ([#999](https://github.com/fluencelabs/aqua/issues/999)) ([74d02e1](https://github.com/fluencelabs/aqua/commit/74d02e1f63766ffc0f849f3d6e262030bc0deab8))
### Bug Fixes
* **compiler:** Allow returning resolved service as ability [LNG-266] ([#977](https://github.com/fluencelabs/aqua/issues/977)) ([2d4b2ae](https://github.com/fluencelabs/aqua/commit/2d4b2aece471f1879fd7e84d23b2a2ad593dac69))
* **compiler:** Use correct empty stream as argument [LNG-280, LNG-292] ([#967](https://github.com/fluencelabs/aqua/issues/967)) ([4cecab1](https://github.com/fluencelabs/aqua/commit/4cecab1a260103b57e7b0f8f1ddcc402ce189fac))
* **deps:** update dependency @fluencelabs/js-client to v0.5.3 ([#978](https://github.com/fluencelabs/aqua/issues/978)) ([9d0fb2b](https://github.com/fluencelabs/aqua/commit/9d0fb2b84124912bdcb4bc38aae6b6c1cd5d59f7))
* **e2e:** Use `main` branch for `fcli` ([#987](https://github.com/fluencelabs/aqua/issues/987)) ([b24fcf6](https://github.com/fluencelabs/aqua/commit/b24fcf686f326c2702edf6a7dfbc45ad1df9562d))
* **tests:** Fix imports in integration tests ([#998](https://github.com/fluencelabs/aqua/issues/998)) ([e65836e](https://github.com/fluencelabs/aqua/commit/e65836e3c869009786b7f7722879752d2176e04e))
## [0.13.0](https://github.com/fluencelabs/aqua/compare/aqua-v0.12.4...aqua-v0.13.0) (2023-11-22)
### ⚠ BREAKING CHANGES
* **compiler:** Make `nil` option bottom [LNG-279] ([#968](https://github.com/fluencelabs/aqua/issues/968))
* **compiler:** Prohibit mutating options [LNG-277] ([#960](https://github.com/fluencelabs/aqua/issues/960))
### Features
* **api:** Use `js.UndefOr` for `defaultServiceId` ([#980](https://github.com/fluencelabs/aqua/issues/980)) ([1e525fa](https://github.com/fluencelabs/aqua/commit/1e525fad35585c5401914200e8e15c50304d8688))
* **compiler:** Allow omitting field name in struct creation [LNG-261] ([#943](https://github.com/fluencelabs/aqua/issues/943)) ([fcdb5b0](https://github.com/fluencelabs/aqua/commit/fcdb5b0fefeffc004a50bd66a6a768b36ed9d71d))
* **compiler:** Always generate `last` argument of `fold` [LNG-265] ([#947](https://github.com/fluencelabs/aqua/issues/947)) ([78ee753](https://github.com/fluencelabs/aqua/commit/78ee753c7b3e956faf5c92f4992e51c1af4ac76a))
* **compiler:** Generate empty calls to `responseHandlerSrv` [LNG-286] ([#979](https://github.com/fluencelabs/aqua/issues/979)) ([cee4448](https://github.com/fluencelabs/aqua/commit/cee444862a7cf2bea3f84e921b03328fd83fa108))
* **compiler:** Make `nil` option bottom [LNG-279] ([#968](https://github.com/fluencelabs/aqua/issues/968)) ([11c8970](https://github.com/fluencelabs/aqua/commit/11c8970fd889a3acb07c0c65013d153194106e62))
* **compiler:** Prohibit mutating options [LNG-277] ([#960](https://github.com/fluencelabs/aqua/issues/960)) ([68425ed](https://github.com/fluencelabs/aqua/commit/68425ed42a7440aefac82011bbac418ef13bd636))
### Bug Fixes
* **compiler:** Code generate wrong stream name in AIR [LNG-276] ([#958](https://github.com/fluencelabs/aqua/issues/958)) ([a1576ef](https://github.com/fluencelabs/aqua/commit/a1576efad9d6a3d5fb20c01182b0d0a948c50ec4))
* **compiler:** Incorrect focus on error [LNG-274] ([#959](https://github.com/fluencelabs/aqua/issues/959)) ([6e6b567](https://github.com/fluencelabs/aqua/commit/6e6b567f8eac007b0e50fc6e2eb4e4918663016e))
* **compiler:** Multiple closures in one function [LNG-262] ([#941](https://github.com/fluencelabs/aqua/issues/941)) ([45ca7bb](https://github.com/fluencelabs/aqua/commit/45ca7bbf3ed234b25d0f010c2bd5878f9bce9155))
* **compiler:** Throw an error when comparing an alias and a named type with the same name [LNG-231] ([#946](https://github.com/fluencelabs/aqua/issues/946)) ([38f7728](https://github.com/fluencelabs/aqua/commit/38f77285f57410848a5f6f3333ca6a99fb5017f5))
* **compiler:** Unknown service method call is ignored [LNG-273] ([#957](https://github.com/fluencelabs/aqua/issues/957)) ([5a3c5e6](https://github.com/fluencelabs/aqua/commit/5a3c5e6666f53ac222e297e69971e3d84499759f))
* **deps:** update dependency @fluencelabs/js-client to v0.4.1 ([#945](https://github.com/fluencelabs/aqua/issues/945)) ([634b1c1](https://github.com/fluencelabs/aqua/commit/634b1c17b629b6f899bfe5ff17a9bdc81673acba))
* **deps:** update dependency @fluencelabs/js-client to v0.4.2 ([#956](https://github.com/fluencelabs/aqua/issues/956)) ([077dc8f](https://github.com/fluencelabs/aqua/commit/077dc8ff131cb1c4cc6300b078232c1be93c39cd))
* **deps:** update dependency @fluencelabs/js-client to v0.4.3 ([#966](https://github.com/fluencelabs/aqua/issues/966)) ([313502e](https://github.com/fluencelabs/aqua/commit/313502ecae4f0568af63158e6f518bc8e398953d))
## [0.12.4](https://github.com/fluencelabs/aqua/compare/aqua-v0.12.3...aqua-v0.12.4) (2023-10-23)
### Features
* **compiler:** Handle error function exit in tracing mode [LNG-250] ([#921](https://github.com/fluencelabs/aqua/issues/921)) ([03d23eb](https://github.com/fluencelabs/aqua/commit/03d23eb577d72a3cf592254259aeb9b52b33b616))
* **compiler:** Optimize math in compile time [LNG-245] ([#922](https://github.com/fluencelabs/aqua/issues/922)) ([5f6c47f](https://github.com/fluencelabs/aqua/commit/5f6c47ffea5ab6e32df918a33414482129b00fd7))
* **dev:** Add PR template ([#934](https://github.com/fluencelabs/aqua/issues/934)) ([679d43f](https://github.com/fluencelabs/aqua/commit/679d43f7eb079071ca2a4174f3b8cf5e83d4e16d))
### Bug Fixes
* **compiler:** Fix gate inlining [LNG-253] ([#924](https://github.com/fluencelabs/aqua/issues/924)) ([b298eeb](https://github.com/fluencelabs/aqua/commit/b298eebf5ea1b4c091603ebf0cacde0957191632))
* **compiler:** Fix topology for adjacent `on`s [LNG-257] ([#929](https://github.com/fluencelabs/aqua/issues/929)) ([ba15d9e](https://github.com/fluencelabs/aqua/commit/ba15d9e06afc38f79c95e00d48efbf8937cd251d))
* **compiler:** fix typo ([#916](https://github.com/fluencelabs/aqua/issues/916)) ([feb7a16](https://github.com/fluencelabs/aqua/commit/feb7a167a2007d2c1d75dac6554f36d2cf5f86a5))
* **compiler:** Passed function is not handled correctly [LNG-260] ([#940](https://github.com/fluencelabs/aqua/issues/940)) ([c83d69e](https://github.com/fluencelabs/aqua/commit/c83d69e6895d3784f02c743b89f65606c6302f4b))
* **compiler:** Return ability arrow [LNG-258] ([#935](https://github.com/fluencelabs/aqua/issues/935)) ([fab46ee](https://github.com/fluencelabs/aqua/commit/fab46ee130d4e6b3edd33d0fab4c0f2d27ce5ad0))
* **deps:** update dependency @fluencelabs/js-client to v0.2.1 ([#930](https://github.com/fluencelabs/aqua/issues/930)) ([14f3d92](https://github.com/fluencelabs/aqua/commit/14f3d92ef4cd3fed12cbff0164706b2cbbfdcccd))
* **deps:** update dependency @fluencelabs/js-client to v0.3.0 ([#936](https://github.com/fluencelabs/aqua/issues/936)) ([441c012](https://github.com/fluencelabs/aqua/commit/441c012e01e6e0eff1e1e950b86241982658e80a))
## [0.12.3](https://github.com/fluencelabs/aqua/compare/aqua-v0.12.2...aqua-v0.12.3) (2023-09-28)
### Features
* **compiler:** Make `if` propagate errors [fixes LNG-202] ([#779](https://github.com/fluencelabs/aqua/issues/779)) ([ca6cae9](https://github.com/fluencelabs/aqua/commit/ca6cae96ad27f07fe2e6c05ee1caa16153c0c991))
* **compiler:** Replace `%last_error%` with `:error:` [fixes LNG-239] ([#883](https://github.com/fluencelabs/aqua/issues/883)) ([a80033b](https://github.com/fluencelabs/aqua/commit/a80033b81cb7f58f9bfe8665205b864c5438306e))
* Create structs with stream maps [fixes LNG-244] ([#893](https://github.com/fluencelabs/aqua/issues/893)) ([878990a](https://github.com/fluencelabs/aqua/commit/878990a8370718b64bd26663d7813a972e7cdd49))
* **lsp-api:** Add `infoType` ([#915](https://github.com/fluencelabs/aqua/issues/915)) ([1e636cc](https://github.com/fluencelabs/aqua/commit/1e636cc076f5ba4b0487e60fe312ff873d5c19ae))
* **tests:** Add integration test for result error handling ([#914](https://github.com/fluencelabs/aqua/issues/914)) ([b2ca1d3](https://github.com/fluencelabs/aqua/commit/b2ca1d35bf1f6420cea673e092a9f357c6e3a742))
### Bug Fixes
* **compiler:** Handle errors from result handling [fixes LNG-247] ([#913](https://github.com/fluencelabs/aqua/issues/913)) ([f158074](https://github.com/fluencelabs/aqua/commit/f158074c4ecb7d02236786a809c7c387bbb65d3b))
## [0.12.2](https://github.com/fluencelabs/aqua/compare/aqua-v0.12.1...aqua-v0.12.2) (2023-09-25)
### Features
* **aqua-api:** Use scala.js link instead of opt ([#891](https://github.com/fluencelabs/aqua/issues/891)) ([3f916c7](https://github.com/fluencelabs/aqua/commit/3f916c78ab3aa6e50d47929bf28b846bf5537868))
* **build:** Implement custom bundle task ([#894](https://github.com/fluencelabs/aqua/issues/894)) ([67d8151](https://github.com/fluencelabs/aqua/commit/67d8151d9432971b5375794bb15394eeea94132e))
* **compiler:** Add warnings subsystem [fixes LNG117] ([#906](https://github.com/fluencelabs/aqua/issues/906)) ([27a781d](https://github.com/fluencelabs/aqua/commit/27a781dd3f161728c111e5fe834389da69f82d8f))
* **compiler:** Fail on internal error [fixes LNG-229] ([#905](https://github.com/fluencelabs/aqua/issues/905)) ([8741c91](https://github.com/fluencelabs/aqua/commit/8741c910bed18420cf69fd3bf0496b01148e4cf5))
* **compiler:** Services as abilities [fixes LNG-206] ([#873](https://github.com/fluencelabs/aqua/issues/873)) ([6be2a3d](https://github.com/fluencelabs/aqua/commit/6be2a3d5da83c426761819908c0a3c3fd8dc4bf0))
* export types from aqua-api ([#904](https://github.com/fluencelabs/aqua/issues/904)) ([594f465](https://github.com/fluencelabs/aqua/commit/594f46529d7476f8f2345e9deaa43938d7d52a47))
* **language-server:** Pass errors to lsp context [fixes LNG-243] ([#888](https://github.com/fluencelabs/aqua/issues/888)) ([f8b5017](https://github.com/fluencelabs/aqua/commit/f8b5017918a1ec076ccc1593cca70e9e71276b36))
* rethrow errors to capture stacktrace ([#907](https://github.com/fluencelabs/aqua/issues/907)) ([66638af](https://github.com/fluencelabs/aqua/commit/66638afa2d6ad6ca2fba1492c94b2c80fd397e39))
### Bug Fixes
* **compiler:** Do not restrict stream args when ability is present [fixes LNG-233] ([#902](https://github.com/fluencelabs/aqua/issues/902)) ([54ddcc8](https://github.com/fluencelabs/aqua/commit/54ddcc8b6271b1aed4b427dcc74360a0cb212eb4))
* **compiler:** Fix arrows capture in closures [fixes LNG-242] ([#903](https://github.com/fluencelabs/aqua/issues/903)) ([ed9e708](https://github.com/fluencelabs/aqua/commit/ed9e708939d9a689b51ebd0e2ab89a8c92a07b05))
* **deps:** update dependency @fluencelabs/js-client to v0.1.4 ([#887](https://github.com/fluencelabs/aqua/issues/887)) ([d6f879e](https://github.com/fluencelabs/aqua/commit/d6f879ef7ab7e1a8dfadc12b573cf1e51e06d9c9))
* **deps:** update dependency @fluencelabs/js-client to v0.1.6 ([#890](https://github.com/fluencelabs/aqua/issues/890)) ([fb75bc2](https://github.com/fluencelabs/aqua/commit/fb75bc267e9b2cb0c7dbeac389b73ee33b273a11))
* **deps:** update dependency @fluencelabs/js-client to v0.1.7 ([#908](https://github.com/fluencelabs/aqua/issues/908)) ([1c708c8](https://github.com/fluencelabs/aqua/commit/1c708c8bb03a9c7c749b814d412097498c833b36))
## [0.12.1](https://github.com/fluencelabs/aqua/compare/aqua-v0.12.0...aqua-v0.12.1) (2023-09-11)
### Bug Fixes
* **compiler:** Error on not arrow call after `&lt;-` ([#876](https://github.com/fluencelabs/aqua/issues/876)) ([69a808e](https://github.com/fluencelabs/aqua/commit/69a808e24307b5fe312a6dfdc6041c310c33d96d))
* **compiler:** Fix closure stream capture [fixes LNG-58] ([#857](https://github.com/fluencelabs/aqua/issues/857)) ([443e65e](https://github.com/fluencelabs/aqua/commit/443e65e3d8bca4774f5bdb6db5e526c5f2201c89))
* **deps:** update dependency @fluencelabs/aqua-lib to v0.7.3 ([#882](https://github.com/fluencelabs/aqua/issues/882)) ([3419607](https://github.com/fluencelabs/aqua/commit/3419607e8ccd3d280d5d168d6ffb9cb9380d32a8))
* **deps:** update dependency @fluencelabs/js-client to v0.1.1 ([#865](https://github.com/fluencelabs/aqua/issues/865)) ([1f23545](https://github.com/fluencelabs/aqua/commit/1f23545b49db2e3bb387ef9d961cac53bb75d127))
* **deps:** update dependency @fluencelabs/js-client to v0.1.3 ([#875](https://github.com/fluencelabs/aqua/issues/875)) ([df111ad](https://github.com/fluencelabs/aqua/commit/df111adf21c1abe5fbbed7264734927a3f048ffc))
## [0.12.0](https://github.com/fluencelabs/aqua/compare/aqua-v0.11.11...aqua-v0.12.0) (2023-08-25)
### ⚠ BREAKING CHANGES
* **js-client:** Move to new js-client interface ([#855](https://github.com/fluencelabs/aqua/issues/855))
### Features
* **compiler:** Restrict abilities usage [fixes LNG-208] ([#854](https://github.com/fluencelabs/aqua/issues/854)) ([2a0b207](https://github.com/fluencelabs/aqua/commit/2a0b20763396fea0ada5e14c01372dd3923b424b))
* **js-client:** Move to new js-client interface ([#855](https://github.com/fluencelabs/aqua/issues/855)) ([0f9ede0](https://github.com/fluencelabs/aqua/commit/0f9ede09fb849915b20f87fddb95ee2514421a19))
### Bug Fixes
* **compiler:** Fix nested abilities [fixes LNG-220] ([#852](https://github.com/fluencelabs/aqua/issues/852)) ([bf0b51f](https://github.com/fluencelabs/aqua/commit/bf0b51fa5bca3be96cab028eaec48aa5805b1f73))
## [0.11.11](https://github.com/fluencelabs/aqua/compare/aqua-v0.11.10...aqua-v0.11.11) (2023-08-21)
### Features
* **compiler:** Structural typing for data and abilities [fixes LNG-215] ([#843](https://github.com/fluencelabs/aqua/issues/843)) ([019611a](https://github.com/fluencelabs/aqua/commit/019611a89c31618985303d4984ed581eadad11f5))
* parseq implementation (fixes LNG-223) ([#840](https://github.com/fluencelabs/aqua/issues/840)) ([8060695](https://github.com/fluencelabs/aqua/commit/8060695dbb0a2f34febf739eb20db8b8781b3682))
### Bug Fixes
* **compiler:** Generate stream restriction for scoped exprs [fixes LNG-222] ([#841](https://github.com/fluencelabs/aqua/issues/841)) ([eb4cdb0](https://github.com/fluencelabs/aqua/commit/eb4cdb0dd12987e64881bab6ff19f935e905672e))
* **compiler:** Refactor values [fixes LNG-57] ([#821](https://github.com/fluencelabs/aqua/issues/821)) ([f562bd4](https://github.com/fluencelabs/aqua/commit/f562bd40b6df5bbfce5635c10710d91f21e3af88))
* Fix release build command ([#834](https://github.com/fluencelabs/aqua/issues/834)) ([6146f8e](https://github.com/fluencelabs/aqua/commit/6146f8e40a59c9fecd9f40b76e6ec6398b05ca05))
## [0.11.9](https://github.com/fluencelabs/aqua/compare/aqua-v0.11.8...aqua-v0.11.9) (2023-08-09)
### Features
* **compiler:** Add boolean algebra [fixes LNG-211] ([#814](https://github.com/fluencelabs/aqua/issues/814)) ([a5b6102](https://github.com/fluencelabs/aqua/commit/a5b610242260538ff38d62dc21b97a694d0776e3))
* **compiler:** Add equality ops [fixes LNG-217] ([#820](https://github.com/fluencelabs/aqua/issues/820)) ([a5e9354](https://github.com/fluencelabs/aqua/commit/a5e9354aebe9291e9fc0b1d29e74972bfaa254e2))
* **compiler:** Restrict exporting functions that return arrow types or ability types [fixes LNG-209] ([#815](https://github.com/fluencelabs/aqua/issues/815)) ([fabf8d7](https://github.com/fluencelabs/aqua/commit/fabf8d7d61ec8d70bf8e17e581c3c7371c4e6d78))
* wrap aqua api ([#807](https://github.com/fluencelabs/aqua/issues/807)) ([c7fca40](https://github.com/fluencelabs/aqua/commit/c7fca40f670a4b5a51ab4ce188f69f550d4bf6d6))
### Bug Fixes
* **compiler:** Fix `if` with brackets parsing ([#812](https://github.com/fluencelabs/aqua/issues/812)) ([4c3c32b](https://github.com/fluencelabs/aqua/commit/4c3c32b7c400e87f962dc9827892a9224765e2a4))
* **compiler:** Fix math ops for `u64` [fixes LNG-204] ([#811](https://github.com/fluencelabs/aqua/issues/811)) ([50ba194](https://github.com/fluencelabs/aqua/commit/50ba194b8610b60bcaefee401cadacb369246f79))
* **compiler:** Nested abilities [fixes LNG-214] ([#816](https://github.com/fluencelabs/aqua/issues/816)) ([4e3e70f](https://github.com/fluencelabs/aqua/commit/4e3e70f4fc855a16238c4f84bd4f6a1102890904))
* **compiler:** Runtime error on compilation exported functions with top types [fixes LNG-218] ([#822](https://github.com/fluencelabs/aqua/issues/822)) ([ef4b014](https://github.com/fluencelabs/aqua/commit/ef4b0143ac7cd4e1a5997d6a0f1f690ab806a315))
## [0.11.8](https://github.com/fluencelabs/aqua/compare/aqua-v0.11.7...aqua-v0.11.8) (2023-07-20)
### Features
* **compiler:** Abilities ([#731](https://github.com/fluencelabs/aqua/issues/731)) ([63a9f42](https://github.com/fluencelabs/aqua/commit/63a9f42e86d29b741fa31135b4111bc0f38f238f))
* **compiler:** Find and display link cycles ([#787](https://github.com/fluencelabs/aqua/issues/787)) ([667a825](https://github.com/fluencelabs/aqua/commit/667a8255d994b334dfc87bd89a970855748752fe))
* **compiler:** Make `on` propagate errors [fixes LNG-203] ([#788](https://github.com/fluencelabs/aqua/issues/788)) ([b8b0faf](https://github.com/fluencelabs/aqua/commit/b8b0fafda0d27607ffc693e52c0dae81d23ec503))
* **compiler:** Make topology hop with non-FFI snippet [fixes LNG-125] ([#764](https://github.com/fluencelabs/aqua/issues/764)) ([c1fe24b](https://github.com/fluencelabs/aqua/commit/c1fe24b04d8a2f711ed7b316e7ae9a4f12732421))
### Bug Fixes
* **ci:** use unstable nox image ([#780](https://github.com/fluencelabs/aqua/issues/780)) ([22f380a](https://github.com/fluencelabs/aqua/commit/22f380a49162d8d79cccad266b17116d9f9c7795))
* **compiler:** Fix search for one element cycles ([#797](https://github.com/fluencelabs/aqua/issues/797)) ([33ab33d](https://github.com/fluencelabs/aqua/commit/33ab33d4c8f34743202e5acbfb2e976ab3070299))
* **deps:** update dependency @fluencelabs/fluence-network-environment to v1.1.2 ([#786](https://github.com/fluencelabs/aqua/issues/786)) ([ca52e25](https://github.com/fluencelabs/aqua/commit/ca52e2542cc031c748c6f8c8372aff717e9c709f))
## [0.11.7](https://github.com/fluencelabs/aqua/compare/aqua-v0.11.6...aqua-v0.11.7) (2023-06-16)
### Bug Fixes
* **compiler:** Fix incorrect service method renaming [fixes LNG-199] ([#757](https://github.com/fluencelabs/aqua/issues/757)) ([e22fff7](https://github.com/fluencelabs/aqua/commit/e22fff7c8ac3b30baacd4088d96386e73985fd54))
## [0.11.6](https://github.com/fluencelabs/aqua/compare/aqua-v0.11.5...aqua-v0.11.6) (2023-06-15)
### Bug Fixes
* **compiler:** Fix SO in Topology [fixes LNG-149] ([#752](https://github.com/fluencelabs/aqua/issues/752)) ([017eca7](https://github.com/fluencelabs/aqua/commit/017eca70563d82488d6072d0db508253d984e9b2))
* generate JS in Aqua API properly ([#755](https://github.com/fluencelabs/aqua/issues/755)) ([889c507](https://github.com/fluencelabs/aqua/commit/889c50734b56327b39d3d78903d25450bad27fa7))
## [0.11.5](https://github.com/fluencelabs/aqua/compare/aqua-v0.11.4...aqua-v0.11.5) (2023-06-14)
### Bug Fixes
* **compiler:** Fix closure passing [fixes LNG-92] ([#747](https://github.com/fluencelabs/aqua/issues/747)) ([f1abd58](https://github.com/fluencelabs/aqua/commit/f1abd587b761c23b1e27f22bfd8b21ada03a4c5d))
* **parser:** Fix compare ops parsing ([#748](https://github.com/fluencelabs/aqua/issues/748)) ([739854a](https://github.com/fluencelabs/aqua/commit/739854a20b73c7d3cd5eec28f5a7f3ae12691987))
## [0.11.4](https://github.com/fluencelabs/aqua/compare/aqua-v0.11.3...aqua-v0.11.4) (2023-06-13)
### Features
* **tracing:** Introduce function calls tracing [fixes LNG-169] ([#732](https://github.com/fluencelabs/aqua/issues/732)) ([e9c0044](https://github.com/fluencelabs/aqua/commit/e9c004452e48a22dfff2ddd64f1d98797ac6db84))
### Bug Fixes
* **aqua-api:** Compilation to js/ts for file without exports [LNG-196] ([#744](https://github.com/fluencelabs/aqua/issues/744)) ([8c2240d](https://github.com/fluencelabs/aqua/commit/8c2240d3b16e6f3f968d393aeb1136ffffc9464c))
* **compiler:** Fix closure call compilation [fixes LNG-193] ([#741](https://github.com/fluencelabs/aqua/issues/741)) ([c5534a9](https://github.com/fluencelabs/aqua/commit/c5534a964c21d48bd944e9c62e144cbbbd58625f))
## [0.11.3](https://github.com/fluencelabs/aqua/compare/aqua-v0.11.2...aqua-v0.11.3) (2023-06-09)
### Features
* **devcontainer:** Add js-client to devcontainer ([#736](https://github.com/fluencelabs/aqua/issues/736)) ([62b1642](https://github.com/fluencelabs/aqua/commit/62b16426deabaaadf51ee9cc673da11983535492))
### Bug Fixes
* **aqua-api:** Add default constants to Aqua API [LNG-194] ([#738](https://github.com/fluencelabs/aqua/issues/738)) ([5f5fc49](https://github.com/fluencelabs/aqua/commit/5f5fc494b66f649b440fd332edf8adcd39beb8e8))
## [0.11.2](https://github.com/fluencelabs/aqua/compare/aqua-v0.11.1...aqua-v0.11.2) (2023-06-07)
### Features
* **aqua-api:** return JS and TS sources from API [LNG-164] ([#730](https://github.com/fluencelabs/aqua/issues/730)) ([0b66aa9](https://github.com/fluencelabs/aqua/commit/0b66aa96ece2ce3b1ed44ff1e183e0289b5af2d9))
### Bug Fixes
* **language-server:** Go-to definition for path in `use` expression [LNG-187] ([#733](https://github.com/fluencelabs/aqua/issues/733)) ([21cb393](https://github.com/fluencelabs/aqua/commit/21cb3937acadca8d245b540aac301b130969ac0b))
## [0.11.1](https://github.com/fluencelabs/aqua/compare/aqua-v0.11.0...aqua-v0.11.1) (2023-06-01)

View File

@ -10,4 +10,4 @@ Things you need to know:
### Contributor License Agreement
When you contribute, you have to be aware that your contribution is covered by **[Apache License 2.0](./LICENSE)**, but might relicensed under few other software licenses mentioned in the **Contributor License Agreement**. In particular, you need to agree to the Contributor License Agreement. If you agree to its content, you simply have to click on the link posted by the CLA assistant as a comment to the pull request. Click it to check the CLA, then accept it on the following screen if you agree to it. The CLA assistant will save this decision for upcoming contributions and will notify you if there is any change to the CLA in the meantime.
When you contribute, you have to be aware that your contribution is covered by **[AGPLv3](./LICENSE)**, but might relicensed under few other software licenses mentioned in the **Contributor License Agreement**. In particular, you need to agree to the Contributor License Agreement. If you agree to its content, you simply have to click on the link posted by the CLA assistant as a comment to the pull request. Click it to check the CLA, then accept it on the following screen if you agree to it. The CLA assistant will save this decision for upcoming contributions and will notify you if there is any change to the CLA in the meantime.

View File

@ -1,40 +0,0 @@
# Installation of Aqua
The easiest way to use Aqua is to download the latest build from npm: [@fluencelabs/aqua](https://www.npmjs.com/package/@fluencelabs/aqua).
```bash
npm i -g @fluencelabs/aqua
aqua --input src/aqua --output src/generated
```
Input directory should contain files with `.aqua` scripts.
Other ways of building Aqua can be found in [INSTALL.md](./INSTALL.md).
## Build from sources
If you want to build Aqua compiler from the sourcecode, you need [Scala](https://www.scala-lang.org/)'s `sbt` installed.
Aqua compiler itself can be compiled to and distributed either as JavaScript or Java file.
### Build to JS
Run `sbt cliJS/fullLinkOpt` to build JavaScript file. You can find the compiled file in: `cli/.js/target/scala-%scala-version%/cli-opt`.
Then run it with `node`:
```bash
node aqua-%version_number%.js -i path/to/input/dir -o path/to/output/dir
```
Javascript build is the default for Aqua.
### Build to JVM
Run `sbt cli/assembly` to build JAR file. It is located in `cli/.jvm/target/scala-%scala-version%/`
It requires `java` to run Aqua compiler in `.jar` file from the command line:
```bash
java -jar aqua-%version_number%.jar -i path/to/input/dir -o path/to/output/dir
```

798
LICENSE
View File

@ -1,201 +1,661 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
1. Definitions.
Preamble
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
The precise terms and conditions for copying, distribution and
modification follow.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
TERMS AND CONDITIONS
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
0. Definitions.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
"This License" refers to version 3 of the GNU Affero General Public License.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
A "covered work" means either the unmodified Program or a work based
on the Program.
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
1. Source Code.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
END OF TERMS AND CONDITIONS
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
APPENDIX: How to apply the Apache License to your work.
The Corresponding Source for a work in source code form is that
same work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
2. Basic Permissions.
Copyright [yyyy] [name of copyright owner]
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
http://www.apache.org/licenses/LICENSE-2.0
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.

View File

@ -1,23 +1,16 @@
# Aqua
[![release](https://github.com/fluencelabs/aqua/actions/workflows/release.yml/badge.svg)](https://github.com/fluencelabs/aqua/actions/workflows/release.yml)
[![npm](https://img.shields.io/npm/v/@fluencelabs/aqua)](https://www.npmjs.com/package/@fluencelabs/aqua)
[![npm](https://img.shields.io/npm/v/@fluencelabs/aqua-api)](https://www.npmjs.com/package/@fluencelabs/aqua-api)
[Aqua](https://fluence.dev/docs/aqua-book/introduction) is an open-source language for distributed workflow coordination in p2p networks. Aqua programs are executed on many peers, sequentially or in parallel, forming a single-use coordination network. Applications are turned into hostless workflows over distributed function calls, which enables various levels of decentralization: from handling by a limited set of servers to complete peer-to-peer architecture by connecting user devices directly. Aqua is the core of the [Fluence](https://fluence.network/) protocol and a framework for internet or private cloud applications.
## Installation and Usage
## Usage
The easiest way to use Aqua is to download the latest build from npm: [@fluencelabs/aqua](https://www.npmjs.com/package/@fluencelabs/aqua).
The easiest way to use Aqua is through [Fluence CLI](https://github.com/fluencelabs/cli) with [aqua command](https://github.com/fluencelabs/cli/blob/main/docs/commands/README.md#fluence-aqua).
```bash
npm i -g @fluencelabs/aqua
aqua --input src/aqua --output src/generated
```
Input directory should contain files with `.aqua` scripts.
Other ways of installing Aqua can be found in [INSTALL.md](./INSTALL.md).
Other ways of using Aqua are described in [USAGE.md](./USAGE.md).
## Documentation
@ -28,16 +21,13 @@ Comprehensive documentation and usage examples as well as a number of videos can
## Repository Structure
- [**api**](./api) - Aqua API for JS
- [aqua-api](./api/aqua-api) - Scala sources
- [aqua-api-npm](./api/aqua-api-npm) - JS project
- [aqua-api-example](./api/aqua-api-example) - usage example
- [api](./api/api) - Scala sources
- [api-npm](./api/api-npm) - JS project
- [api-example](./api/api-example) - usage example
- [**aqua-run**](./aqua-run) - Aqua API to run functions
- [**backend**](./backend) - compilation backend interface
- [backend/air](./backend/air) - generates AIR code from the middle-end model
- [backend/ts](./backend/ts) - generates AIR code and TypeScript wrappers for use with [Fluence JS]( https://github.com/fluencelabs/fluence-js) SDK
- [**cli**](./cli) - CLI interface
- [cli](./cli/cli) - Scala sources
- [cli-npm](./cli/cli-npm) - JS project
- [**compiler**](./compiler) - compiler as a pure function made from _linker_, _semantics_ and _backend_
- [**model**](./model) - middle-end, internal representation of the code, optimizations and transformations
- [transform](./model/transform) - optimizations and transformations, converting model to the result, ready to be rendered
@ -60,5 +50,5 @@ Any interested person is welcome to contribute to the project. Please, make sure
## License
All software code is copyright (c) Fluence Labs, Inc. under the [Apache-2.0](./LICENSE) license.
All software code is copyright (c) Fluence Labs, Inc. under the [AGPLv3](./LICENSE) license.

28
USAGE.md Normal file
View File

@ -0,0 +1,28 @@
# Usage of Aqua
## Fluence CLI
The easiest way to use Aqua is through [Fluence CLI](https://github.com/fluencelabs/cli) with [aqua command](https://github.com/fluencelabs/cli/blob/main/docs/commands/README.md#fluence-aqua).
## JS API
You can use Aqua compiler API directly from JS code by installing [`@fluencelabs/aqua-api` package](https://www.npmjs.com/package/@fluencelabs/aqua-api). See an example usage in [api/api-example](./api/api-example).
## Build from sources
If you want to build Aqua compiler API from the source code, you need [Scala](https://www.scala-lang.org/)'s [`sbt`](https://www.scala-sbt.org/) installed.
### Build to JS package
Javascript build is the default for Aqua compiler API.
Run `sbt "aqua-apiJS/fullBundleJS"`. It will generate JS package in `api/api-npm` directory.
### Build to JVM library
Building Aqua compiler API as JVM lib is technically possible, but is not supported.

36
api/api-example/index.js Normal file
View File

@ -0,0 +1,36 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//@ts-check
import { compileAquaCallFromPath } from '@fluencelabs/aqua-api'
// compile call
const compilationResult = await compileAquaCallFromPath({
filePath: 'test.aqua',
data: { num: 3 },
funcCall: 'getNumber(num)',
})
const {
errors,
functionCall: { funcDef, script },
functions,
generatedSources,
services,
} = compilationResult
console.log(script)

View File

@ -8,8 +8,8 @@
},
"author": "Fluence Labs",
"type": "module",
"license": "Apache-2.0",
"license": "AGPL-3.0",
"dependencies": {
"@fluencelabs/aqua-api": "0.10.4"
"@fluencelabs/aqua-api": "workspace:*"
}
}

3
api/api-npm/README.md Normal file
View File

@ -0,0 +1,3 @@
# Aqua API
[Documentation](https://fluence.dev/docs/aqua-book/aqua-js-api)

145
api/api-npm/index.d.ts vendored Normal file
View File

@ -0,0 +1,145 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { ServiceDef, FunctionCallDef } from "@fluencelabs/interfaces";
export declare class AquaFunction {
funcDef: FunctionCallDef;
script: string;
}
export declare class GeneratedSource {
name: string;
tsSource?: string;
jsSource?: string;
tsTypes?: string;
}
export declare class CompilationResult {
services: Record<string, ServiceDef>;
functions: Record<string, AquaFunction>;
errors: string[];
warnings: string[];
generatedSources: GeneratedSource[];
}
/**
* Imports configuration for the compiler.
* Structure:
* {
* "<compiled-path-prefix-1>": {
* "<import-path-prefix-1>": ["<import-path-1>", "<import-path-2>"],
* "<import-path-prefix-2>": "<import-path-3>",
* ...
* }
* ...
* }
* Import `import` written in file with path `path`
* is resolved as follows:
* 1. Try to resolve `import` as relative import from `path`
* 2. If relative resolution failed:
* a. Find **the longest** <compiled-path-prefix>
* that is a prefix of `path` in the imports configuration
* b. In obtained map, find **the longest** <import-path-prefix>
* that is a prefix of `import`
* c. Replace prefix in `import` with <import-path>
* d. Try to resolve import with obtained path
* (try a few paths if array was provided)
*
* WARNING: <compiled-path-prefix> in 2.a is compared with
* absolute normalized path of `path`, so <compiled-path-prefix>
* should be absolute normalized path as well
* NOTE: <import-path-prefix> could be empty string,
* in which case it will match any import
* NOTE: passing just an array of strings is a shorthand for
* {
* "/": {
* "": <array>
* }
* }
*/
type Imports = Record<string, Record<string, string[] | string>> | string[];
/** Common arguments for all compile functions */
type CommonArgs = {
/** Imports */
imports?: Imports | undefined;
/** Constants to be passed to the compiler. Example: ["CONSTANT1=1", "CONSTANT2=2"] */
constants?: string[] | undefined;
/** Set log level for the compiler. Must be one of: Must be one of: all, trace, debug, info, warn, error, off. Default: info */
logLevel?: string | undefined;
/** Do not generate a pass through the relay node. Default: false */
noRelay?: boolean | undefined;
/** Do not generate a wrapper that catches and displays errors. Default: false */
noXor?: boolean | undefined;
/** Target type for the compiler. Must be one of: ts, js, air. Default: air */
targetType?: "ts" | "js" | "air" | undefined;
/** Compile aqua in tracing mode (for debugging purposes). Default: false */
tracing?: boolean | undefined;
/** Do not generate response call if there are no returned values */
noEmptyResponse?: boolean | undefined;
};
type CodeString = {
/** Aqua code to be compiled */
code: string;
};
export type CompileFromStringArgs = CommonArgs & CodeString;
/** Compile aqua code from a string */
export declare function compileFromString(
args: CompileFromStringArgs,
): Promise<CompilationResult>;
type FilePath = {
/** Path to the aqua file to be compiled */
filePath: string;
};
export type CompileFromPathArgs = CommonArgs & FilePath;
/** Compile aqua code from a file */
export declare function compileFromPath(
args: CompileFromPathArgs,
): Promise<CompilationResult>;
type FuncCall = {
/** Function call you want to compile. Example: someFunc("someArg") */
funcCall: string;
/** Args to be passed to the function (record with keys named as args you want to pass to the function) Example: { someArg: 1 } */
data?: Record<string, unknown> | undefined;
};
export type CallCompilationResult = CompilationResult & {
functionCall: AquaFunction;
};
export type CompileFuncCallFromStringArgs = CommonArgs & CodeString & FuncCall;
/** Compile aqua function call from a string */
export declare function compileAquaCallFromString(
args: CompileFuncCallFromStringArgs,
): Promise<CallCompilationResult>;
export type CompileFuncCallFromPathArgs = CommonArgs & FilePath & FuncCall;
/** Compile aqua function call from a file */
export declare function compileAquaCallFromPath(
args: CompileFuncCallFromPathArgs,
): Promise<CallCompilationResult>;
export {};

129
api/api-npm/index.js Normal file
View File

@ -0,0 +1,129 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { AquaConfig, Aqua, Call, Input, Path } from "./aqua-api.js";
function getConfig({
constants = [],
logLevel = "info",
noRelay = false,
noXor = false,
targetType = "air",
tracing = false,
noEmptyResponse = true,
}) {
return new AquaConfig(
logLevel,
constants,
noXor,
noRelay,
{
ts: "typescript",
js: "javascript",
air: "air",
}[targetType],
tracing,
noEmptyResponse,
);
}
function normalizeImports(imports) {
if (imports === undefined || imports === null) {
return {}; // No imports
}
if (Array.isArray(imports)) {
return {
"/": {
"": imports,
},
};
}
// Transform each inner string into an array
return Object.fromEntries(
Object.entries(imports).map(([pathPrefix, info]) => [
pathPrefix,
Object.fromEntries(
Object.entries(info).map(([importPrefix, locations]) => [
importPrefix,
Array.isArray(locations) ? locations : [locations],
]),
),
]),
);
}
async function compile(...args) {
try {
const res = await Aqua.compile(...args);
return res;
} catch (error) {
if (
typeof error === "object" &&
error !== null &&
"message" in error &&
typeof error.message === "string"
) {
throw new Error(error.message);
}
throw error;
}
}
export function compileFromString({ code, imports = [], ...commonArgs }) {
return compile(
new Input(code),
normalizeImports(imports),
getConfig(commonArgs),
);
}
export function compileFromPath({ filePath, imports = [], ...commonArgs }) {
return compile(
new Path(filePath),
normalizeImports(imports),
getConfig(commonArgs),
);
}
export function compileAquaCallFromString({
code,
funcCall,
data,
imports = [],
...commonArgs
}) {
return compile(
new Call(funcCall, data, new Input(code)),
normalizeImports(imports),
getConfig(commonArgs),
);
}
export function compileAquaCallFromPath({
filePath,
funcCall,
data,
imports = [],
...commonArgs
}) {
return compile(
new Call(funcCall, data, new Input(filePath)),
normalizeImports(imports),
getConfig(commonArgs),
);
}

17
api/api-npm/meta-utils.js Normal file
View File

@ -0,0 +1,17 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const metaUrl = ""

View File

@ -1,17 +1,16 @@
{
"name": "@fluencelabs/aqua-api",
"version": "0.11.1",
"version": "0.14.11",
"description": "Aqua API",
"type": "commonjs",
"type": "module",
"main": "index.js",
"files": [
"index.js",
"index.d.ts",
"aqua-api.js",
"aqua-api.d.ts",
"meta-utils.js"
],
"scripts": {
"move:scalajs": "cp ../aqua-api/target/scala-3.1.3/aqua-api-opt/main.js ./aqua-api.js",
"move:fast": "cp ../aqua-api/target/scala-3.1.3/aqua-api-fastopt/main.js ./aqua-api.js"
},
"prettier": {},
"repository": {
"type": "git",
"url": "git+https://github.com/fluencelabs/aqua.git"
@ -21,12 +20,13 @@
"fluence"
],
"author": "Fluence Labs",
"license": "Apache-2.0",
"license": "AGPL-3.0",
"bugs": {
"url": "https://github.com/fluencelabs/aqua/issues"
},
"homepage": "https://github.com/fluencelabs/aqua#readme",
"devDependencies": {
"@fluencelabs/fluence": "0.28.0"
"@fluencelabs/interfaces": "0.12.0",
"prettier": "3.3.0"
}
}

View File

@ -0,0 +1,252 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package api
import aqua.Rendering.given
import aqua.SpanParser
import aqua.api.TargetType.*
import aqua.api.{APICompilation, APIResult, AquaAPIConfig, Imports}
import aqua.backend.air.AirBackend
import aqua.backend.api.APIBackend
import aqua.backend.js.JavaScriptBackend
import aqua.backend.ts.TypeScriptBackend
import aqua.backend.{AirFunction, Backend, Generated}
import aqua.compiler.*
import aqua.constants.Constants
import aqua.definitions.FunctionDef
import aqua.files.{AquaFileSources, AquaFilesIO, FileModuleId}
import aqua.io.*
import aqua.js.{FunctionDefJs, ServiceDefJs, VarJson}
import aqua.logging.{LogFormatter, LogLevels}
import aqua.model.AquaContext
import aqua.parser.lexer.{LiteralToken, Token}
import aqua.parser.{ArrowReturnError, BlockIndentError, LexerError, ParserError}
import aqua.raw.ops.Call
import aqua.raw.ops.CallArrowRawTag
import aqua.raw.value.ValueRaw
import aqua.raw.value.{LiteralRaw, VarRaw}
import aqua.res.AquaRes
import api.types.{AquaConfig, AquaFunction, CompilationResult, GeneratedSource, Input}
import cats.Applicative
import cats.data.Validated.{Invalid, Valid, invalidNec, validNec}
import cats.data.{Chain, NonEmptyChain, Validated, ValidatedNec}
import cats.effect.IO
import cats.effect.unsafe.implicits.global
import cats.syntax.applicative.*
import cats.syntax.apply.*
import cats.syntax.either.*
import cats.syntax.flatMap.*
import cats.syntax.functor.*
import cats.syntax.show.*
import cats.syntax.traverse.*
import fs2.io.file.{Files, Path}
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.scalajs.js
import scala.scalajs.js.JSConverters.*
import scala.scalajs.js.annotation.*
import scala.scalajs.js.{Promise, UndefOr, undefined, |}
import scribe.Logging
@JSExportTopLevel("Aqua")
object AquaAPI extends App with Logging {
// See api-npm package for description of imports config
type ImportsJS = js.Dictionary[
js.Dictionary[js.Array[String]]
]
/**
* All-in-one function that support different inputs and backends
* @param input can be a path to aqua file, string with a code or a function call
* @param imports imports configuration
* @param aquaConfigJS compiler config
* @return compiler results depending on input and config
*/
@JSExport
def compile(
input: types.Input | types.Path | types.Call,
imports: ImportsJS,
aquaConfigJS: js.UndefOr[AquaConfig]
): Promise[CompilationResult] = {
aquaConfigJS.toOption
.map(AquaConfig.fromJS)
.getOrElse(validNec(AquaAPIConfig()))
.traverse { config =>
val apiImports = Imports.fromMap(
imports.view
.mapValues(
_.toMap.view
.mapValues(_.toList)
.toMap
)
.toMap
)
input match {
case i: (types.Input | types.Path) =>
compileAll(i, apiImports, config)
case c: types.Call =>
compileCall(c, apiImports, config)
}
}
.map(_.leftMap(errs => CompilationResult.errs(errs.toChain.toList)).merge)
.unsafeToFuture()
.toJSPromise
}
// Compile all non-call inputs
private def compileAll(
input: types.Input | types.Path,
imports: Imports,
config: AquaAPIConfig
): IO[CompilationResult] = {
val backend: Backend = config.targetType match {
case AirType => APIBackend
case TypeScriptType => TypeScriptBackend()
case JavaScriptType => JavaScriptBackend()
}
extension (res: APIResult[Chain[AquaCompiled[FileModuleId]]])
def toResult: CompilationResult = {
val (warnings, result) = res.value.run
result.map { compiled =>
(config.targetType match {
case AirType => generatedToAirResult
case TypeScriptType => compiledToTsSourceResult
case JavaScriptType => compiledToJsSourceResult
}).apply(compiled, warnings)
}.leftMap(errorsToResult(_, warnings)).merge
}
input match {
case i: types.Input =>
APICompilation
.compileString(
i.input,
imports,
config,
backend
)
.map(_.toResult)
case p: types.Path =>
APICompilation
.compilePath(
p.path,
imports,
config,
backend
)
.map(_.toResult)
}
}
// Compile a function call
private def compileCall(
call: types.Call,
imports: Imports,
config: AquaAPIConfig
): IO[CompilationResult] = {
val path = call.input match {
case i: types.Input => i.input
case p: types.Path => p.path
}
extension (res: APIResult[(FunctionDef, String)])
def callToResult: CompilationResult = {
val (warnings, result) = res.value.run
result.map { case (definitions, air) =>
CompilationResult.result(
call = Some(AquaFunction(FunctionDefJs(definitions), air)),
warnings = warnings.toList
)
}.leftMap(errorsToResult(_, warnings)).merge
}
APICompilation
.compileCall(
call.functionCall,
path,
imports,
config,
vr => VarJson.checkDataGetServices(vr, Some(call.arguments)).map(_._1)
)
.map(_.callToResult)
}
private def errorsToResult(
errors: NonEmptyChain[String],
warnings: Chain[String]
): CompilationResult = CompilationResult.errs(
errors.toChain.toList,
warnings.toList
)
private def compiledToTsSourceResult(
compiled: Chain[AquaCompiled[FileModuleId]],
warnings: Chain[String]
): CompilationResult = CompilationResult.result(
sources = compiled.toList
.flatMap(c =>
c.compiled
.find(_.suffix == TypeScriptBackend.ext)
.map(_.content)
.map(GeneratedSource.tsSource(c.sourceId.toString, _))
),
warnings = warnings.toList
)
private def compiledToJsSourceResult(
compiled: Chain[AquaCompiled[FileModuleId]],
warnings: Chain[String]
): CompilationResult = CompilationResult.result(
sources = compiled.toList.flatMap { c =>
for {
dtsContent <- c.compiled
.find(_.suffix == JavaScriptBackend.dtsExt)
.map(_.content)
jsContent <- c.compiled
.find(_.suffix == JavaScriptBackend.ext)
.map(_.content)
} yield GeneratedSource.jsSource(c.sourceId.toString, jsContent, dtsContent)
},
warnings = warnings.toList
)
private def generatedToAirResult(
compiled: Chain[AquaCompiled[FileModuleId]],
warnings: Chain[String]
): CompilationResult = {
val generated = compiled.toList.flatMap(_.compiled)
val serviceDefs = generated.flatMap(_.services).map(s => s.name -> ServiceDefJs(s))
val functions = generated.flatMap(
_.air.map(as => as.name -> AquaFunction(FunctionDefJs(as.funcDef), as.air))
)
CompilationResult.result(
services = serviceDefs.toMap,
functions = functions.toMap,
warnings = warnings.toList
)
}
}

View File

@ -0,0 +1,86 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package api.types
import aqua.api.AquaAPIConfig
import aqua.api.TargetType.*
import aqua.js.{FunctionDefJs, ServiceDefJs}
import cats.data.Validated.{invalidNec, validNec}
import cats.data.{Chain, NonEmptyChain, Validated, ValidatedNec}
import scala.scalajs.js
import scala.scalajs.js.JSConverters.*
import scala.scalajs.js.annotation.{JSExport, JSExportAll, JSExportTopLevel}
import scala.scalajs.js.|
@JSExportTopLevel("Input")
@JSExportAll
class Input(
val input: String
)
@JSExportTopLevel("Path")
@JSExportAll
class Path(
val path: String
)
@JSExportTopLevel("Call")
@JSExportAll
class Call(
val functionCall: String,
val arguments: js.Dynamic,
val input: Path | Input
)
@JSExportTopLevel("AquaConfig")
@JSExportAll
class AquaConfig(
val logLevel: js.UndefOr[String],
val constants: js.UndefOr[js.Array[String]],
val noXor: js.UndefOr[Boolean],
val noRelay: js.UndefOr[Boolean],
val targetType: js.UndefOr[String],
val tracing: js.UndefOr[Boolean],
val noEmptyResponse: js.UndefOr[Boolean]
)
object AquaConfig {
def fromJS(cjs: AquaConfig): ValidatedNec[String, AquaAPIConfig] = {
cjs.targetType.toOption
.map(_.toLowerCase())
.map {
case "typescript" => validNec(TypeScriptType)
case "javascript" => validNec(JavaScriptType)
case "air" => validNec(AirType)
case _ => invalidNec("Target can be only 'typescript', 'javascript', or 'air'")
}
.getOrElse(validNec(AirType))
.map { target =>
AquaAPIConfig(
targetType = target,
logLevel = cjs.logLevel.getOrElse("info"),
constants = cjs.constants.map(_.toList).getOrElse(Nil),
noXor = cjs.noXor.getOrElse(false),
noRelay = cjs.noRelay.getOrElse(false),
tracing = cjs.tracing.getOrElse(false),
noEmptyResponse = cjs.noEmptyResponse.getOrElse(true)
)
}
}
}

View File

@ -0,0 +1,88 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package api.types
import aqua.js.{FunctionDefJs, ServiceDefJs}
import aqua.model.transform.TransformConfig
import cats.data.Validated.{invalidNec, validNec, Invalid, Valid}
import cats.data.{Chain, NonEmptyChain, Validated, ValidatedNec}
import scala.scalajs.js
import scala.scalajs.js.JSConverters.*
import scala.scalajs.js.|
class AquaFunction(
val funcDef: FunctionDefJs,
val script: String
) extends js.Object
class GeneratedSource(
val name: String,
val tsSource: js.UndefOr[String],
val jsSource: js.UndefOr[String],
val tsTypes: js.UndefOr[String]
) extends js.Object
object GeneratedSource {
def tsSource(name: String, tsSource: String) =
new GeneratedSource(name, tsSource, null, null)
def jsSource(name: String, jsSource: String, tsTypes: String) =
new GeneratedSource(name, null, jsSource, tsTypes)
}
class CompilationResult(
val services: js.Dictionary[ServiceDefJs],
val functions: js.Dictionary[AquaFunction],
val functionCall: js.UndefOr[AquaFunction],
val generatedSources: js.Array[GeneratedSource],
val errors: js.Array[String],
val warnings: js.Array[String]
) extends js.Object
object CompilationResult {
def result(
services: Map[String, ServiceDefJs] = Map.empty,
functions: Map[String, AquaFunction] = Map.empty,
call: Option[AquaFunction] = None,
sources: List[GeneratedSource] = List.empty,
warnings: List[String] = List.empty
): CompilationResult =
new CompilationResult(
services.toJSDictionary,
functions.toJSDictionary,
call.orNull,
sources.toJSArray,
js.Array(),
warnings.toJSArray
)
def errs(
errors: List[String] = List.empty,
warnings: List[String] = List.empty
): CompilationResult =
new CompilationResult(
js.Dictionary.empty,
js.Dictionary.empty,
null,
null,
errors.toJSArray,
warnings.toJSArray
)
}

View File

@ -0,0 +1,70 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.api
import aqua.api.TargetType.TypeScriptType
import aqua.backend.ts.TypeScriptBackend
import aqua.compiler.AquaCompiled
import aqua.files.FileModuleId
import cats.data.Chain
import cats.effect.{IO, IOApp}
import fs2.io.file.{Files, Path}
import fs2.{Stream, text}
object Test extends IOApp.Simple {
override def run: IO[Unit] = {
APICompilation
.compilePath(
"./aqua-src/antithesis.aqua",
Imports.fromMap(Map("/" -> Map("" -> List("./aqua")))),
AquaAPIConfig(targetType = TypeScriptType, noXor = true),
TypeScriptBackend(false, "IFluenceClient$$")
)
.timed
.flatMap { case (duration, res) =>
println("Compilation time: " + duration.toMillis)
val (warnings, result) = res.value.run
IO.delay {
warnings.toList.foreach(println)
} *> result.fold(
errors =>
IO.delay {
errors.toChain.toList.foreach(println)
},
compiled => {
val content = compiled.get(0).get.compiled.head.content
val targetPath = Path("./target/antithesis.ts")
Stream
.emit(content)
.through(text.utf8.encode)
.through(Files[IO].writeAll(targetPath))
.attempt
.compile
.last *> IO.delay(
println(s"File: ${targetPath.absolute.normalize}")
)
}
)
}
}
}

View File

@ -0,0 +1,201 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.api
import aqua.Rendering.given
import aqua.api.AquaAPIConfig
import aqua.backend.api.APIBackend
import aqua.backend.{AirFunction, Backend, Generated}
import aqua.compiler.*
import aqua.constants.Constants
import aqua.definitions.FunctionDef
import aqua.files.{AquaFileSources, AquaFilesIO, AquaStringSources, FileModuleId}
import aqua.io.*
import aqua.logging.{LogFormatter, LogLevels}
import aqua.model.AquaContext
import aqua.model.transform.{Transform, TransformConfig}
import aqua.parser.expr.AbilityExpr.p
import aqua.parser.lexer.{LiteralToken, Token}
import aqua.parser.lift.FileSpan.F
import aqua.parser.lift.{FileSpan, Span}
import aqua.parser.{ArrowReturnError, LexerError, ParserError}
import aqua.raw.ConstantRaw
import aqua.raw.ops.Call
import aqua.raw.value.ValueRaw
import aqua.res.AquaRes
import aqua.run.{CliFunc, FuncCompiler, RunPreparer}
import aqua.{AquaIO, SpanParser}
import cats.Applicative
import cats.data.*
import cats.data.Validated.*
import cats.effect.IO
import cats.effect.unsafe.implicits.global
import cats.syntax.applicative.*
import cats.syntax.apply.*
import cats.syntax.either.*
import cats.syntax.flatMap.*
import cats.syntax.functor.*
import cats.syntax.show.*
import cats.syntax.traverse.*
import cats.~>
import fs2.io.file.{Files, Path}
import scribe.{Level, Logging}
object APICompilation {
def compileCall(
functionStr: String,
pathStr: String,
imports: Imports,
aquaConfig: AquaAPIConfig,
fillWithTypes: List[ValueRaw] => ValidatedNec[String, List[ValueRaw]]
): IO[APIResult[(FunctionDef, String)]] = {
given AquaIO[IO] = new AquaFilesIO[IO]
(
LogLevels.levelFromString(aquaConfig.logLevel),
Constants.parse(aquaConfig.constants)
).tupled.toResult.flatTraverse { case (level, constants) =>
val transformConfig = aquaConfig.getTransformConfig
val config = aquaConfig.getCompilerConfig.copy(constants = constants)
LogFormatter.initLogger(Some(level))
new FuncCompiler[IO](
Some(RelativePath(Path(pathStr))),
imports.toIO,
transformConfig,
config
).compile().map { contextV =>
for {
context <- contextV.toResult
cliFunc <- CliFunc
.fromString(functionStr)
.toResult
arrow <- FuncCompiler
.findFunction(context, cliFunc)
.toResult
argsWithTypes <- fillWithTypes(cliFunc.args).toResult
func = cliFunc.copy(args = argsWithTypes)
preparer = new RunPreparer(
func,
arrow,
transformConfig
)
ci <- preparer.prepare().toResult
} yield ci.definitions -> ci.air
}
}
}
def compilePath(
pathStr: String,
imports: Imports,
aquaConfig: AquaAPIConfig,
backend: Backend
): IO[APIResult[Chain[AquaCompiled[FileModuleId]]]] = {
given AquaIO[IO] = new AquaFilesIO[IO]
val path = Path(pathStr)
val sources = new AquaFileSources[IO](
path,
imports.toIO
)
compileRaw(
aquaConfig,
sources,
backend
)
}
def compileString(
input: String,
imports: Imports,
aquaConfig: AquaAPIConfig,
backend: Backend
): IO[APIResult[Chain[AquaCompiled[FileModuleId]]]] = {
given AquaIO[IO] = new AquaFilesIO[IO]
val path = Path("")
val strSources: AquaStringSources[IO] =
new AquaStringSources(
Map(FileModuleId(path) -> input),
imports.toIO
)
compileRaw(
aquaConfig,
strSources,
backend
)
}
private def compileRaw(
aquaConfig: AquaAPIConfig,
sources: AquaSources[IO, AquaFileError, FileModuleId],
backend: Backend
): IO[APIResult[Chain[AquaCompiled[FileModuleId]]]] = (
LogLevels.levelFromString(aquaConfig.logLevel),
Constants.parse(aquaConfig.constants)
).tupled.toResult.flatTraverse { case (level, constants) =>
LogFormatter.initLogger(Some(level))
val transformConfig = aquaConfig.getTransformConfig
val config = aquaConfig.getCompilerConfig.copy(constants = constants)
CompilerAPI
.compile[IO, AquaFileError, FileModuleId, FileSpan.F](
sources,
SpanParser.parser,
new AirValidator[IO] {
override def init(): IO[Unit] = Applicative[IO].pure(())
override def validate(airs: List[AirFunction]): IO[ValidatedNec[String, Unit]] =
Applicative[IO].pure(validNec(()))
},
new Backend.Transform {
override def transform(ex: AquaContext): AquaRes =
Transform.contextRes(ex, transformConfig)
override def generate(aqua: AquaRes): Seq[Generated] = backend.generate(aqua)
},
config
)
.map(_.toResult)
}
extension [A](v: ValidatedNec[String, A]) {
def toResult: APIResult[A] =
v.toEither.toEitherT
}
extension [A](v: CompileResult[FileModuleId, AquaFileError, FileSpan.F][A]) {
def toResult: APIResult[A] =
v.leftMap(_.map(_.show))
.mapK(
new (CompileWarnings[FileSpan.F] ~> APIWarnings) {
override def apply[A](w: CompileWarnings[FileSpan.F][A]): APIWarnings[A] =
w.mapWritten(_.map(_.show))
}
)
}
}

View File

@ -0,0 +1,52 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.api
import aqua.compiler.AquaCompilerConf
import aqua.model.transform.TransformConfig
enum TargetType:
case TypeScriptType, JavaScriptType, AirType
case class AquaAPIConfig(
targetType: TargetType = TargetType.AirType,
logLevel: String = "info",
constants: List[String] = Nil,
noXor: Boolean = false,
noRelay: Boolean = false,
tracing: Boolean = false,
noEmptyResponse: Boolean = true
) {
def getTransformConfig: TransformConfig = {
val config = TransformConfig(
tracing = Option.when(tracing)(TransformConfig.TracingConfig.default),
noEmptyResponse = noEmptyResponse,
noXor = noXor
)
if (noRelay) config.copy(relayVarName = None)
else config
}
def getCompilerConfig: AquaCompilerConf = {
val config = AquaCompilerConf()
if (noRelay) config.copy(relayVarName = None)
else config
}
}

View File

@ -0,0 +1,65 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.api
import aqua.files.Imports as IOImports
import fs2.io.file.Path
/**
* Imports configuration passed to the compiler
* @param settings map of path prefixes to imports settings
*/
final case class Imports(
settings: Map[Path, Imports.PathSettings]
) {
def toIO: IOImports =
IOImports(
settings.view
.mapValues(
_.toIO
)
.toMap
)
}
object Imports {
/**
* Imports settings for a single path prefix.
* @param imports map of import prefixes to locations
*/
final case class PathSettings(
imports: Map[String, List[Path]]
) {
def toIO: IOImports.PathSettings =
IOImports.PathSettings(imports)
}
def fromMap(m: Map[String, Map[String, List[String]]]): Imports =
Imports(
m.map { case (pathPrefix, settings) =>
Path(pathPrefix) -> PathSettings(
settings.map { case (importPrefix, locations) =>
importPrefix -> locations.map(Path.apply)
}
)
}
)
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua
import cats.data.{Chain, EitherT, NonEmptyChain, Writer}
package object api {
type APIWarnings = [A] =>> Writer[
Chain[String],
A
]
type APIResult = [A] =>> EitherT[
APIWarnings,
NonEmptyChain[String],
A
]
}

View File

@ -1,32 +0,0 @@
import {
Aqua,
Call,
Path,
} from "@fluencelabs/aqua-api/aqua-api.js";
const aquaPath = new Path("test.aqua")
// write function that we want to call and arguments
const args = {num: 42}
const call = new Call("getNumber(num)", args, aquaPath)
// compile call
const compilationResult = await Aqua.compile(call, [])
/*
// Compilation result definition
export class CompilationResult {
// List of service definitions to register in Fluence JS Client
services: Record<string, ServiceDef>
// List of function definitions to call in Fluence JS Client
functions: Record<string, AquaFunction>
// Definition of wrapped function to call in Fluence JS Client
functionCall?: AquaFunction
// List of errors. All other fields will be empty if `errors` not empty
errors: string[]
}
*/
// get function definition, that describes types of arguments and results of a function
// and AIR script
const {funcDef, script} = compilationResult.functionCall

View File

@ -1,21 +0,0 @@
{
"name": "aqua-api-example",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "aqua-api-example",
"version": "1.0.0",
"license": "Apache-2.0",
"dependencies": {
"@fluencelabs/aqua-api": "0.10.4"
}
},
"node_modules/@fluencelabs/aqua-api": {
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-api/-/aqua-api-0.10.4.tgz",
"integrity": "sha512-mBT/ht0mVcGqBfkrnQw9E/tqIW3RNOCDhNwjra9X5WI/TRlztU3G8Vn/odVn6YTpZWJeDwn1qN1VgLoS3VkASA=="
}
}
}

View File

@ -1,50 +0,0 @@
import type {FunctionCallDef, ServiceDef} from "@fluencelabs/fluence/dist/internal/compilerSupport/v3impl/interface"
export class AquaConfig {
constructor(logLevel: string, constants: string[], noXor: boolean, noRelay: boolean);
logLevel?: string
constants?: string[]
noXor?: boolean
noRelay?: boolean
}
export class AquaFunction {
funcDef: FunctionCallDef
script: string
}
export class CompilationResult {
services: Record<string, ServiceDef>
functions: Record<string, AquaFunction>
functionCall?: AquaFunction
errors: string[]
}
export class Input {
constructor(input: string);
input: string
}
export class Path {
constructor(path: string);
path: string
}
export class Call {
constructor(functionCall: string,
arguments: any,
input: Input | Path);
functionCall: string
arguments: any
input: Input | Path
}
export class Compiler {
compile(input: Input | Path | Call, imports: string[], config?: AquaConfig): Promise<CompilationResult>;
}
export var Aqua: Compiler;

View File

@ -1 +0,0 @@
const metaUrl = ""

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
# Aqua API
[Documentation](https://fluence.dev/docs/aqua-book/aqua-js-api)

View File

@ -1,233 +0,0 @@
package aqua.api
import aqua.ErrorRendering.showError
import aqua.api.types.{AquaAPIConfig, AquaConfig, AquaFunction, CompilationResult, Input}
import aqua.backend.{AirFunction, Backend, Generated}
import aqua.compiler.*
import aqua.files.{AquaFileSources, AquaFilesIO, FileModuleId}
import aqua.logging.{LogFormatter, LogLevels}
import aqua.constants.Constants
import aqua.io.*
import aqua.raw.ops.Call
import aqua.run.{CallInfo, CallPreparer, CliFunc, FuncCompiler, RunPreparer}
import aqua.parser.lexer.{LiteralToken, Token}
import aqua.parser.lift.FileSpan.F
import aqua.parser.lift.{FileSpan, Span}
import aqua.parser.{ArrowReturnError, BlockIndentError, LexerError, ParserError}
import aqua.semantics.{CompilerState, HeaderError, RulesViolated, WrongAST}
import aqua.{AquaIO, SpanParser}
import aqua.model.transform.{Transform, TransformConfig}
import aqua.backend.api.APIBackend
import cats.data.{Chain, NonEmptyChain, Validated, ValidatedNec}
import cats.data.Validated.{Invalid, Valid, invalidNec, validNec}
import cats.syntax.applicative.*
import cats.syntax.apply.*
import cats.syntax.flatMap.*
import cats.syntax.functor.*
import cats.effect.IO
import cats.effect.unsafe.implicits.global
import cats.syntax.show.*
import cats.syntax.traverse.*
import fs2.io.file.{Files, Path}
import scribe.Logging
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.scalajs.js.|
import scala.scalajs.js
import scala.scalajs.js.JSConverters.*
import scala.scalajs.js.annotation.*
import scala.scalajs.js.{UndefOr, undefined}
import aqua.js.{FunctionDefJs, ServiceDefJs, VarJson}
import aqua.model.AquaContext
import aqua.raw.ops.CallArrowRawTag
import aqua.raw.value.{LiteralRaw, VarRaw}
import aqua.res.AquaRes
import cats.Applicative
@JSExportTopLevel("Aqua")
object AquaAPI extends App with Logging {
def getTag(serviceId: String, value: VarRaw) = {
CallArrowRawTag.service(
LiteralRaw.quote(serviceId),
value.name,
Call(List.empty, List(Call.Export(value.name, value.baseType)))
)
}
@JSExport
def compile(
input: types.Input | types.Path | types.Call,
imports: js.Array[String],
aquaConfigJS: js.UndefOr[AquaConfig]
) = {
val aquaConfig: AquaAPIConfig =
aquaConfigJS.toOption.map(cjs => AquaAPIConfig.fromJS(cjs)).getOrElse(AquaAPIConfig())
val importsList = imports.toList
input match {
case i: types.Input => compileString(i.input, importsList, aquaConfig)
case p: types.Path => compilePath(p.path, importsList, aquaConfig)
case c: types.Call =>
val path = c.input match {
case i: types.Input => i.input
case p: types.Path => p.path
}
compileCall(c.functionCall, c.arguments, path, importsList, aquaConfig)
}
}
def compileCall(
functionStr: String,
arguments: js.Dynamic,
pathStr: String,
imports: List[String],
aquaConfig: AquaAPIConfig
): js.Promise[CompilationResult] = {
implicit val aio: AquaIO[IO] = new AquaFilesIO[IO]
(
LogLevels.levelFromString(aquaConfig.logLevel),
Constants.parse(aquaConfig.constants)
).mapN { (level, constants) =>
val transformConfig = aquaConfig.getTransformConfig.copy(constants = constants)
LogFormatter.initLogger(Some(level))
new FuncCompiler[IO](
Some(RelativePath(Path(pathStr))),
imports.map(Path.apply),
transformConfig
).compile()
.map { contextV =>
contextV.andThen { context =>
CliFunc
.fromString(functionStr)
.leftMap(errs => NonEmptyChain.fromNonEmptyList(errs))
.andThen { cliFunc =>
FuncCompiler.findFunction(context, cliFunc).andThen { arrow =>
VarJson.checkDataGetServices(cliFunc.args, Some(arguments)).andThen {
case (argsWithTypes, _) =>
val func = cliFunc.copy(args = argsWithTypes)
val preparer = new RunPreparer(
func,
arrow,
transformConfig
)
preparer.prepare().map { ci =>
AquaFunction(FunctionDefJs(ci.definitions), ci.air)
}
}
}
}
}
}
.flatMap {
case Valid(result) => IO.pure(CompilationResult.result(js.Dictionary(), js.Dictionary(), Some(result)))
case Invalid(err) =>
val errs = err.map(_.show).distinct.toChain.toList
IO.pure(CompilationResult.errs(errs))
}
.unsafeToFuture()
.toJSPromise
} match {
case Valid(pr) => pr
case Invalid(err) => js.Promise.resolve(CompilationResult.errs(err.toList))
}
}
def compilePath(
pathStr: String,
imports: List[String],
aquaConfig: AquaAPIConfig
): js.Promise[CompilationResult] = {
implicit val aio: AquaIO[IO] = new AquaFilesIO[IO]
val path = Path(pathStr)
val sources = new AquaFileSources[IO](path, imports.map(Path.apply))
compileRaw(aquaConfig, sources)
}
def compileString(
input: String,
imports: List[String],
aquaConfig: AquaAPIConfig
): js.Promise[CompilationResult] = {
implicit val aio: AquaIO[IO] = new AquaFilesIO[IO]
val path = Path("")
val strSources: AquaFileSources[IO] =
new AquaFileSources[IO](path, imports.map(Path.apply)) {
override def sources: IO[ValidatedNec[AquaFileError, Chain[(FileModuleId, String)]]] = {
IO.pure(Valid(Chain.one((FileModuleId(path), input))))
}
}
compileRaw(aquaConfig, strSources)
}
def compileRaw(
aquaConfig: AquaAPIConfig,
sources: AquaSources[IO, AquaFileError, FileModuleId]
): js.Promise[CompilationResult] = {
(
LogLevels.levelFromString(aquaConfig.logLevel),
Constants.parse(aquaConfig.constants)
).mapN { (level, constants) =>
LogFormatter.initLogger(Some(level))
val config = AquaCompilerConf(constants)
val transformConfig = aquaConfig.getTransformConfig
val proc = for {
res <- CompilerAPI
.compile[IO, AquaFileError, FileModuleId, FileSpan.F](
sources,
SpanParser.parser,
new AirValidator[IO] {
override def init(): IO[Unit] = Applicative[IO].pure(())
override def validate(airs: List[AirFunction]): IO[ValidatedNec[String, Unit]] =
Applicative[IO].pure(validNec(()))
},
new Backend.Transform:
override def transform(ex: AquaContext): AquaRes =
Transform.contextRes(ex, transformConfig)
override def generate(aqua: AquaRes): Seq[Generated] = APIBackend.generate(aqua)
,
config
)
jsResult <- res match {
case Valid(compiled) =>
val allGenerated: List[Generated] = compiled.toList.flatMap(_.compiled)
val serviceDefs = allGenerated.flatMap(_.services).map(s => s.name -> ServiceDefJs(s))
val functions = allGenerated.flatMap(
_.air.map(as => (as.name, AquaFunction(FunctionDefJs(as.funcDef), as.air)))
)
IO.pure(
CompilationResult.result(
js.Dictionary.apply(serviceDefs: _*),
js.Dictionary.apply(functions: _*),
None
)
)
case Invalid(errChain) =>
val errors = errChain.map(_.show).distinct.toChain.toList
IO.pure[CompilationResult](CompilationResult.errs(errors))
}
} yield {
jsResult
}
proc.unsafeToFuture().toJSPromise
} match {
case Valid(pr) => pr
case Invalid(err) => js.Promise.resolve(CompilationResult.errs(err.toList))
}
}
}

View File

@ -1,103 +0,0 @@
package aqua.api.types
import aqua.api.*
import aqua.js.{FunctionDefJs, ServiceDefJs}
import aqua.model.transform.TransformConfig
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSExport, JSExportTopLevel}
import scala.scalajs.js.|
import scala.scalajs.js.JSConverters.*
@JSExportTopLevel("AquaFunction")
case class AquaFunction(
@JSExport
funcDef: FunctionDefJs,
@JSExport
script: String
)
@JSExportTopLevel("Input")
class Input(
@JSExport
val input: String
)
@JSExportTopLevel("Path")
class Path(
@JSExport
val path: String
)
@JSExportTopLevel("Call")
class Call(
@JSExport
val functionCall: String,
@JSExport
val arguments: js.Dynamic,
@JSExport
val input: Path | Input
)
@JSExportTopLevel("AquaConfig")
class AquaConfig(
@JSExport
val logLevel: js.UndefOr[String],
@JSExport
val constants: js.UndefOr[js.Array[String]],
@JSExport
val noXor: js.UndefOr[Boolean],
@JSExport
val noRelay: js.UndefOr[Boolean]
)
@JSExportTopLevel("CompilationResult")
class CompilationResult(
@JSExport
val services: js.Dictionary[ServiceDefJs],
@JSExport
val functions: js.Dictionary[AquaFunction],
@JSExport
val functionCall: js.UndefOr[AquaFunction],
@JSExport
val errors: js.Array[String]
)
object CompilationResult {
def result(
services: js.Dictionary[ServiceDefJs],
functions: js.Dictionary[AquaFunction],
call: Option[AquaFunction]
): CompilationResult =
new CompilationResult(services, functions, call.orNull, js.Array())
def errs(
errors: List[String]
): CompilationResult =
CompilationResult(js.Dictionary(), js.Dictionary(), null, errors.toJSArray)
}
case class AquaAPIConfig(
logLevel: String = "info",
constants: List[String] = Nil,
noXor: Boolean = false,
noRelay: Boolean = false
) {
def getTransformConfig: TransformConfig =
if (noRelay) TransformConfig(relayVarName = None, wrapWithXor = !noXor)
else TransformConfig(wrapWithXor = !noXor)
}
object AquaAPIConfig {
def fromJS(cjs: AquaConfig): AquaAPIConfig = {
AquaAPIConfig(
cjs.logLevel.getOrElse("info"),
cjs.constants.map(_.toList).getOrElse(Nil),
cjs.noXor.getOrElse(false),
cjs.noRelay.getOrElse(false)
)
}
}

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.run
import aqua.definitions.FunctionDef

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.run
import aqua.backend.air.FuncAirGen
@ -7,7 +23,7 @@ import aqua.model.transform.{Transform, TransformConfig}
import aqua.model.{FuncArrow, ValueModel, VarModel}
import aqua.parser.lexer.CallArrowToken
import aqua.parser.lift.Span
import aqua.raw.ops.{Call, CallArrowRawTag, FuncOp, SeqTag}
import aqua.raw.ops.{Call, CallArrowRawTag, SeqTag}
import aqua.raw.value.{LiteralRaw, ValueRaw, VarRaw}
import aqua.types.*
import cats.data.Validated.{invalid, invalidNec, invalidNel, validNec, validNel}
@ -18,7 +34,7 @@ import cats.syntax.flatMap.*
import cats.syntax.partialOrder.*
import cats.syntax.show.*
import cats.syntax.traverse.*
import cats.{Id, ~>}
import cats.{~>, Id}
import scala.collection.immutable.SortedMap
import scala.concurrent.ExecutionContext
@ -128,7 +144,7 @@ class CallPreparer(
FuncArrow(
config.functionWrapperName,
SeqTag.wrap((getters.map(_.leaf) :+ body :+ finisherService.leaf): _*),
SeqTag.wrap(getters.map(_.leaf) :+ body :+ finisherService.leaf*),
// no arguments and returns "ok" string
ArrowType(NilType, returnCodomain),
ret,

View File

@ -1,71 +1,90 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.run
import aqua.parser.lexer.{CallArrowToken, CollectionToken, LiteralToken, VarToken}
import aqua.parser.lift.Span
import aqua.raw.value.{CollectionRaw, LiteralRaw, ValueRaw, VarRaw}
import aqua.types.{ArrayType, BottomType}
import cats.data.{NonEmptyList, Validated, ValidatedNel}
import cats.data.Validated.{invalid, invalidNel, validNel}
import cats.{Id, ~>}
import cats.syntax.traverse.*
import aqua.types.*
case class CliFunc(name: String, args: List[ValueRaw] = Nil, ability: Option[String] = None)
import cats.data.Validated.{invalid, invalidNec, validNec}
import cats.data.{NonEmptyChain, NonEmptyList, Validated, ValidatedNec}
import cats.syntax.comonad.*
import cats.syntax.either.*
import cats.syntax.option.*
import cats.syntax.traverse.*
import cats.syntax.validated.*
import cats.{Id, ~>}
case class CliFunc(name: String, args: List[ValueRaw] = Nil)
object CliFunc {
def spanToId: Span.S ~> Id = new (Span.S ~> Id) {
private val spanToId: Span.S ~> Id = new (Span.S ~> Id) {
override def apply[A](span: Span.S[A]): Id[A] = {
span._2
}
override def apply[A](span: Span.S[A]): Id[A] = span.extract
}
def fromString(func: String): ValidatedNel[String, CliFunc] = {
CallArrowToken.callArrow.parseAll(func.trim) match {
case Right(exprSpan) =>
val expr = exprSpan.mapK(spanToId)
val argsV = expr.args.collect {
def fromString(func: String): ValidatedNec[String, CliFunc] = {
CallArrowToken.callArrow
.parseAll(func.trim)
.leftMap(error =>
NonEmptyChain
.fromNonEmptyList(error.expected)
.map(_.context.mkString("\n"))
)
.toValidated
.map(_.mapK(spanToId))
.andThen(expr =>
expr.args.traverse {
case LiteralToken(value, ts) =>
validNel(LiteralRaw(value, ts))
case VarToken(name, _) =>
validNel(VarRaw(name.value, BottomType))
LiteralRaw(value, ts).validNec
case VarToken(name) =>
VarRaw(name.value, BottomType).validNec
case CollectionToken(_, values) =>
val hasVariables = values.exists {
case LiteralToken(_, _) => false
case _ => true
}
if (!hasVariables) {
val literals = values.collect { case LiteralToken(value, ts) =>
LiteralRaw(value, ts)
}
val hasSameTypesOrEmpty =
literals.isEmpty || literals.map(_.baseType).toSet.size == 1
if (hasSameTypesOrEmpty) {
validNel(
NonEmptyList
.fromList(literals)
.map(l => CollectionRaw(l, ArrayType(l.head.baseType)))
.getOrElse(ValueRaw.Nil)
)
} else
invalidNel(
"If the argument is an array, then it must contain elements of the same type."
)
} else
invalidNel(
"Array arguments can only have numbers, strings, or booleans."
values.traverse {
case LiteralToken(value, ts) =>
LiteralRaw(value, ts).some
case _ => none
}.toValid(
"Array elements can only be numbers, strings, or booleans."
).ensure(
"If the argument is an array, then it must contain elements of the same type."
)(_.distinctBy(_.`type`).size <= 1)
.map(
NonEmptyList
.fromList(_)
.map(l =>
CollectionRaw(
l,
ArrayType(
// FIXME: Type of Literal should always be a DataType
l.head.baseType.asInstanceOf[DataType]
)
)
)
.getOrElse(ValueRaw.Nil)
)
.toValidatedNec
case CallArrowToken(_, _, _) =>
invalidNel("Function calls as arguments are not supported.")
}.sequence
argsV.andThen(args =>
validNel(CliFunc(expr.funcName.value, args, expr.ability.map(_.name)))
)
case Left(err) => invalid(err.expected.map(_.context.mkString("\n")))
}
"Function calls as arguments are not supported.".invalidNec
case _ =>
"Unsupported argument.".invalidNec
}.map(args => CliFunc(expr.funcName.value, args))
)
}
}

View File

@ -1,80 +1,86 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.run
import aqua.ErrorRendering.showError
import aqua.compiler.{AquaCompiler, AquaCompilerConf, CompilerAPI}
import aqua.files.{AquaFileSources, FileModuleId}
import aqua.{AquaIO, SpanParser}
import aqua.io.{AquaFileError, AquaPath, PackagePath, Prelude}
import aqua.compiler.{AquaCompilerConf, CompileResult, CompilerAPI}
import aqua.files.{AquaFileSources, FileModuleId, Imports}
import aqua.io.{AquaFileError, AquaPath, PackagePath}
import aqua.model.transform.TransformConfig
import aqua.model.{AquaContext, FuncArrow}
import aqua.parser.lift.FileSpan
import aqua.run.CliFunc
import cats.data.Validated.{invalidNec, validNec}
import cats.data.{Chain, NonEmptyList, Validated, ValidatedNec}
import cats.effect.IO
import aqua.{AquaIO, SpanParser}
import cats.data.{Chain, ValidatedNec}
import cats.effect.kernel.{Async, Clock}
import cats.syntax.applicative.*
import cats.syntax.apply.*
import cats.syntax.flatMap.*
import cats.syntax.functor.*
import cats.syntax.monad.*
import cats.syntax.show.*
import cats.syntax.option.*
import cats.syntax.traverse.*
import fs2.io.file.{Files, Path}
import scribe.Logging
import scala.concurrent.duration.Duration
class FuncCompiler[F[_]: Files: AquaIO: Async](
input: Option[AquaPath],
imports: List[Path],
transformConfig: TransformConfig
imports: Imports,
transformConfig: TransformConfig,
config: AquaCompilerConf
) extends Logging {
type Result = [A] =>> CompileResult[FileModuleId, AquaFileError, FileSpan.F][A]
private def compileToContext(
path: Path,
imports: List[Path],
config: AquaCompilerConf = AquaCompilerConf(transformConfig.constantsList)
) = {
path: Path
): F[Result[Chain[AquaContext]]] = {
val sources = new AquaFileSources[F](path, imports)
CompilerAPI
.compileToContext[F, AquaFileError, FileModuleId, FileSpan.F](
sources,
SpanParser.parser,
config
)
.map(_.leftMap(_.map(_.show)))
CompilerAPI.compileToContext[F, AquaFileError, FileModuleId, FileSpan.F](
sources,
SpanParser.parser,
config
)
}
private def compileBuiltins() = {
private def compileBuiltins(): F[Result[Chain[AquaContext]]] =
for {
path <- PackagePath.builtin.getPath()
context <- compileToContext(path, Nil)
} yield {
context
}
}
context <- compileToContext(path)
} yield context
// Compile and get only one function
def compile(
preludeImports: List[Path] = Nil,
withBuiltins: Boolean = false
): F[ValidatedNec[String, Chain[AquaContext]]] = {
): F[Result[Chain[AquaContext]]] = {
for {
// compile builtins and add it to context
builtinsV <-
if (withBuiltins) compileBuiltins()
else validNec[String, Chain[AquaContext]](Chain.empty).pure[F]
compileResult <- input.map { ap =>
else Chain.empty.pure[Result].pure[F]
compileResult <- input.traverse { ap =>
// compile only context to wrap and call function later
Clock[F].timed(
ap.getPath().flatMap(p => compileToContext(p, preludeImports ++ imports))
ap.getPath().flatMap(p => compileToContext(p))
)
}.getOrElse((Duration.Zero, validNec[String, Chain[AquaContext]](Chain.empty)).pure[F])
(compileTime, contextV) = compileResult
}
(compileTime, contextV) = compileResult.orEmpty
} yield {
logger.debug(s"Compile time: ${compileTime.toMillis}ms")
// add builtins to the end of context
contextV.andThen(c => builtinsV.map(bc => c ++ bc))
(contextV, builtinsV).mapN(_ ++ _)
}
}
}
@ -84,16 +90,9 @@ object FuncCompiler {
def findFunction(
contexts: Chain[AquaContext],
func: CliFunc
): ValidatedNec[String, FuncArrow] =
func.ability
.fold(
contexts
.collectFirstSome(_.allFuncs.get(func.name))
)(ab => contexts.collectFirstSome(_.abilities.get(ab).flatMap(_.allFuncs.get(func.name))))
.map(validNec)
.getOrElse(
Validated.invalidNec[String, FuncArrow](
s"There is no function '${func.ability.map(_ + ".").getOrElse("")}${func.name}' or it is not exported. Check the spelling or see https://fluence.dev/docs/aqua-book/language/header/#export"
)
)
): ValidatedNec[String, FuncArrow] = contexts
.collectFirstSome(_.allFuncs.get(func.name))
.toValidNec(
s"There is no function '${func.name}' or it is not exported. Check the spelling or see https://fluence.dev/docs/aqua-book/language/header/#export"
)
}

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.run
import aqua.logging.LogLevels

View File

@ -1,15 +1,31 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.run
import aqua.backend.air.FuncAirGen
import aqua.definitions.{FunctionDef, TypeDefinition}
import aqua.io.OutputPrinter
import aqua.model.transform.{Transform, TransformConfig}
import aqua.model.{FuncArrow, ValueModel, VarModel}
import aqua.parser.lexer.CallArrowToken
import aqua.parser.lift.Span
import aqua.raw.ops.{Call, CallArrowRawTag, FuncOp, SeqTag}
import aqua.raw.ops.{Call, CallArrowRawTag, SeqTag}
import aqua.raw.value.{LiteralRaw, ValueRaw, VarRaw}
import aqua.types.*
import cats.data.Validated.{invalid, invalidNec, invalidNel, validNec, validNel}
import cats.data.{NonEmptyList, Validated, ValidatedNec}
import cats.effect.kernel.Async
@ -18,8 +34,7 @@ import cats.syntax.flatMap.*
import cats.syntax.partialOrder.*
import cats.syntax.show.*
import cats.syntax.traverse.*
import cats.{~>, Id}
import cats.{Id, ~>}
import scala.collection.immutable.SortedMap
import scala.concurrent.ExecutionContext
@ -101,9 +116,10 @@ class RunPreparer(
val returnCodomain = ProductType(results.map(_.`type`))
// arguments is only variables, without literals
val argumentsType = ProductType.labelled(func.args.zip(funcCallable.arrowType.domain.labelledData).collect {
case (VarRaw(name, _), (_, t)) => (name, t)
})
val argumentsType =
ProductType.labelled(func.args.zip(funcCallable.arrowType.domain.labelledData).collect {
case (VarRaw(name, _), (_, t)) => (name, t)
})
FuncArrow(
func.name + "Run",

View File

@ -1,7 +1,24 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.run
import aqua.raw.value.{LiteralRaw, ValueRaw, VarRaw}
import aqua.types.*
import cats.data.Validated.{invalidNec, validNec}
import cats.data.{Validated, ValidatedNec}
import cats.effect.kernel.Async
@ -10,14 +27,11 @@ import cats.syntax.flatMap.*
import cats.syntax.partialOrder.*
import cats.syntax.show.*
import cats.syntax.traverse.*
import scala.collection.immutable.SortedMap
import scala.concurrent.ExecutionContext
object TypeValidator {
import aqua.types.Type.typesPartialOrder
/**
* Compare and validate type from Aqua file and type generated from JSON.
* Also, the validation will succeed if the JSON type is missing an array or an optional field.
@ -69,7 +83,7 @@ object TypeValidator {
case (l: OptionType, r) =>
// if we have ?[][]string and [][][]string it must throw an error
validateTypes(name, l.element, Some(r), Some((l, r)))
case (l: BoxType, r: BoxType) =>
case (l: CollectionType, r: CollectionType) =>
validateTypes(name, l.element, Some(r.element), fullOptionType.orElse(Some(l, r)))
case (l, r) =>

View File

@ -1,9 +1,14 @@
module Import3 declares *
aqua StreamMapTest declares *
export foo_bar
export main
use "export.aqua"
func foo() -> %string, u64:
map: %string
<- map, 42
func foo_bar() -> string, string:
z <- FooBars.foo()
<- z, FooBars.DECLARE_CONST2
func get() -> string, string:
<- "123", "44"
func main() -> string:
m <- foo()
<- m.get("key")!

View File

@ -1,3 +1,5 @@
aqua Builtin declares *
-- Default public interface of Fluence nodes
alias Field : []string

View File

@ -1,15 +1,8 @@
module DeclareModule declares decl_foo, decl_bar, SuperFoo, DECLARE_CONST, DECLARE_CONST2
export SuperFoo
aqua AquaName declares getWorker, Worker
const DECLARE_CONST = "declare_const"
const DECLARE_CONST2 = "declare_const2"
data Worker:
host_id: string
service SuperFoo("super_foo"):
small_foo() -> string
func getWorker() -> Worker:
<- Worker(host_id = "")
func decl_foo() -> string:
res1 <- SuperFoo.small_foo()
<- res1
func decl_bar() -> string:
<- DECLARE_CONST

View File

@ -1,7 +1,15 @@
module FooBars declares *
aqua FooBars declares *
const DECLARE_CONST = "declare_const"
const DECLARE_CONST2 = "declare_const2"
-- alias SomeStruct: string
data SomeStruct:
a: string
-- service SomeStruct("ss"):
-- a() -> string
func foo() -> string:
<- "I am MyFooBar foo"

View File

@ -1,3 +1,5 @@
aqua One
service OneMore:
more_call()
consume(s: string)

View File

@ -1,18 +1,7 @@
service Peer("peer"):
hodes: -> []string
timeout: i32, string -> string
aqua B declares timeout, someString
func test_timeout() -> string:
on HOST_PEER_ID:
nodes <- Peer.hodes()
results: *string
func timeout() -> string:
<- "hack file"
for node <- nodes par:
on node:
results <<- node
timeout: *string
join results[999]
par join results[123]
<- timeout!
func someString() -> string:
<- "sssss"

View File

@ -1,6 +1,10 @@
service GetStr("multiret-test"):
retStr(s: *string, a: *string)
aqua Import declares someFunc
service GetStr("multiret-test"):
retStr(s: []string, a: []string)
func someFunc() -> string:
<- "some func call"
func foo_wrapper():
GetStr.retStr(nil, nil)

View File

@ -41,11 +41,11 @@ func checkKeepArg() -> []string, []string:
<- a, y
-- failing Aqua code:
service TestService("test-service"):
service TestServiceRestrict("test-service"):
get_records(key: string) -> []string
func append_records(peer: string, srum: *[]string):
srum <- TestService.get_records(peer)
srum <- TestServiceRestrict.get_records(peer)
func retrieve_records(peer: string) -> [][]string:
records: *[]string

View File

@ -1,10 +0,0 @@
service TestService("test-service"):
get_records(key: string) -> []string
func append_records(peer: string, srum: *[]string):
srum <- TestService.get_records(peer)
func retrieve_records(peer: string) -> [][]string:
records: *[]string
append_records(peer, records)
<- records

View File

@ -5,11 +5,11 @@ func some_string() -> string:
<- "some_string_func"
service TestService("test-service"):
service TestServiceRename("test-service"):
get_records(key: string) -> []string
func append_records(peer: string, srum: *[]string):
srum <- TestService.get_records(peer)
srum <- TestServiceRename.get_records(peer)
func retrieve_records(peer: string) -> [][]string:
records: *[]string

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend
object Version {

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend
object Version {

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend.air
import cats.Show
@ -24,6 +40,8 @@ object Keyword {
case object Ap extends Keyword("ap")
case object Fail extends Keyword("fail")
case object Canon extends Keyword("canon")
case object Seq extends Keyword("seq")
@ -46,8 +64,6 @@ object DataView {
case class Variable(name: String) extends DataView
case class Stream(name: String) extends DataView
case class VarLens(name: String, lens: String, isField: Boolean = true) extends DataView {
def append(sublens: String): VarLens = copy(lens = lens + sublens)
}
@ -57,7 +73,6 @@ object DataView {
case InitPeerId "%init_peer_id%"
case LastError "%last_error%"
case Variable(name) name
case Stream(name) name
case VarLens(name, lens, isField)
if (isField) name + ".$" + lens
else name + lens
@ -90,7 +105,12 @@ object Air {
case class Next(label: String) extends Air(Keyword.Next)
case class Fold(iterable: DataView, label: String, instruction: Air, lastNextInstruction: Option[Air]) extends Air(Keyword.Fold)
case class Fold(
iterable: DataView,
label: String,
instruction: Air,
lastNextInstruction: Air
) extends Air(Keyword.Fold)
case class Match(left: DataView, right: DataView, instruction: Air) extends Air(Keyword.Match)
@ -106,46 +126,87 @@ object Air {
case class Call(triplet: Triplet, args: List[DataView], result: Option[String])
extends Air(Keyword.Call)
case class ApStreamMap(key: DataView, op: DataView, result: String) extends Air(Keyword.Ap)
case class Ap(op: DataView, result: String) extends Air(Keyword.Ap)
case class Fail(op: DataView) extends Air(Keyword.Fail)
case class Canon(op: DataView, peerId: DataView, result: String) extends Air(Keyword.Canon)
case class Comment(comment: String, air: Air) extends Air(Keyword.NA)
private def show(depth: Int, air: Air): String = {
def showNext(a: Air) = show(depth + 1, a)
private def showInternal(space: String, sb: StringBuilder, air: Air): Unit = {
val space = " " * depth
def showNext(a: Air): Unit = showInternal(space + " ", sb, a)
air match {
case Air.Comment(c, a) =>
space + "; " + c.replace("\n", "\n" + space + "; ") + "\n" +
show(depth, a)
case _ =>
s"$space(${air.keyword.value}" +
(air match {
case Air.Null ""
case Air.Never ""
case Air.Next(label) s" $label"
case Air.New(item, inst) s" ${item.show}\n${showNext(inst)}$space"
case Air.Fold(iter, label, inst, lastInst)
val l = lastInst.map(a => show(depth + 1, a)).getOrElse("")
s" ${iter.show} $label\n${showNext(inst)}$l$space"
case Air.Match(left, right, inst)
s" ${left.show} ${right.show}\n${showNext(inst)}$space"
case Air.Mismatch(left, right, inst)
s" ${left.show} ${right.show}\n${showNext(inst)}$space"
case Air.Par(l, r) s"\n${showNext(l)}${showNext(r)}$space"
case Air.Seq(l, r) s"\n${showNext(l)}${showNext(r)}$space"
case Air.Xor(l, r) s"\n${showNext(l)}${showNext(r)}$space"
case Air.Call(triplet, args, res)
s" ${triplet.show} [${args.map(_.show).mkString(" ")}]${res.fold("")(" " + _)}"
case Air.Ap(operand, result) s" ${operand.show} $result"
case Air.Canon(operand, peerId, result) s" ${peerId.show} ${operand.show} $result"
case Air.Comment(_, _) => ";; Should not be displayed"
}) + ")\n"
}
sb.append(space)
.append("; ")
.append(c.replace("\n", "\n" + space + "; "))
.append("\n")
showInternal(space, sb, a)
case _ =>
sb.append(s"$space(${air.keyword.value}")
(air match {
case Air.Null
case Air.Never
case Air.Next(label) sb.append(s" $label")
case Air.New(item, inst)
sb.append(s" ${item.show}\n")
showNext(inst)
sb.append(space)
case Air.Fold(iter, label, inst, lastInst)
sb.append(s" ${iter.show} $label\n")
showNext(inst)
showNext(lastInst)
sb.append(space)
case Air.Match(left, right, inst)
sb.append(s" ${left.show} ${right.show}\n")
showNext(inst)
sb.append(space)
case Air.Mismatch(left, right, inst)
sb.append(s" ${left.show} ${right.show}\n")
showNext(inst)
sb.append(space)
case Air.Par(l, r)
sb.append("\n")
showNext(l)
showNext(r)
sb.append(space)
case Air.Seq(l, r)
sb.append("\n")
showNext(l)
showNext(r)
sb.append(space)
case Air.Xor(l, r)
sb.append("\n")
showNext(l)
showNext(r)
sb.append(space)
case Air.Call(triplet, args, res)
sb.append(s" ${triplet.show} [${args.map(_.show).mkString(" ")}]${res.fold("")(" " + _)}")
case Air.Ap(operand, result)
sb.append(s" ${operand.show} $result")
case Air.ApStreamMap(key, operand, result)
sb.append(s" (${key.show} ${operand.show}) $result")
case Air.Fail(operand) => sb.append(s" ${operand.show}")
case Air.Canon(operand, peerId, result)
sb.append(s" ${peerId.show} ${operand.show} $result")
case Air.Comment(_, _) => ";; Should not be displayed"
})
sb.append(")\n")
}
}
private def show(depth: Int, air: Air): String = {
val sb = StringBuilder()
val space = " " * depth
showInternal(space, sb, air)
sb.result()
}
implicit val s: Show[Air] = Show.show(show(0, _))

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend.air
import aqua.backend.{AirFunction, Backend, Generated, Version}

View File

@ -1,9 +1,25 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend.air
import aqua.model.*
import aqua.raw.ops.Call
import aqua.res.*
import aqua.types.{ArrayType, CanonStreamType, StreamType}
import aqua.types.{ArrayType, CanonStreamMapType, CanonStreamType, StreamMapType, StreamType, Type}
import cats.Eval
import cats.data.Chain
import cats.free.Cofree
@ -26,14 +42,19 @@ object AirGen extends Logging {
s".[$idx]${propertyToString(tail)}"
}
def varNameToString(name: String, `type`: Type): String =
(`type` match {
case _: StreamType => "$" + name
case _: CanonStreamType => "#$" + name
case _: CanonStreamMapType => "#%" + name
case _: StreamMapType => "%" + name
case _ => name
}).replace('.', '_')
def valueToData(vm: ValueModel): DataView = vm match {
case LiteralModel(value, _) => DataView.StringScalar(value)
case VarModel(name, t, property) =>
val n = (t match {
case _: StreamType => "$" + name
case _: CanonStreamType => "#" + name
case _ => name
}).replace('.', '_')
val n = varNameToString(name, t)
if (property.isEmpty) DataView.Variable(n)
else {
val functors = property.find {
@ -51,10 +72,8 @@ object AirGen extends Logging {
}
def exportToString(exportTo: CallModel.Export): String = (exportTo match {
case CallModel.Export(name, _: StreamType) => "$" + name
case CallModel.Export(name, _: CanonStreamType) => "#" + name
case CallModel.Export(name, _) => name
}).replace('.', '_')
case CallModel.Export(name, t) => varNameToString(name, t)
})
private def folder(op: ResolvedOp, ops: Chain[AirGen]): Eval[AirGen] =
op match {
@ -92,13 +111,13 @@ object AirGen extends Logging {
)
case FoldRes(item, iterable, mode) =>
val m = mode.map {
case ForModel.NullMode => NullGen
case ForModel.NeverMode => NeverGen
val m = mode match {
case FoldRes.Mode.Null => NullGen
case FoldRes.Mode.Never => NeverGen
}
Eval later ForGen(valueToData(iterable), item, opsToSingle(ops), m)
case RestrictionRes(item, isStream) =>
Eval later NewGen(item, isStream, opsToSingle(ops))
case RestrictionRes(item, itemType) =>
Eval later NewGen(varNameToString(item, itemType), opsToSingle(ops))
case CallServiceRes(serviceId, funcName, CallRes(args, exportTo), peerId) =>
Eval.later(
ServiceCallGen(
@ -110,11 +129,20 @@ object AirGen extends Logging {
)
)
case ApStreamMapRes(key, value, exportTo) =>
Eval.later(
ApStreamMapGen(valueToData(key), valueToData(value), exportToString(exportTo))
)
case ApRes(operand, exportTo) =>
Eval.later(
ApGen(valueToData(operand), exportToString(exportTo))
)
case FailRes(operand) =>
Eval.later(
FailGen(valueToData(operand))
)
case CanonRes(operand, peerId, exportTo) =>
Eval.later(
CanonGen(valueToData(operand), valueToData(peerId), exportToString(exportTo))
@ -155,12 +183,24 @@ case class CommentGen(comment: String, op: AirGen) extends AirGen {
Air.Comment(comment, op.generate)
}
case class ApStreamMapGen(key: DataView, operand: DataView, result: String) extends AirGen {
override def generate: Air =
Air.ApStreamMap(key, operand, result)
}
case class ApGen(operand: DataView, result: String) extends AirGen {
override def generate: Air =
Air.Ap(operand, result)
}
case class FailGen(operand: DataView) extends AirGen {
override def generate: Air =
Air.Fail(operand)
}
case class CanonGen(operand: DataView, peerId: DataView, result: String) extends AirGen {
override def generate: Air =
@ -179,14 +219,16 @@ case class MatchMismatchGen(
else Air.Mismatch(left, right, body.generate)
}
case class ForGen(iterable: DataView, item: String, body: AirGen, mode: Option[AirGen]) extends AirGen {
override def generate: Air = Air.Fold(iterable, item, body.generate, mode.map(_.generate))
case class ForGen(iterable: DataView, item: String, body: AirGen, mode: AirGen) extends AirGen {
override def generate: Air = Air.Fold(iterable, item, body.generate, mode.generate)
}
case class NewGen(item: String, isStream: Boolean, body: AirGen) extends AirGen {
case class NewGen(name: String, body: AirGen) extends AirGen {
override def generate: Air =
Air.New(if (isStream) DataView.Stream("$" + item) else DataView.Variable(item), body.generate)
override def generate: Air = Air.New(
DataView.Variable(name),
body.generate
)
}
case class NextGen(item: String) extends AirGen {

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend.air
import aqua.res.FuncRes

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend.api
import aqua.backend.air.AirBackend

View File

@ -1,12 +1,28 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.definitions
import aqua.definitions.*
import aqua.res.FuncRes
import aqua.types.*
import aqua.definitions.*
import io.circe.*
import io.circe.parser.*
import io.circe.syntax.*
import scala.annotation.tailrec
// Represents the Aqua types
@ -16,7 +32,7 @@ sealed trait TypeDefinition {
object TypeDefinition {
implicit val encodeProdDefType: Encoder[ProductTypeDef] = {
given Encoder[ProductTypeDef] = {
case d @ LabeledProductTypeDef(fields) =>
Json.obj(
("tag", Json.fromString(d.tag)),
@ -33,7 +49,7 @@ object TypeDefinition {
)
}
implicit val encodeDefType: Encoder[TypeDefinition] = {
given Encoder[TypeDefinition] = {
case d @ ScalarTypeDef(name) =>
Json.obj(
("tag", Json.fromString(d.tag)),
@ -68,14 +84,14 @@ object TypeDefinition {
)
}
implicit val encodeServiceDefType: Encoder[ServiceDef] = { case ServiceDef(sId, functions, name) =>
given Encoder[ServiceDef] = { case ServiceDef(sId, functions, name) =>
Json.obj(
("defaultServiceId", sId.asJson),
("functions", encodeProdDefType(functions))
("functions", (functions: ProductTypeDef).asJson)
)
}
implicit val encodeNamesConfig: Encoder[NamesConfig] = { case n: NamesConfig =>
given Encoder[NamesConfig] = { case n: NamesConfig =>
import n.*
Json.obj(
("relay", Json.fromString(relay)),
@ -88,13 +104,12 @@ object TypeDefinition {
)
}
implicit val encodeFunctionDefType: Encoder[FunctionDef] = {
case FunctionDef(fName, arrow, names) =>
Json.obj(
("functionName", Json.fromString(fName)),
("arrow", encodeDefType(arrow)),
("names", names.asJson)
)
given Encoder[FunctionDef] = { case FunctionDef(fName, arrow, names) =>
Json.obj(
("functionName", Json.fromString(fName)),
("arrow", (arrow: TypeDefinition).asJson),
("names", names.asJson)
)
}
def apply(t: Option[Type]): TypeDefinition = t.map(apply).getOrElse(NilTypeDef)
@ -103,9 +118,12 @@ object TypeDefinition {
t match {
case OptionType(t) =>
OptionTypeDef(TypeDefinition(t))
case t: BoxType => ArrayTypeDef(TypeDefinition(t.element))
case t: CollectionType => ArrayTypeDef(TypeDefinition(t.element))
case StructType(name, fields) =>
StructTypeDef(name, fields.toSortedMap.view.mapValues(TypeDefinition.apply).toMap)
case AbilityType(name, fieldAndArrows) =>
// TODO: change in union with JS side
StructTypeDef(name, fieldAndArrows.toSortedMap.view.mapValues(TypeDefinition.apply).toMap)
case t: ScalarType => ScalarTypeDef.fromScalar(t)
case t: LiteralType => ScalarTypeDef.fromLiteral(t)
case t: ProductType => ProductTypeDef(t)
@ -195,7 +213,11 @@ case class NamesConfig(
)
// Describes service
case class ServiceDef(defaultServiceId: Option[String], functions: LabeledProductTypeDef, name: String)
case class ServiceDef(
defaultServiceId: Option[String],
functions: LabeledProductTypeDef,
name: String
)
// Describes top-level function
case class FunctionDef(

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend
import aqua.definitions.FunctionDef

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend
import aqua.model.AquaContext

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend
import aqua.definitions.ServiceDef

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend
object Header {
@ -21,13 +37,13 @@ object Header {
val callParams =
if (isJs) ""
else
"import type { IFluenceClient as IFluenceClient$$, CallParams as CallParams$$ } from '@fluencelabs/js-client.api';"
"import type { IFluenceClient as IFluenceClient$$, CallParams as CallParams$$ } from '@fluencelabs/js-client';"
s"""$callParams
|import {
| v5_callFunction as callFunction$$$$,
| v5_registerService as registerService$$$$,
|} from '@fluencelabs/js-client.api';
|} from '@fluencelabs/js-client';
""".stripMargin
}

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend
import aqua.backend.ts.{TSFuncTypes, TSServiceTypes}

View File

@ -1,10 +1,29 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend
import aqua.backend.air.FuncAirGen
import aqua.backend.ts.TypeScriptCommon.fixupArgName
import aqua.backend.ts.{TSFuncTypes, TypeScriptCommon}
import aqua.definitions.*
import aqua.definitions.TypeDefinition.given
import aqua.res.FuncRes
import aqua.types.*
import cats.syntax.show.*
import io.circe.*
import io.circe.parser.*
@ -20,8 +39,6 @@ case class OutputFunc(func: FuncRes, types: Types) {
val funcTypes = types.funcType(func)
import funcTypes.*
import aqua.definitions.TypeDefinition.*
import aqua.definitions.*
def generate: (AirFunction, String) = {
val tsAir = FuncAirGen(func).generate

View File

@ -1,8 +1,27 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend
import aqua.backend.ts.TypeScriptCommon
import aqua.definitions.*
import aqua.definitions.TypeDefinition.given
import aqua.res.ServiceRes
import aqua.types.ArrowType
import io.circe.*
import io.circe.parser.*
import io.circe.syntax.*
@ -14,8 +33,6 @@ case class OutputService(srv: ServiceRes, types: Types) {
private val serviceTypes = types.serviceType(srv)
import serviceTypes.*
import aqua.definitions.TypeDefinition.*
import aqua.definitions.*
def generate: String =
val functions = LabeledProductTypeDef(

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend
import aqua.backend.ts.{TSFuncTypes, TSServiceTypes}

View File

@ -1,13 +1,26 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend.js
import aqua.backend.ts.TypeScriptTypes
import aqua.backend.*
import aqua.res.AquaRes
case class JavaScriptBackend(isOldFluenceJs: Boolean, client: String = Backend.client) extends Backend {
val ext = ".js"
val tsExt = ".d.ts"
case class JavaScriptBackend(isOldFluenceJs: Boolean = false, client: String = Backend.client) extends Backend {
val types = TypeScriptTypes(client)
def typesFile(res: AquaRes): Generated = {
@ -31,13 +44,18 @@ case class JavaScriptBackend(isOldFluenceJs: Boolean, client: String = Backend.c
|
|/* eslint-enable */""".stripMargin
Generated(tsExt, body, Nil)
Generated(JavaScriptBackend.dtsExt, body, Nil)
}
override def generate(res: AquaRes): Seq[Generated] =
if (res.isEmpty) Nil
else {
val (airs, script) = OutputFile(res).generate(EmptyTypes, true, isOldFluenceJs)
Generated(ext, script, airs) :: typesFile(res) :: Nil
Generated(JavaScriptBackend.ext, script, airs) :: typesFile(res) :: Nil
}
}
object JavaScriptBackend {
val ext = ".js"
val dtsExt = ".d.ts"
}

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend.ts
import aqua.backend.FuncTypes

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend.ts
import aqua.backend.ServiceTypes

View File

@ -1,17 +1,35 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend.ts
import aqua.backend.{Backend, Generated, OutputFile}
import aqua.res.AquaRes
import cats.data.NonEmptyChain
case class TypeScriptBackend(isOldFluenceJs: Boolean, client: String = Backend.client) extends Backend {
val ext = ".ts"
case class TypeScriptBackend(isOldFluenceJs: Boolean = false, client: String = Backend.client) extends Backend {
override def generate(res: AquaRes): Seq[Generated] =
if (res.isEmpty) Nil
else {
val (airs, script) = OutputFile(res).generate(TypeScriptTypes(client), false, isOldFluenceJs)
Generated(ext, script, airs) :: Nil
val (airs, script) = OutputFile(res).generate(TypeScriptTypes(client), isJs = false, isOldFluenceJs)
Generated(TypeScriptBackend.ext, script, airs) :: Nil
}
}
object TypeScriptBackend {
val ext = ".ts"
}

View File

@ -1,6 +1,21 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend.ts
import aqua.backend.air.FuncAirGen
import aqua.res.FuncRes
import aqua.types.*
import cats.syntax.show.*
@ -36,14 +51,30 @@ object TypeScriptCommon {
"[" + pt.toList.map(typeToTs).mkString(", ") + "]"
case st: StructType =>
s"{ ${st.fields.map(typeToTs).toNel.map(kv => kv._1 + ": " + kv._2 + ";").toList.mkString(" ")} }"
case st: ScalarType if ScalarType.number(st) => "number"
case ScalarType.bool => "boolean"
case ScalarType.string => "string"
case lt: LiteralType if lt.oneOf.exists(ScalarType.number) => "number"
case lt: LiteralType if lt.oneOf(ScalarType.bool) => "boolean"
case lt: LiteralType if lt.oneOf(ScalarType.string) => "string"
case _: DataType => "any"
case st: AbilityType =>
s"{ ${st.fields.map(typeToTs).toNel.map(kv => kv._1 + ": " + kv._2 + ";").toList.mkString(" ")} }"
case st: ScalarType => st match {
case st: ScalarType if ScalarType.number(st) => "number"
case ScalarType.bool => "boolean"
case ScalarType.string => "string"
// unreachable
case _ => "any"
}
case lt: LiteralType => lt match {
case lt: LiteralType if lt.oneOf.exists(ScalarType.number) => "number"
case lt: LiteralType if lt.oneOf(ScalarType.bool) => "boolean"
case lt: LiteralType if lt.oneOf(ScalarType.string) => "string"
// unreachable
case _ => "any"
}
case at: ArrowType => fnDef(at)
case TopType => "any"
case BottomType => "nothing"
// impossible. Made to avoid compilation warning
case _: CanonStreamType => "any"
case _: StreamMapType => "any"
case _: ServiceType => "any"
}
// TODO: handle cases if there is already peer_ or config_ variable defined

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Fluence DAO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aqua.backend.ts
import aqua.backend.{FuncTypes, ServiceTypes, Types}

278
build.sbt
View File

@ -1,30 +1,55 @@
val dottyVersion = "3.3.0"
import BundleJS.*
scalaVersion := dottyVersion
val aquaVersion = "0.14.11"
val aquaVersion = "0.11.1"
val catsV = "2.8.0"
val catsParseV = "0.3.8"
val scalaV = "3.4.2"
val catsV = "2.12.0"
val catsParseV = "0.3.10"
val monocleV = "3.1.0"
val scalaTestV = "3.2.16"
val fs2V = "3.7.0"
val scalaTestV = "3.2.19"
val scalaTestScalaCheckV = "3.2.18.0"
val sourcecodeV = "0.4.2"
// Snapshot is used to get latest fixes
val fs2V = "3.10.2"
val catsEffectV = "3.6-1f95fd7"
val declineV = "2.3.0"
val circeVersion = "0.14.2"
val scribeV = "3.7.1"
val scribeV = "3.13.0"
name := "aqua-hll"
val commons = Seq(
val orgName = "Fluence DAO"
val licenseStartYear = 2024
val licenseName = "AGPL-3.0-only"
val licenseUrl = "https://www.gnu.org/licenses/agpl-3.0.txt"
val license = HeaderLicense.AGPLv3Only(
yyyy = licenseStartYear.toString,
copyrightOwner = orgName,
licenseStyle = HeaderLicenseStyle.Detailed
)
val licenseSettings = Seq(
organizationName := orgName,
startYear := Some(licenseStartYear),
licenses += (licenseName, new URI(licenseUrl).toURL()),
headerLicense := Some(license)
)
licenseSettings
val commons = licenseSettings ++ Seq(
version := {
val aquaSnapshot = sys.env.getOrElse("SNAPSHOT", "")
if (aquaSnapshot.isEmpty()) aquaVersion else aquaVersion + "-" + aquaSnapshot,
},
scalaVersion := dottyVersion,
scalaVersion := scalaV,
libraryDependencies ++= Seq(
"com.outr" %%% "scribe" % scribeV,
"org.scalatest" %%% "scalatest" % scalaTestV % Test
"com.outr" %%% "scribe" % scribeV,
"dev.optics" %%% "monocle-core" % monocleV,
"dev.optics" %%% "monocle-macro" % monocleV,
"org.scalatest" %%% "scalatest" % scalaTestV % Test,
"org.scalatestplus" %%% "scalacheck-1-17" % scalaTestScalaCheckV % Test
),
scalacOptions ++= {
Seq(
@ -36,123 +61,106 @@ val commons = Seq(
"-Ykind-projector"
// "-Xfatal-warnings"
)
}
},
// Needed to resolve snapshot versions
resolvers ++= Resolver.sonatypeOssRepos("snapshots")
)
commons
lazy val cli = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("cli/cli"))
.enablePlugins(GraalVMNativeImagePlugin)
.settings(commons: _*)
.settings(
Compile / mainClass := Some("aqua.AquaCli"),
graalVMNativeImageOptions ++= Seq(
"--no-fallback",
"--diagnostics-mode",
"--initialize-at-build-time",
"--initialize-at-run-time=scala.util.Random$",
"-H:-DeleteLocalSymbols",
"-H:+PreserveFramePointer",
"-H:+ReportExceptionStackTraces",
"-H:+DashboardHeap",
"-H:+DashboardCode",
"-H:+DashboardPointsTo",
"-H:+DashboardAll"
) ++ sys.env
.get("COMPILE_STATIC")
.filter(_.trim.toLowerCase() == "true")
.map(_ => Seq("--static"))
.getOrElse(Seq.empty),
libraryDependencies ++= Seq(
"com.monovore" %%% "decline" % declineV,
"com.monovore" %%% "decline-effect" % declineV
)
)
.dependsOn(compiler, `backend-air`, `backend-ts`, io, definitions, logging, constants, `aqua-run`)
lazy val cliJS = cli.js
.settings(
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.ESModule)),
scalaJSUseMainModuleInitializer := true
)
.dependsOn(`js-exports`, `js-imports`)
lazy val cliJVM = cli.jvm
.settings(
Compile / run / mainClass := Some("aqua.AquaCli"),
assembly / mainClass := Some("aqua.AquaCli"),
assembly / assemblyJarName := "aqua-" + version.value + ".jar",
libraryDependencies ++= Seq(
)
)
lazy val `aqua-run` = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("aqua-run"))
.settings(commons: _*)
.settings(commons)
.dependsOn(compiler, `backend-air`, `backend-ts`, io, definitions, logging, constants)
.enablePlugins(AutomateHeaderPlugin)
lazy val io = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.settings(commons: _*)
.settings(commons)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-effect" % catsEffectV,
"co.fs2" %%% "fs2-io" % fs2V
)
)
.dependsOn(compiler, parser)
.dependsOn(compiler, parser, helpers)
.enablePlugins(AutomateHeaderPlugin)
lazy val ioJS = io.js.dependsOn(`js-imports`)
lazy val ioJS = io.js
.settings(licenseSettings)
.settings(
scalaJSLinkerConfig ~= (
_.withModuleKind(ModuleKind.CommonJSModule)
.withJSHeader(s"/*${license.text}*/\n")
)
)
.dependsOn(`js-imports`)
.enablePlugins(AutomateHeaderPlugin)
lazy val `language-server-api` = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("language-server/language-server-api"))
.settings(commons: _*)
.settings(commons)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-effect" % catsEffectV,
"co.fs2" %%% "fs2-io" % fs2V
)
)
.dependsOn(compiler, io)
.dependsOn(compiler, io, compiler % "test->test")
.enablePlugins(AutomateHeaderPlugin)
lazy val `language-server-apiJS` = `language-server-api`.js
.settings(licenseSettings)
.settings(
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)),
scalaJSUseMainModuleInitializer := true
scalaJSLinkerConfig ~= (
_.withModuleKind(ModuleKind.CommonJSModule)
.withJSHeader(s"/*${license.text}*/\n")
),
scalaJSUseMainModuleInitializer := false
)
.settings(addBundleJS("../../language-server-npm/aqua-lsp-api.js"))
.enablePlugins(ScalaJSPlugin)
.dependsOn(`js-exports`, `js-imports`)
.enablePlugins(AutomateHeaderPlugin)
lazy val `js-exports` = project
.in(file("js/js-exports"))
.enablePlugins(ScalaJSPlugin)
.settings(commons: _*)
.settings(commons)
.dependsOn(`backend`.js, definitions.js)
.enablePlugins(AutomateHeaderPlugin)
lazy val `js-imports` = project
.in(file("js/js-imports"))
.enablePlugins(ScalaJSPlugin)
.settings(commons: _*)
.settings(commons)
.dependsOn(`js-exports`, transform.js)
lazy val `aqua-api` = project
.in(file("api/aqua-api"))
.enablePlugins(ScalaJSPlugin)
.settings(commons: _*)
lazy val `aqua-api` = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("api/api"))
.settings(commons)
.dependsOn(`aqua-run`, `backend-api`)
.enablePlugins(AutomateHeaderPlugin)
lazy val `aqua-apiJS` = `aqua-api`.js
.settings(licenseSettings)
.settings(
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)),
scalaJSLinkerConfig ~= (
_.withModuleKind(ModuleKind.ESModule)
.withJSHeader(s"/*${license.text}*/\n")
),
scalaJSUseMainModuleInitializer := true,
Test / test := {}
)
.dependsOn(`js-exports`, `aqua-run`.js, `backend-api`.js)
.settings(addBundleJS("../../api-npm/aqua-api.js"))
.enablePlugins(ScalaJSPlugin)
.dependsOn(`js-exports`)
.enablePlugins(AutomateHeaderPlugin)
lazy val types = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
@ -163,106 +171,114 @@ lazy val types = crossProject(JVMPlatform, JSPlatform)
"org.typelevel" %%% "cats-core" % catsV
)
)
.dependsOn(errors)
.enablePlugins(AutomateHeaderPlugin)
lazy val parser = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.settings(commons: _*)
.settings(commons)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-parse" % catsParseV,
"org.typelevel" %%% "cats-free" % catsV
)
)
.dependsOn(types)
.dependsOn(types, helpers)
.enablePlugins(AutomateHeaderPlugin)
lazy val linker = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.settings(commons: _*)
.settings(commons)
.dependsOn(parser)
.enablePlugins(AutomateHeaderPlugin)
lazy val tree = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("model/tree"))
.settings(commons: _*)
.settings(commons)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-free" % catsV
)
)
.dependsOn(helpers)
.enablePlugins(AutomateHeaderPlugin)
lazy val raw = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("model/raw"))
.settings(commons: _*)
.settings(commons)
.dependsOn(types, tree)
.enablePlugins(AutomateHeaderPlugin)
lazy val model = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.settings(commons: _*)
.dependsOn(types, tree, raw)
.settings(commons)
.dependsOn(types, tree, raw, helpers, errors)
.enablePlugins(AutomateHeaderPlugin)
lazy val res = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("model/res"))
.settings(commons: _*)
.settings(commons)
.dependsOn(model)
.enablePlugins(AutomateHeaderPlugin)
lazy val inline = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("model/inline"))
.settings(commons: _*)
.dependsOn(raw, model)
.settings(commons)
.dependsOn(raw, model, mangler)
.enablePlugins(AutomateHeaderPlugin)
lazy val transform = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("model/transform"))
.settings(commons: _*)
.dependsOn(model, res, inline)
.settings(commons)
.dependsOn(model, res, inline, res % "test->test")
.enablePlugins(AutomateHeaderPlugin)
lazy val semantics = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.settings(commons: _*)
.settings(
libraryDependencies ++= Seq(
"dev.optics" %%% "monocle-core" % monocleV,
"dev.optics" %%% "monocle-macro" % monocleV
)
)
.dependsOn(raw, parser)
.settings(commons)
.dependsOn(raw, parser, errors, mangler)
.enablePlugins(AutomateHeaderPlugin)
lazy val compiler = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("compiler"))
.settings(commons: _*)
.dependsOn(semantics, linker, backend, transform % Test)
.settings(commons)
.dependsOn(semantics, linker, backend, transform % "test->test", res % "test->test")
.enablePlugins(AutomateHeaderPlugin)
lazy val backend = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("backend"))
.settings(commons: _*)
.settings(commons)
.enablePlugins(BuildInfoPlugin)
.settings(
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "aqua.backend"
)
.dependsOn(res, definitions)
.enablePlugins(AutomateHeaderPlugin)
lazy val definitions = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("backend/definitions"))
.settings(commons: _*)
.settings(commons)
.settings(
libraryDependencies ++= Seq(
"io.circe" %%% "circe-core",
@ -271,49 +287,92 @@ lazy val definitions = crossProject(JVMPlatform, JSPlatform)
).map(_ % circeVersion)
)
.dependsOn(res, types)
.enablePlugins(AutomateHeaderPlugin)
lazy val logging = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("utils/logging"))
.settings(commons: _*)
.settings(commons)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % catsV
)
)
.enablePlugins(AutomateHeaderPlugin)
lazy val mangler = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("utils/mangler"))
.settings(commons)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % catsV
)
)
.enablePlugins(AutomateHeaderPlugin)
lazy val constants = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("utils/constants"))
.settings(commons: _*)
.settings(commons)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % catsV
)
)
.dependsOn(parser, raw)
.enablePlugins(AutomateHeaderPlugin)
lazy val helpers = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("utils/helpers"))
.settings(commons)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % catsV,
"org.typelevel" %%% "cats-free" % catsV
)
)
.dependsOn(errors)
.enablePlugins(AutomateHeaderPlugin)
lazy val errors = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("utils/errors"))
.settings(commons)
.settings(
libraryDependencies ++= Seq(
"com.lihaoyi" %%% "sourcecode" % sourcecodeV
)
)
.enablePlugins(AutomateHeaderPlugin)
lazy val `backend-air` = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("backend/air"))
.settings(commons: _*)
.settings(commons)
.dependsOn(backend, transform)
.enablePlugins(AutomateHeaderPlugin)
lazy val `backend-api` = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("backend/api"))
.settings(commons: _*)
.settings(commons)
.dependsOn(backend, transform, `backend-air`)
.enablePlugins(AutomateHeaderPlugin)
lazy val `backend-ts` = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("backend/ts"))
.settings(commons: _*)
.settings(commons)
.settings(
libraryDependencies ++= Seq(
"io.circe" %%% "circe-core",
@ -322,3 +381,4 @@ lazy val `backend-ts` = crossProject(JVMPlatform, JSPlatform)
).map(_ % circeVersion)
)
.dependsOn(`backend-air`, definitions)
.enablePlugins(AutomateHeaderPlugin)

171
ci.cjs Normal file
View File

@ -0,0 +1,171 @@
#! /usr/bin/env node
const fs = require("fs").promises;
const path = require("path");
function printUsage() {
console.log(
`Usage: "ci check-consistency" or "ci bump-version %postfix%" or "ci get-version"`
);
}
let postfix;
const mode = process.argv[2];
function validateArgs() {
switch (mode) {
case "get-version":
return true;
case "bump-version":
postfix = process.argv[3];
if (!postfix) {
printUsage();
process.exit();
}
return true;
case "":
case undefined:
case "check-consistency":
return true;
default:
return false;
}
}
const PATHS_TO_PACKAGES = [
"./api/api-npm",
"./language-server/language-server-npm",
"./integration-tests"
];
async function getPackageJsonsRecursive(currentPath) {
return (
await Promise.all(
(await fs.readdir(currentPath, { withFileTypes: true }))
.filter(
(file) =>
file.name !== "node_modules" && file.name !== "@tests" &&
(file.isDirectory() || file.name === "package.json")
)
.map((file) =>
file.isDirectory()
? getPackageJsonsRecursive(
path.join(currentPath, file.name)
)
: Promise.resolve([
path.join(process.cwd(), currentPath, file.name),
])
)
)
).flat();
}
async function getVersion(file) {
const content = await fs.readFile(file);
const json = JSON.parse(content);
return [json.name, json.version];
}
function processDep(obj, name, fn) {
if (!obj) {
return;
}
if (!obj[name]) {
return;
}
fn(obj, obj[name]);
}
async function getVersionsMap(allPackageJsons) {
return new Map(await Promise.all(allPackageJsons.map(getVersion)));
}
function getVersionForPackageOrThrow(versionsMap, packageName) {
const version = versionsMap.get(packageName);
if (!version) {
console.log("Failed to get version for package: ", packageName);
process.exit(1);
}
return version;
}
async function checkConsistency(file, versionsMap) {
console.log("Checking: ", file);
const content = await fs.readFile(file);
const json = JSON.parse(content);
for (const [name, versionInDep] of versionsMap) {
const check = (x, version) => {
if (version.includes("*")) {
return;
}
if (versionInDep !== version) {
console.log(
`Error, versions don't match: ${name}:${version} !== ${versionInDep}`,
file
);
process.exit(1);
}
};
processDep(json.dependencies, name, check);
processDep(json.devDependencies, name, check);
}
}
async function bumpVersions(file, versionsMap) {
console.log("Updating: ", file);
const content = await fs.readFile(file);
const json = JSON.parse(content);
for (const [name, version] of versionsMap) {
const update = (x) => (x[name] = `${version}-${postfix}`);
processDep(json.dependencies, name, update);
processDep(json.devDependencies, name, update);
}
const version = getVersionForPackageOrThrow(versionsMap, json.name);
json.version = `${version}-${postfix}`;
const newContent = JSON.stringify(json, undefined, 4) + "\n";
await fs.writeFile(file, newContent);
}
async function processPackageJsons(allPackageJsons, versionsMap, fn) {
await Promise.all(allPackageJsons.map((x) => fn(x, versionsMap)));
}
async function run() {
if (!validateArgs()) {
printUsage();
process.exit(0);
}
const packageJsons = (
await Promise.all(PATHS_TO_PACKAGES.map(getPackageJsonsRecursive))
).flat();
const versionsMap = await getVersionsMap(packageJsons);
if (mode === "get-version") {
const fjs = versionsMap.get("@fluencelabs/fluence");
console.log(fjs);
return;
}
console.log("Checking versions consistency...");
await processPackageJsons(packageJsons, versionsMap, checkConsistency);
console.log("Versions are consistent");
if (mode === "bump-version") {
console.log("Adding postfix: ", postfix);
await processPackageJsons(packageJsons, versionsMap, bumpVersions);
console.log("Done");
}
}
run();

View File

@ -1,3 +0,0 @@
*.jar
*.tgz
node_modules

View File

@ -1,45 +0,0 @@
## Installation
- run `sbt "cliJS/fullLinkJS"` in a root dir of a project after any code update (better to keep `sbt` running for faster compilation)
- `npm` installed required
- run `npm i` in `npm` directory
- feel free to change `@fluencelabs/fluence` version in `package.json` file, run `npm i` after changes
## Run script
Generally, use this script to run compiled aqua compiler from a repo:
```
npm run from:scalajs -- run -f "someFunction(arg1, arg2)" -i path/to/aqua --data-path path/to/args -m path/to/exports --addr /multiaddr/to/node
```
- `-f or --func` is a function to call with arguments
- `-i or --input` aqua file where function located
- `-m or --import` imports location, could be used multiple times
- `-a or --addr` multiaddress to a Fluence node
- `-p or --data-path` path to a file with JSON where arguments are located
As example, use `test/sample.aqua` with args from `test/data.json` running on `/dns4/kras-04.fluence.dev/tcp/19001/wss/p2p/12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi` node:
```
npm run from:scalajs -- run -f "identityArgsAndReturn(structField, stringField, numberField)" -i test/sample.aqua --data-path test/data.json --addr /dns4/kras-04.fluence.dev/tcp/19001/wss/p2p/12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi
```
To simplify experience you can use `./aqua-run.sh` command and change all arguments straight in this file.
## Node addresses
Different Fluence network addresses could be found here: https://github.com/fluencelabs/fluence-network-environment/blob/main/src/index.ts
## Useful flags
- `--print-air` to print resulted air
- `--no-xor` to disable xor wrapping aroung service calls
- `--sk secret_key` send request signed with specific secret key. Secret key could be created with `npm run from:scalajs -- create_keypair` or `aqua create_keypair` if you want to use installed aqua
- `--data "json""` use instead of `--data-path` to pass arguments through command line
- `--timeout 10000` to change timeout
- `--log-level debug/info/..` to change log level
## Builtins for `aqua run`
You can find all builtins in aqua/run-builtins/run-builtins.aqua

View File

@ -1,14 +0,0 @@
#!/bin/bash
FUNC='deploy(tsOracle)'
INPUT='aqua/dist.aqua'
DATAPATH='test/deploy.json'
ADDR='/dns4/kras-04.fluence.dev/tcp/19001/wss/p2p/12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi'
# IMPORT=
if [ -z "$IMPORT" ]
then
npm run from:scalajs -- run -f "$FUNC" -i "$INPUT" --data-path "$DATAPATH" --addr "$ADDR"
else
npm run from:scalajs -- run -f "$FUNC" -i "$INPUT" --data-path "$DATAPATH" --addr "$ADDR" -m "$IMPORT"
fi

View File

@ -1,96 +0,0 @@
module ServiceDist declares *
import "run-builtins/run-builtins.aqua"
import "@fluencelabs/aqua-lib/builtin.aqua"
import "@fluencelabs/aqua-ipfs/ipfs.aqua"
export deploy, remove, createService, addBlueprint
data ModuleConf:
name: string
path: string
mounted_binaries: ?[][]string
preopened_files: ?[]string
mapped_dirs: ?[][]string
envs: ?[][]string
logger_enabled: ?bool
logging_mask: ?i32
mem_pages_count: ?u32
max_heap_size: ?string
service OpC("op"):
array_length(arr: []ModuleConf) -> u32
data DeployResult:
blueprint_id: string
service_id: string
service DeployHelper("deploy_helper"):
create_result(bid: string, sid: string) -> DeployResult
data ServiceConf:
modules: []ModuleConf
const ON_PEER ?= HOST_PEER_ID
func flattenSS(input: [][]string) -> ?[][]string:
res: *[][]string
res <<- input
<- res
func flattenS(input: []string) -> ?[]string:
res: *[]string
res <<- input
<- res
func deploy(serviceName: string, serviceConf: ServiceConf) -> DeployResult:
on ON_PEER:
multiaddr <- Ipfs.get_external_api_multiaddr()
mod_hashes: *[]string
for m <- serviceConf.modules par:
-- TODO check for cache
Console.print(Op.concat_strings("Going to upload module: ", m.name))
uploadRes <- LocalIpfs.uploadFile(m.path, multiaddr)
cid = uploadRes.cid
Console.print(Op.concat_strings(Op.concat_strings("Module '", m.name), "' was uploaded"))
on ON_PEER:
hostRes <- Ipfs.get(cid)
conf <- Dist.make_module_config(m.name, m.mem_pages_count, m.max_heap_size, m.logger_enabled, m.preopened_files, m.envs, m.mapped_dirs, m.mounted_binaries, m.logging_mask)
mod_hash <- Dist.add_module_from_vault(hostRes.path, conf)
mod_hashes <<- [mod_hash, m.name]
join mod_hashes[OpC.array_length(serviceConf.modules) - 1]
-- sort hashes to the same order as was in serviceConf.modules
sorted_hashes: *string
for m <- serviceConf.modules:
for hash_name <- mod_hashes:
if m.name == hash_name[1]:
sorted_hashes <<- hash_name[0]
Console.print("Now time to make the blueprint...")
on ON_PEER:
blueprint <- Dist.make_blueprint(serviceName, sorted_hashes)
blueprint_id <- Dist.add_blueprint(blueprint)
service_id <- Srv.create(blueprint_id)
res <- DeployHelper.create_result(blueprint_id, service_id)
<- res
func remove(service_id: string):
on ON_PEER:
Srv.remove(service_id)
Console.print("Service was deleted")
func createService(blueprint_id: string) -> string:
on ON_PEER:
service_id <- Srv.create(blueprint_id)
<- service_id
func addBlueprint(bp: AddBlueprint) -> string:
on ON_PEER:
blueprint_id <- Dist.add_blueprint(bp)
<- blueprint_id

View File

@ -1,18 +0,0 @@
module IpfsExports
import "@fluencelabs/aqua-ipfs/ipfs-api.aqua"
import "run-builtins/run-builtins.aqua"
export uploadFile
const ON_PEER ?= HOST_PEER_ID
func uploadFile(path: string) -> UploadResult:
on ON_PEER:
multiaddr <- get_external_api_multiaddr(ON_PEER)
result <- LocalIpfs.uploadFile(path, multiaddr)
<- result

View File

@ -1,41 +0,0 @@
module NetworkInfo
import "@fluencelabs/aqua-lib/builtin.aqua"
export list_modules, list_interfaces_by_peer, get_interface, list_blueprints, list_services
const ON_PEER ?= HOST_PEER_ID
func list_modules() -> []Module:
on ON_PEER:
res <- Dist.list_modules()
<- res
func list_services() -> []Service:
on ON_PEER:
services <- Srv.list()
<- services
func list_interfaces_by_peer(peer: PeerId) -> []Interface:
on ON_PEER:
services <- Srv.list()
interfaces: *Interface
for srv <- services:
if srv.owner_id == peer:
interfaces <- Srv.get_interface(srv.id)
<- interfaces
func get_interface(serviceId: string) -> Interface:
on ON_PEER:
res <- Srv.get_interface(serviceId)
<- res
func get_module_interface(moduleHash: string) -> Interface:
on ON_PEER:
res <- Dist.get_module_interface(moduleHash)
<- res
func list_blueprints() -> []Blueprint:
on ON_PEER:
res <- Dist.list_blueprints()
<- res

View File

@ -1,13 +0,0 @@
import "@fluencelabs/aqua-ipfs/ipfs.aqua"
-- printing strings in console
service Console("run-console"):
print(str: string)
data UploadResult:
error: string
cid: string
size: u64
service LocalIpfs("ipfs"):
uploadFile(path: string, multiaddr: IpfsMultiaddrResult) -> UploadResult

View File

@ -1,28 +0,0 @@
module ServiceScript declares *
import "run-builtins/run-builtins.aqua"
import "@fluencelabs/aqua-lib/builtin.aqua"
import "@fluencelabs/aqua-ipfs/ipfs.aqua"
export schedule, remove, list
const ON_PEER ?= HOST_PEER_ID
func schedule(air: string, interval: ?u64) -> string:
on ON_PEER:
res <- Script.add(air, interval)
Console.print("Script was scheduled")
<- res
func remove(script_id: string):
on ON_PEER:
res <- Script.remove(script_id)
if res:
Console.print("Script was removed")
else:
Console.print("No script with such ID")
func list() -> []ScriptInfo:
on ON_PEER:
res <- Script.list()
<- res

View File

@ -1,5 +0,0 @@
#!/usr/bin/env node
"use strict";
console.error("ERROR: use 'aqua' command!")

View File

@ -1,32 +0,0 @@
#!/usr/bin/env node
"use strict";
handleEPIPE(process.stderr)
handleEPIPE(process.stdout)
function handleEPIPE(stream) {
stream.on('error', onerror)
function onerror(err) {
if (err.code === 'EPIPE') {
stream._write = noopWrite
stream._writev = noopWritev
stream._read = noopRead
return stream.removeListener('error', onerror)
}
if (EE.listenerCount(stream, 'error') === 1) {
stream.removeListener('error', onerror)
stream.emit('error', err)
}
}
}
function noopWrite(chunk, enc, cb) {
cb()
}
function noopRead() {
this.push('')
}
function noopWritev(chunks, cb) {
cb()
}
import "./aqua.js";

View File

@ -1,2 +0,0 @@
// It should work in scala as js.`import`.meta.url, but it doesn't compile for some reasons
export const metaUrl = import.meta.url

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More