diff --git a/.gitignore b/.gitignore index c717a2b5..b4625564 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ dist/ go.work go.work.sum _ftl/ +**/_ftl diff --git a/bin/.maven-3.9.6.pkg b/bin/.maven-3.9.6.pkg new file mode 120000 index 00000000..383f4511 --- /dev/null +++ b/bin/.maven-3.9.6.pkg @@ -0,0 +1 @@ +hermit \ No newline at end of file diff --git a/bin/.openjdk-17.0.8_7.pkg b/bin/.openjdk-17.0.8_7.pkg new file mode 120000 index 00000000..383f4511 --- /dev/null +++ b/bin/.openjdk-17.0.8_7.pkg @@ -0,0 +1 @@ +hermit \ No newline at end of file diff --git a/bin/jar b/bin/jar new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jar @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jarsigner b/bin/jarsigner new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jarsigner @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/java b/bin/java new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/java @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/javac b/bin/javac new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/javac @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/javadoc b/bin/javadoc new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/javadoc @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/javap b/bin/javap new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/javap @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jcmd b/bin/jcmd new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jcmd @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jconsole b/bin/jconsole new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jconsole @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jdb b/bin/jdb new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jdb @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jdeprscan b/bin/jdeprscan new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jdeprscan @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jdeps b/bin/jdeps new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jdeps @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jfr b/bin/jfr new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jfr @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jhsdb b/bin/jhsdb new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jhsdb @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jimage b/bin/jimage new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jimage @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jinfo b/bin/jinfo new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jinfo @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jlink b/bin/jlink new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jlink @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jmap b/bin/jmap new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jmap @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jmod b/bin/jmod new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jmod @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jpackage b/bin/jpackage new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jpackage @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jps b/bin/jps new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jps @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jrunscript b/bin/jrunscript new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jrunscript @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jshell b/bin/jshell new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jshell @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jstack b/bin/jstack new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jstack @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jstat b/bin/jstat new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jstat @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/jstatd b/bin/jstatd new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/jstatd @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/keytool b/bin/keytool new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/keytool @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/mvn b/bin/mvn new file mode 120000 index 00000000..50c2105e --- /dev/null +++ b/bin/mvn @@ -0,0 +1 @@ +.maven-3.9.6.pkg \ No newline at end of file diff --git a/bin/mvnDebug b/bin/mvnDebug new file mode 120000 index 00000000..50c2105e --- /dev/null +++ b/bin/mvnDebug @@ -0,0 +1 @@ +.maven-3.9.6.pkg \ No newline at end of file diff --git a/bin/rmiregistry b/bin/rmiregistry new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/rmiregistry @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/bin/serialver b/bin/serialver new file mode 120000 index 00000000..7d19c5ad --- /dev/null +++ b/bin/serialver @@ -0,0 +1 @@ +.openjdk-17.0.8_7.pkg \ No newline at end of file diff --git a/ftl-examples.code-workspace b/ftl-examples.code-workspace index 190ce407..d7c29dfa 100644 --- a/ftl-examples.code-workspace +++ b/ftl-examples.code-workspace @@ -1,5 +1,11 @@ { "folders": [ + { + "path": "go" + }, + { + "path": "kotlin" + }, { "path": "online-boutique/mobile" }, diff --git a/go/http/ftl.toml b/go/http/ftl.toml new file mode 100644 index 00000000..d5ffb153 --- /dev/null +++ b/go/http/ftl.toml @@ -0,0 +1,2 @@ +module = "http" +language = "go" diff --git a/go/http/go.mod b/go/http/go.mod new file mode 100644 index 00000000..d28a22cd --- /dev/null +++ b/go/http/go.mod @@ -0,0 +1,43 @@ +module ftl/http + +go 1.22.0 + +require github.com/TBD54566975/ftl v0.126.0 + +require ( + connectrpc.com/connect v1.14.0 // indirect + connectrpc.com/grpcreflect v1.2.0 // indirect + connectrpc.com/otelconnect v0.7.0 // indirect + github.com/alecthomas/concurrency v0.0.2 // indirect + github.com/alecthomas/participle/v2 v2.1.1 // indirect + github.com/alecthomas/types v0.10.1 // indirect + github.com/alessio/shellescape v1.4.2 // indirect + github.com/danieljoos/wincred v1.2.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/godbus/dbus/v5 v5.1.0 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/pgx/v5 v5.5.3 // indirect + github.com/jackc/puddle/v2 v2.2.1 // indirect + github.com/jpillora/backoff v1.0.0 // indirect + github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/oklog/ulid/v2 v2.1.0 // indirect + github.com/swaggest/jsonschema-go v0.3.64 // indirect + github.com/swaggest/refl v1.3.0 // indirect + github.com/zalando/go-keyring v0.2.3 // indirect + go.opentelemetry.io/otel v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/trace v1.23.1 // indirect + golang.design/x/reflect v0.0.0-20220504060917-02c43be63f3b // indirect + golang.org/x/crypto v0.19.0 // indirect + golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 // indirect + golang.org/x/mod v0.15.0 // indirect + golang.org/x/net v0.21.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.17.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect +) diff --git a/go/http/go.sum b/go/http/go.sum new file mode 100644 index 00000000..85eae5d8 --- /dev/null +++ b/go/http/go.sum @@ -0,0 +1,145 @@ +connectrpc.com/connect v1.14.0 h1:PDS+J7uoz5Oui2VEOMcfz6Qft7opQM9hPiKvtGC01pA= +connectrpc.com/connect v1.14.0/go.mod h1:uoAq5bmhhn43TwhaKdGKN/bZcGtzPW1v+ngDTn5u+8s= +connectrpc.com/grpcreflect v1.2.0 h1:Q6og1S7HinmtbEuBvARLNwYmTbhEGRpHDhqrPNlmK+U= +connectrpc.com/grpcreflect v1.2.0/go.mod h1:nwSOKmE8nU5u/CidgHtPYk1PFI3U9ignz7iDMxOYkSY= +connectrpc.com/otelconnect v0.7.0 h1:ZH55ZZtcJOTKWWLy3qmL4Pam4RzRWBJFOqTPyAqCXkY= +connectrpc.com/otelconnect v0.7.0/go.mod h1:Bt2ivBymHZHqxvo4HkJ0EwHuUzQN6k2l0oH+mp/8nwc= +github.com/TBD54566975/ftl v0.126.0 h1:KBrV51p4ZUHSB3qJ21pm5YHdwzGpl6Wrjpy+pJKFCTw= +github.com/TBD54566975/ftl v0.126.0/go.mod h1:Bu14npLonDVivxgmKEsas49qzLOf3yrfB4KrM6Ey4RE= +github.com/alecthomas/assert/v2 v2.5.0 h1:OJKYg53BQx06/bMRBSPDCO49CbCDNiUQXwdoNrt6x5w= +github.com/alecthomas/assert/v2 v2.5.0/go.mod h1:fw5suVxB+wfYJ3291t0hRTqtGzFYdSwstnRQdaQx2DM= +github.com/alecthomas/concurrency v0.0.2 h1:Q3kGPtLbleMbH9lHX5OBFvJygfyFw29bXZKBg+IEVuo= +github.com/alecthomas/concurrency v0.0.2/go.mod h1:GmuQb/iHX7mbNtPlC/WDzEFxDMB0HYFer2Qda9QTs7w= +github.com/alecthomas/participle/v2 v2.1.1 h1:hrjKESvSqGHzRb4yW1ciisFJ4p3MGYih6icjJvbsmV8= +github.com/alecthomas/participle/v2 v2.1.1/go.mod h1:Y1+hAs8DHPmc3YUFzqllV+eSQ9ljPTk0ZkPMtEdAx2c= +github.com/alecthomas/repr v0.3.0 h1:NeYzUPfjjlqHY4KtzgKJiWd6sVq2eNUPTi34PiFGjY8= +github.com/alecthomas/repr v0.3.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= +github.com/alecthomas/types v0.10.1 h1:PuBMoHpFL2jaW3VgPDRhCk1oKoBCzfbsL5sAxEc3U3A= +github.com/alecthomas/types v0.10.1/go.mod h1:fIOGnLeeUJXe1AAVofQmMaEMWLxY9bK4QxTLGIo30PA= +github.com/alessio/shellescape v1.4.2 h1:MHPfaU+ddJ0/bYWpgIeUnQUqKrlJ1S7BfEYPM4uEoM0= +github.com/alessio/shellescape v1.4.2/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= +github.com/bool64/dev v0.2.31 h1:OS57EqYaYe2M/2bw9uhDCIFiZZwywKFS/4qMLN6JUmQ= +github.com/bool64/dev v0.2.31/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg= +github.com/bool64/shared v0.1.5 h1:fp3eUhBsrSjNCQPcSdQqZxxh9bBwrYiZ+zOKFkM0/2E= +github.com/bool64/shared v0.1.5/go.mod h1:081yz68YC9jeFB3+Bbmno2RFWvGKv1lPKkMP6MHJlPs= +github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE= +github.com/danieljoos/wincred v1.2.0/go.mod h1:FzQLLMKBFdvu+osBrnFODiv32YGwCfx0SkRa/eYHgec= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= +github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= +github.com/iancoleman/orderedmap v0.3.0 h1:5cbR2grmZR/DiVt+VJopEhtVs9YGInGIxAoMJn+Ichc= +github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJDkXXS7VoV7XGE= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.5.3 h1:Ces6/M3wbDXYpM8JyyPD57ivTtJACFZJd885pdIaV2s= +github.com/jackc/pgx/v5 v5.5.3/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A= +github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= +github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/oklog/ulid/v2 v2.1.0 h1:+9lhoxAP56we25tyYETBBY1YLA2SaoLvUFgrP2miPJU= +github.com/oklog/ulid/v2 v2.1.0/go.mod h1:rcEKHmBBKfef9DhnvX7y1HZBYxjXb0cP5ExxNsTT1QQ= +github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4= +github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/swaggest/assertjson v1.9.0 h1:dKu0BfJkIxv/xe//mkCrK5yZbs79jL7OVf9Ija7o2xQ= +github.com/swaggest/assertjson v1.9.0/go.mod h1:b+ZKX2VRiUjxfUIal0HDN85W0nHPAYUbYH5WkkSsFsU= +github.com/swaggest/jsonschema-go v0.3.64 h1:HyB41fkA4XP0BZkqWfGap5i2JtRHQGXG/21dGDPbyLM= +github.com/swaggest/jsonschema-go v0.3.64/go.mod h1:DYuKqdpms/edvywsX6p1zHXCZkdwB28wRaBdFCe3Duw= +github.com/swaggest/refl v1.3.0 h1:PEUWIku+ZznYfsoyheF97ypSduvMApYyGkYF3nabS0I= +github.com/swaggest/refl v1.3.0/go.mod h1:3Ujvbmh1pfSbDYjC6JGG7nMgPvpG0ehQL4iNonnLNbg= +github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA= +github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= +github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M= +github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= +github.com/zalando/go-keyring v0.2.3 h1:v9CUu9phlABObO4LPWycf+zwMG7nlbb3t/B5wa97yms= +github.com/zalando/go-keyring v0.2.3/go.mod h1:HL4k+OXQfJUWaMnqyuSOc0drfGPX2b51Du6K+MRgZMk= +go.opentelemetry.io/otel v1.23.1 h1:Za4UzOqJYS+MUczKI320AtqZHZb7EqxO00jAHE0jmQY= +go.opentelemetry.io/otel v1.23.1/go.mod h1:Td0134eafDLcTS4y+zQ26GE8u3dEuRBiBCTUIRHaikA= +go.opentelemetry.io/otel/metric v1.23.1 h1:PQJmqJ9u2QaJLBOELl1cxIdPcpbwzbkjfEyelTl2rlo= +go.opentelemetry.io/otel/metric v1.23.1/go.mod h1:mpG2QPlAfnK8yNhNJAxDZruU9Y1/HubbC+KyH8FaCWI= +go.opentelemetry.io/otel/sdk v1.23.1 h1:O7JmZw0h76if63LQdsBMKQDWNb5oEcOThG9IrxscV+E= +go.opentelemetry.io/otel/sdk v1.23.1/go.mod h1:LzdEVR5am1uKOOwfBWFef2DCi1nu3SA8XQxx2IerWFk= +go.opentelemetry.io/otel/sdk/metric v1.23.1 h1:T9/8WsYg+ZqIpMWwdISVVrlGb/N0Jr1OHjR/alpKwzg= +go.opentelemetry.io/otel/sdk/metric v1.23.1/go.mod h1:8WX6WnNtHCgUruJ4TJ+UssQjMtpxkpX0zveQC8JG/E0= +go.opentelemetry.io/otel/trace v1.23.1 h1:4LrmmEd8AU2rFvU1zegmvqW7+kWarxtNOPyeL6HmYY8= +go.opentelemetry.io/otel/trace v1.23.1/go.mod h1:4IpnpJFwr1mo/6HL8XIPJaE9y0+u1KcVmuW7dwFSVrI= +golang.design/x/reflect v0.0.0-20220504060917-02c43be63f3b h1:lkOPTy76R9NZ6FeDQWkDj3NsLtD8Csc9AAFYEl3kiME= +golang.design/x/reflect v0.0.0-20220504060917-02c43be63f3b/go.mod h1:QXG482h3unP32W/YwIPOc+09bvY447B7T+iLjC/JPcA= +golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 h1:/RIbNt/Zr7rVhIkQhooTxCxFcdWLGIKnZA4IXNFSrvo= +golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= +golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI= +lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= +modernc.org/cc/v3 v3.40.0 h1:P3g79IUS/93SYhtoeaHW+kRCIrYaxJ27MFPv+7kaTOw= +modernc.org/cc/v3 v3.40.0/go.mod h1:/bTg4dnWkSXowUO6ssQKnOV0yMVxDYNIsIrzqTFDGH0= +modernc.org/ccgo/v3 v3.16.13 h1:Mkgdzl46i5F/CNR/Kj80Ri59hC8TKAhZrYSaqvkwzUw= +modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY= +modernc.org/libc v1.29.0 h1:tTFRFq69YKCF2QyGNuRUQxKBm1uZZLubf6Cjh/pVHXs= +modernc.org/libc v1.29.0/go.mod h1:DaG/4Q3LRRdqpiLyP0C2m1B8ZMGkQ+cCgOIjEtQlYhQ= +modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= +modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= +modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E= +modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E= +modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= +modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= +modernc.org/sqlite v1.28.0 h1:Zx+LyDDmXczNnEQdvPuEfcFVA2ZPyaD7UCZDjef3BHQ= +modernc.org/sqlite v1.28.0/go.mod h1:Qxpazz0zH8Z1xCFyi5GSL3FzbtZ3fvbjmywNogldEW0= +modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY= +modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= +modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= +modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= diff --git a/go/http/http.go b/go/http/http.go new file mode 100644 index 00000000..b370c483 --- /dev/null +++ b/go/http/http.go @@ -0,0 +1,108 @@ +//ftl:module http +package http + +import ( + "context" + "fmt" + + "ftl/builtin" // Import the FTL built-in package. + + "github.com/TBD54566975/ftl/go-runtime/ftl" // Import the FTL SDK. +) + +type GetRequest struct { + UserID string `alias:"userId"` + PostID string `alias:"postId"` +} + +type Nested struct { + GoodStuff string `alias:"good_stuff"` +} + +type GetResponse struct { + Message string `alias:"msg"` + Nested Nested `alias:"nested"` +} + +type ErrorResponse struct { + Error string `alias:"error"` +} + +// Example: curl -i http://localhost:8892/ingress/http/users/123/posts?postId=456 +// Error Example: curl -i http://localhost:8892/ingress/http/users/000/posts?postId=456 +// +//ftl:verb +//ftl:ingress http GET /http/users/{userId}/posts +func Get(ctx context.Context, req builtin.HttpRequest[GetRequest]) (builtin.HttpResponse[GetResponse, ErrorResponse], error) { + if req.Body.UserID == "000" { + return builtin.HttpResponse[GetResponse, ErrorResponse]{ + Error: ftl.Some(ErrorResponse{ + Error: "User not found", + }), + }, nil + } + + return builtin.HttpResponse[GetResponse, ErrorResponse]{ + Headers: map[string][]string{"Get": {"Header from FTL"}}, + Body: ftl.Some(GetResponse{ + Message: fmt.Sprintf("Got userId %s and postId %s", req.Body.UserID, req.Body.PostID), + Nested: Nested{GoodStuff: "Nested Good Stuff"}, + }), + }, nil +} + +type PostRequest struct { + UserID int `alias:"user_id"` + PostID int `alias:"post_id"` +} + +type PostResponse struct { + Success bool `alias:"success"` +} + +// Example: curl -i --json '{"user_id": 123, "post_id": 345}' http://localhost:8892/ingress/http/users +// +//ftl:verb +//ftl:ingress http POST /http/users +func Post(ctx context.Context, req builtin.HttpRequest[PostRequest]) (builtin.HttpResponse[PostResponse, ftl.Unit], error) { + return builtin.HttpResponse[PostResponse, ftl.Unit]{ + Status: 201, + Headers: map[string][]string{"Post": {"Header from FTL"}}, + Body: ftl.Some(PostResponse{Success: true}), + }, nil +} + +type PutRequest struct { + UserID string `alias:"userId"` + PostID string `alias:"postId"` +} + +type PutResponse struct{} + +// Example: curl -X PUT http://localhost:8892/ingress/http/users/123 -d '{"postId": "123"}' +// +//ftl:verb +//ftl:ingress http PUT /http/users/{userId} +func Put(ctx context.Context, req builtin.HttpRequest[PutRequest]) (builtin.HttpResponse[PutResponse, ftl.Unit], error) { + return builtin.HttpResponse[PutResponse, ftl.Unit]{ + Headers: map[string][]string{"Put": {"Header from FTL"}}, + Body: ftl.Some(PutResponse{}), + }, nil +} + +type DeleteRequest struct { + UserID string `alias:"userId"` +} + +type DeleteResponse struct{} + +// Example: curl -X DELETE http://localhost:8892/ingress/http/users/123 +// +//ftl:verb +//ftl:ingress http DELETE /http/users/{userId} +func Delete(ctx context.Context, req builtin.HttpRequest[DeleteRequest]) (builtin.HttpResponse[DeleteResponse, ftl.Unit], error) { + return builtin.HttpResponse[DeleteResponse, ftl.Unit]{ + Headers: map[string][]string{"Put": {"Header from FTL"}}, + Body: ftl.Some(DeleteResponse{}), + }, nil +} diff --git a/kotlin/ftl-module-http/ftl.toml b/kotlin/ftl-module-http/ftl.toml new file mode 100644 index 00000000..9c8aeba8 --- /dev/null +++ b/kotlin/ftl-module-http/ftl.toml @@ -0,0 +1,2 @@ +module = "http" +language = "kotlin" diff --git a/kotlin/ftl-module-http/pom.xml b/kotlin/ftl-module-http/pom.xml new file mode 100644 index 00000000..d069c79a --- /dev/null +++ b/kotlin/ftl-module-http/pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + ftl + ftl-module-http + 1.0-SNAPSHOT + + ftl + ftl + 1.0-SNAPSHOT + + + + http + + + + + + kotlin-maven-plugin + org.jetbrains.kotlin + + + org.apache.maven.plugins + maven-dependency-plugin + + + + org.codehaus.mojo + exec-maven-plugin + + + + org.codehaus.mojo + build-helper-maven-plugin + + + + com.github.ozsie + detekt-maven-plugin + + + + \ No newline at end of file diff --git a/kotlin/ftl-module-http/src/main/kotlin/ftl/http/Http.kt b/kotlin/ftl-module-http/src/main/kotlin/ftl/http/Http.kt new file mode 100644 index 00000000..9833e348 --- /dev/null +++ b/kotlin/ftl-module-http/src/main/kotlin/ftl/http/Http.kt @@ -0,0 +1,91 @@ +package ftl.http + +import ftl.builtin.Empty +import ftl.builtin.HttpRequest +import ftl.builtin.HttpResponse +import kotlin.String +import xyz.block.ftl.Alias +import xyz.block.ftl.Context +import xyz.block.ftl.HttpIngress +import xyz.block.ftl.Method +import xyz.block.ftl.Verb + +data class GetRequest( + @Alias("userId") val userID: String, + @Alias("postId") val postID: String, +) + +data class Nested( + @Alias("good_stuff") val goodStuff: String, +) + +data class GetResponse( + @Alias("msg") val message: String, + @Alias("nested") val nested: Nested, +) + +data class PostRequest( + @Alias("user_id") val userId: Int, + @Alias("post_id") val postId: Int, +) + +data class PostResponse( + @Alias("success") val success: Boolean, +) + +data class PutRequest( + @Alias("userId") val userID: String, + @Alias("postId") val postID: String, +) + +data class DeleteRequest( + @Alias("userId") val userID: String, +) + +// Example: curl -i http://localhost:8892/ingress/http/users/123/posts?postId=456 +// Error Example: curl -i http://localhost:8892/ingress/http/users/000/posts?postId=456 +@Verb +@HttpIngress(Method.GET, "/http/users/{userId}/posts") +fun `get`(context: Context, req: HttpRequest): HttpResponse { + return HttpResponse( + status = 200, + headers = mapOf("Get" to arrayListOf("Header from FTL")), + body = GetResponse( + message = "UserID: ${req.body.userID}, PostID: ${req.body.postID}", + nested = Nested(goodStuff = "This is good stuff") + ) + ) +} + +// Example: curl -i --json '{"user_id": 123, "post_id": 345}' http://localhost:8892/ingress/http/users +@Verb +@HttpIngress(Method.POST, "/http/users") +fun post(context: Context, req: HttpRequest): HttpResponse { + return HttpResponse( + status = 201, + headers = mapOf("Post" to arrayListOf("Header from FTL")), + body = PostResponse(success = true) + ) +} + +// Example: curl -X PUT http://localhost:8892/ingress/http/users/123 -d '{"postId": "123"}' +@Verb +@HttpIngress(Method.PUT, "/http/users/{userId}") +fun put(context: Context, req: HttpRequest): HttpResponse { + return HttpResponse( + status = 200, + headers = mapOf("Put" to arrayListOf("Header from FTL")), + body = Empty() + ) +} + +// Example: curl -X DELETE http://localhost:8892/ingress/http/users/123 +@Verb +@HttpIngress(Method.DELETE, "/http/users/{userId}") +fun delete(context: Context, req: HttpRequest): HttpResponse { + return HttpResponse( + status = 200, + headers = mapOf("Delete" to arrayListOf("Header from FTL")), + body = Empty() + ) +} diff --git a/kotlin/pom.xml b/kotlin/pom.xml new file mode 100644 index 00000000..0878265c --- /dev/null +++ b/kotlin/pom.xml @@ -0,0 +1,213 @@ + + + 4.0.0 + + ftl + ftl + 1.0-SNAPSHOT + + pom + + + ftl-module-http + + + + 0.126.0 + http://127.0.0.1:8892 + 1.8 + 1.9.22 + true + ${java.version} + ${java.version} + + + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + + + xyz.block + ftl-runtime + ${ftl.version} + + + org.postgresql + postgresql + 42.7.1 + + + + + + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + compile + + compile + + + + ${project.basedir}/src/main/kotlin + + + + + test-compile + + test-compile + + + + ${project.basedir}/src/test/kotlin + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.6.1 + + + + initialize + + copy + + + + + xyz.block + ftl-generator + ${ftl.version} + ftl-generator.jar + + + + + + + copy-dependencies + compile + + copy-dependencies + + + ${project.build.directory}/dependency + runtime + + + + + build-classpath + compile + + build-classpath + + + ${project.build.directory}/classpath.txt + dependency + + + + build-classpath-property + compile + + build-classpath + + + generated.classpath + ${project.build.directory}/dependency + + + + + + + org.codehaus.mojo + exec-maven-plugin + 3.1.1 + + + initialize + + exec + + + java + + -jar + target/dependency/ftl-generator.jar + --endpoint=${ftlEndpoint} + --dest=${project.build.directory} + --module=${ftlModuleName} + --module-client-suffix=ModuleClient + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + generate-sources + + add-source + + + + ${project.build.directory}/generated-sources/ftl + + + + + + + com.github.ozsie + detekt-maven-plugin + 1.23.5 + + true + ${generated.classpath} + ${java.version} + ${project.build.directory}/detekt.yml + + + ${project.build.directory}/dependency/ftl-runtime-${ftl.version}.jar + + + ${project.basedir}/src/main/kotlin,${project.build.directory}/generated-sources + + + + compile + + check-with-type-resolution + + + + + + xyz.block + ftl-runtime + ${ftl.version} + + + + + + + \ No newline at end of file