diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index ce71f103..00000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,4 +0,0 @@ -contact_links: - - name: ❓ Questions and Help 🤔 - url: https://discord.gg/tbd (/add your discord channel if applicable) - about: This issue tracker is not for support questions. Please refer to the community for more help. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4562aadc..ba25aa19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,8 @@ jobs: uses: actions/checkout@v3 - name: Init Hermit uses: cashapp/activate-hermit@v1 + with: + cache: true - name: Get dependencies working-directory: ./frontend/mobile run: flutter pub get diff --git a/.gitignore b/.gitignore index 19fd746b..c717a2b5 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,9 @@ build/ deploy/ .DS_Store /logs/ +generated_ftl_module.go +*.zip +dist/ +go.work +go.work.sum +_ftl/ diff --git a/CODEOWNERS b/CODEOWNERS index 21ecf13a..b96b6a3b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,24 +1 @@ -# This CODEOWNERS file denotes the project leads -# and encodes their responsibilities for code review. - -# Instructions: At a minimum, replace the '@GITHUB_USER_NAME_GOES_HERE' -# here with at least one project lead. - -# Lines starting with '#' are comments. -# Each line is a file pattern followed by one or more owners. -# The format is described: https://github.blog/2017-07-06-introducing-code-owners/ - -# These owners will be the default owners for everything in the repo. -* @GITHUB_USER_NAME_GOES_HERE - - -# ----------------------------------------------- -# BELOW THIS LINE ARE TEMPLATES, UNUSED -# ----------------------------------------------- -# Order is important. The last matching pattern has the most precedence. -# So if a pull request only touches javascript files, only these owners -# will be requested to review. -# *.js @octocat @github/js - -# You can also use email addresses if you prefer. -# docs/* docs@example.com \ No newline at end of file +* @alecthomas @wesbillman @worstell diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 95b8a6fa..c58d87fb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ There are many ways to be an open source contributor, and we're here to help you * Propose ideas in our [discord](https://discord.gg/tbd) -* Raise an issue or feature request in our [issue tracker](LINK_HERE) ___***FIX LINK AND REMOVE THIS NOTICE***___ +* Raise an issue or feature request in [github](https://github.com/TBD54566975/ftl-examples/issues) * Help another contributor with one of their questions, or a code review * Suggest improvements to our Getting Started documentation by supplying a Pull Request * Evangelize our work together in conferences, podcasts, and social media spaces. @@ -17,167 +17,7 @@ ___***UPDATE TABLE OF PROJECT DEPS AND INSTALLATION NOTES***___ | Requirement | Tested Version | Installation Instructions | |-------------|----------------|------------------------------------------------------| -| Go | 1.17.6 |[go.dev](https://go.dev/doc/tutorial/compile-install) | -| Mage | 1.12.1 |[magefile.org](https://magefile.org/) | -| Java | 17.0.2 | Below, recommended via [SDKMan](https://sdkman.io) | - -### Go - -This project is written in Go, a modern, open source programming language. - -You may verify your `go` installation via the terminal: - -``` -$> go version -go version go1.17.6 darwin/amd64 -``` - -If you do not have go, we recommend installing it by: - -#### MacOS - -##### Homebrew -``` -$> brew install go -``` - -#### Linux - -See the [Go Installation Documentation](https://go.dev/doc/install). - -### Mage - -The build is run by Mage. - -You may verify your `mage` installation via the terminal: - -``` -$> mage --version -Mage Build Tool 1.12.1 -Build Date: 2021-12-15T21:00:02Z -Commit: 2f1ec40 -built with: go1.17.6 -``` - -#### MacOS - -##### Homebrew - -``` -$> brew install mage -``` - -#### Linux - -Installation instructions are on the [Magefile home page](https://magefile.org/). - -### Java - -This project is written in Java, a typesafe, compiled programming language. - -You may verify your `java` installation via the terminal by running `java -version`. - -If you do not have Java, we recommend installing it -via [SDKMan](https://sdkman.io/install). This is a project which will allow you -to easily install the Java Development Kit (JDK), runtime (JRE), and related frameworks, -build tools, and runtimes. - -After you've installed SDKMan, you may install Java: - -#### SDKMan (cross-platform instructions) - -```shell -$> sdk install java - ... -Do you want java 17.0.2-open to be set as default? (Y/n): Y -Setting java 17.0.2-open as default. -``` - -You may test your installation: - -```shell -$> java -version -openjdk version "17.0.2" 2022-01-18 -OpenJDK Runtime Environment (build 17.0.2+8-86) -OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing) -``` - ---- -**NOTE** - -You may additionally look for other Java versions to install by running `sdk list java`: - -...or other installation candidates like Apache Ant, Apache Maven, etc, by running `sdk list`. - -Consult the SDKMan documentation for more info. - ---- - -## Build (Mage) - -``` -$> mage build -``` - -## Build (Java / Gradle) - -### macOS / Linux -```shell -$> ./gradlew build -``` - -### Windows -```shell -$> gradlew.bat build -``` - -## Test (Mage) - -``` -$> mage test -``` - -## Test (Java / Gradle) - -### macOS / Linux -```shell -$> ./gradlew test -``` - -### Windows -```shell -$> gradlew.bat test -``` - ---- -**NOTE** - -You may also combine Gradle build targets in one call, like: - -```shell -$> ./gradlew clean build test -``` - ---- - -## Communications - -### Issues - -Anyone from the community is welcome (and encouraged!) to raise issues via -[GitHub Issues](LINK_HERE) ___***FIX LINK AND REMOVE THIS NOTICE***___. - -### Discussions - -Design discussions and proposals take place in our [discord](https://discord.gg/tbd). - -We advocate an asynchronous, written debate model - so write up your thoughts and invite the community to join in! - -### Continuous Integration - -Build and Test cycles are run on every commit to every branch on [CircleCI](LINK_HERE). - - ___***FIX LINK ABOVE AND REMOVE THIS NOTICE***___ +| Hermit | v0.38.1 |[hermit](https://cashapp.github.io/hermit/usage/get-started/) | ## Contribution diff --git a/Justfile b/Justfile new file mode 100644 index 00000000..a120fc55 --- /dev/null +++ b/Justfile @@ -0,0 +1,7 @@ +# Start the FTL backend with hot-reloading +dev: + watchexec -r -e sql -- goreman -logtime=false -f Procfile.dev start + +# Start the example web frontend for online-boutique +web: + cd frontend/web && npm install && npm run dev diff --git a/Procfile.dev b/Procfile.dev new file mode 100644 index 00000000..339c347c --- /dev/null +++ b/Procfile.dev @@ -0,0 +1,4 @@ +ftl: ftl serve --recreate --allow-origins '*' +backend: ftl dev backend/online-boutique/services +mobile_code_gen: ftl schema generate frontend/mobile/templates/ frontend/mobile/lib/api --watch=5s +web_code_gen: ftl schema generate frontend/web/templates/ frontend/web/src/api --watch=5s diff --git a/README.md b/README.md index c8ba3b38..e404e02d 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,32 @@ -# $PROJECT_NAME README +# FTL examples -Congrats, project leads! You got a new project to grow! +## Introduction -This stub is meant to help you form a strong community around your work. It's yours to adapt, and may -diverge from this initial structure. Just keep the files seeded in this repo, and the rest is yours to evolve! +This repo is designed to show how to use FTL to build an online boutique backend with a mobile (Flutter) app and React frontend. -## Introduction +## Running + +* Install [Hermit](https://cashapp.github.io/hermit/usage/get-started/) and related [shell_hooks]([shell hooks](https://cashapp.github.io/hermit/usage/shell/)). + +>[NOTE] This will install [Just](https://github.com/casey/just) for you. + +To see a list of commands that can be run, run `just --list` in the root of the project. + +### Start FTL, code gen, and backend services with hot-reloading -Orient users to the project here. This is a good place to start with an assumption -that the user knows very little - so start with the Big Picture and show how this -project fits into it. It may be good to reference/link the broader architecture in the -`collaboration` repo or the developer site here. +```bash +just dev +``` -Then maybe a dive into what this project does. +### Start the React web app -Diagrams and other visuals are helpful here. Perhaps code snippets showing usage. +```bash +just web +``` -Project leads should complete, alongside this `README`: -* [CODEOWNERS](./CODEOWNERS) - set project lead(s) -* [CONTRIBUTING.md](./CONTRIBUTING.md) - Fill out how to: install prereqs, build, test, run, access CI, chat, discuss, file issues -* [Bug-report.md](.github/ISSUE_TEMPLATE/bug-report.md) - Fill out `Assignees` add codeowners @names -* [config.yml](.github/ISSUE_TEMPLATE/config.yml) - remove "(/add your discord channel..)" and replace the url with your Discord channel if applicable +### Flutter app -The other files in this template repo may be used as-is: -* [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md) -* [GOVERNANCE.md](./GOVERNANCE.md) -* [LICENSE](./LICENSE) +Flutter is better run via an [IDE](https://docs.flutter.dev/get-started/editor?tab=vscode) like VSCode or Android Studio. ## Project Resources diff --git a/backend/online-boutique/common/money/money.go b/backend/online-boutique/common/money/money.go index 6c8deb81..50592b83 100644 --- a/backend/online-boutique/common/money/money.go +++ b/backend/online-boutique/common/money/money.go @@ -16,6 +16,8 @@ package money import ( "errors" + + "ftl/currency" ) const ( @@ -29,66 +31,49 @@ var ( ErrMismatchingCurrency = errors.New("mismatching currency codes") ) -// Money represents an amount of money along with the currency type. -type Money struct { - // The 3-letter currency code defined in ISO 4217. - CurrencyCode string `json:"currencyCode"` - - // The whole units of the amount. - // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. - Units int `json:"units"` - - // Number of nano (10^-9) units of the amount. - // The value must be between -999,999,999 and +999,999,999 inclusive. - // If `units` is positive, `nanos` must be positive or zero. - // If `units` is zero, `nanos` can be positive, zero, or negative. - // If `units` is negative, `nanos` must be negative or zero. - // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. - Nanos int `json:"nanos"` -} - // IsValid checks if specified value has a valid units/nanos signs and ranges. -func IsValid(m Money) bool { +func IsValid(m currency.Money) bool { return signMatches(m) && validNanos(m.Nanos) } -func signMatches(m Money) bool { +func signMatches(m currency.Money) bool { return m.Nanos == 0 || m.Units == 0 || (m.Nanos < 0) == (m.Units < 0) } func validNanos(nanos int) bool { return nanosMin <= nanos && nanos <= nanosMax } // IsZero returns true if the specified money value is equal to zero. -func IsZero(m Money) bool { return m.Units == 0 && m.Nanos == 0 } +func IsZero(m currency.Money) bool { return m.Units == 0 && m.Nanos == 0 } // IsPositive returns true if the specified money value is valid and is // positive. -func IsPositive(m Money) bool { +func IsPositive(m currency.Money) bool { return IsValid(m) && m.Units > 0 || (m.Units == 0 && m.Nanos > 0) } // IsNegative returns true if the specified money value is valid and is // negative. -func IsNegative(m Money) bool { +func IsNegative(m currency.Money) bool { return IsValid(m) && m.Units < 0 || (m.Units == 0 && m.Nanos < 0) } // AreSameCurrency returns true if values l and r have a currency code and // they are the same values. -func AreSameCurrency(l, r Money) bool { +func AreSameCurrency(l, r currency.Money) bool { return l.CurrencyCode == r.CurrencyCode && l.CurrencyCode != "" } // AreEquals returns true if values l and r are the equal, including the -// currency. This does not check validity of the provided values. -func AreEquals(l, r Money) bool { +// +// This does not check validity of the provided values. +func AreEquals(l, r currency.Money) bool { return l.CurrencyCode == r.CurrencyCode && l.Units == r.Units && l.Nanos == r.Nanos } // Negate returns the same amount with the sign negated. -func Negate(m Money) Money { - return Money{ +func Negate(m currency.Money) currency.Money { + return currency.Money{ Units: -m.Units, Nanos: -m.Nanos, CurrencyCode: m.CurrencyCode} @@ -96,7 +81,7 @@ func Negate(m Money) Money { // Must panics if the given error is not nil. This can be used with other // functions like: "m := Must(Sum(a,b))". -func Must(v Money, err error) Money { +func Must(v currency.Money, err error) currency.Money { if err != nil { panic(err) } @@ -106,11 +91,11 @@ func Must(v Money, err error) Money { // Sum adds two values. Returns an error if one of the values are invalid or // currency codes are not matching (unless currency code is unspecified for // both). -func Sum(l, r Money) (Money, error) { +func Sum(l, r currency.Money) (currency.Money, error) { if !IsValid(l) || !IsValid(r) { - return Money{}, ErrInvalidValue + return currency.Money{}, ErrInvalidValue } else if l.CurrencyCode != r.CurrencyCode { - return Money{}, ErrMismatchingCurrency + return currency.Money{}, ErrMismatchingCurrency } units := l.Units + r.Units nanos := l.Nanos + r.Nanos @@ -130,7 +115,7 @@ func Sum(l, r Money) (Money, error) { } } - return Money{ + return currency.Money{ Units: units, Nanos: nanos, CurrencyCode: l.CurrencyCode}, nil @@ -138,7 +123,7 @@ func Sum(l, r Money) (Money, error) { // MultiplySlow is a slow multiplication operation done through adding the value // to itself n-1 times. -func MultiplySlow(m Money, n uint32) Money { +func MultiplySlow(m currency.Money, n uint32) currency.Money { out := m for n > 1 { out = Must(Sum(out, m)) diff --git a/backend/online-boutique/go.mod b/backend/online-boutique/go.mod index 6f115d2f..12eaee17 100644 --- a/backend/online-boutique/go.mod +++ b/backend/online-boutique/go.mod @@ -1,44 +1,3 @@ module github.com/TBD54566975/ftl/examples/online-boutique -go 1.21.3 - -replace github.com/TBD54566975/ftl => ../.. - -require ( - github.com/TBD54566975/ftl v0.0.0-00010101000000-000000000000 - github.com/alecthomas/errors v0.4.0 - github.com/google/uuid v1.4.0 - github.com/hashicorp/golang-lru/v2 v2.0.5 - golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 -) - -require ( - connectrpc.com/connect v1.11.1 // indirect - connectrpc.com/grpcreflect v1.2.0 // indirect - connectrpc.com/otelconnect v0.5.0 // indirect - github.com/alecthomas/concurrency v0.0.2 // indirect - github.com/alecthomas/participle/v2 v2.0.0 // indirect - github.com/alecthomas/types v0.7.1 // indirect - github.com/alessio/shellescape v1.4.1 // indirect - github.com/danieljoos/wincred v1.1.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/godbus/dbus/v5 v5.1.0 // indirect - github.com/iancoleman/strcase v0.2.0 // 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.17 // indirect - github.com/oklog/ulid/v2 v2.1.0 // indirect - github.com/rs/cors v1.9.0 // indirect - github.com/swaggest/jsonschema-go v0.3.62 // indirect - github.com/swaggest/refl v1.3.0 // indirect - github.com/zalando/go-keyring v0.2.1 // indirect - go.opentelemetry.io/otel v1.19.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect -) +go 1.21.6 diff --git a/backend/online-boutique/go.sum b/backend/online-boutique/go.sum index 0321db76..e69de29b 100644 --- a/backend/online-boutique/go.sum +++ b/backend/online-boutique/go.sum @@ -1,142 +0,0 @@ -connectrpc.com/connect v1.11.1 h1:dqRwblixqkVh+OFBOOL1yIf1jS/yP0MSJLijRj29bFg= -connectrpc.com/connect v1.11.1/go.mod h1:3AGaO6RRGMx5IKFfqbe3hvK1NqLosFNP2BxDYTPmNPo= -connectrpc.com/grpcreflect v1.2.0 h1:Q6og1S7HinmtbEuBvARLNwYmTbhEGRpHDhqrPNlmK+U= -connectrpc.com/grpcreflect v1.2.0/go.mod h1:nwSOKmE8nU5u/CidgHtPYk1PFI3U9ignz7iDMxOYkSY= -connectrpc.com/otelconnect v0.5.0 h1:K7xQKFbgeaHx563B+IIbd1EJe856AanueIYtGEtdnH8= -connectrpc.com/otelconnect v0.5.0/go.mod h1:cjBMmtJmTokg4/k/3iDjLOjfNVM4qSVfIWz/qWQ8FNw= -github.com/alecthomas/assert/v2 v2.3.0 h1:mAsH2wmvjsuvyBvAmCtm7zFsBlb8mIHx5ySLVdDZXL0= -github.com/alecthomas/assert/v2 v2.3.0/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= -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/errors v0.4.0 h1:zDIapqdw7gVx2BrQpw3Ll5YRGFuaiB0ywcjesqT0RIE= -github.com/alecthomas/errors v0.4.0/go.mod h1:0DQf6/xQp3f9rv+k72g2NmeTW2lC74kXA6b/8dN9BwY= -github.com/alecthomas/participle/v2 v2.0.0 h1:Fgrq+MbuSsJwIkw3fEj9h75vDP0Er5JzepJ0/HNHv0g= -github.com/alecthomas/participle/v2 v2.0.0/go.mod h1:rAKZdJldHu8084ojcWevWAL8KmEU+AT+Olodb+WoN2Y= -github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= -github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= -github.com/alecthomas/types v0.7.1 h1:zU49e5jp0MS4sVDq0yEX4uX/jX7aVpvwd+Rm632ZpEQ= -github.com/alecthomas/types v0.7.1/go.mod h1:t7PnU03TVweFpbPVKaeLtFykjJD8rqiBJ7gfkp6UvLQ= -github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= -github.com/alessio/shellescape v1.4.1/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.1.0 h1:3RNcEpBg4IhIChZdFRSdlQt1QjCp1sMAPIrOnm7Yf8g= -github.com/danieljoos/wincred v1.1.0/go.mod h1:XYlo+eRTsVA9aHGp7NGjFkPla4m+DCL7hqDjlFjiygg= -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.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -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.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -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/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/golang-lru/v2 v2.0.5 h1:wW7h1TG88eUIJ2i69gaE3uNVtEPIagzhGvHgwfx2Vm4= -github.com/hashicorp/golang-lru/v2 v2.0.5/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -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/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= -github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= -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.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -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/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE= -github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -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.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -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.62 h1:eIE0aRklWa2eLJg2L/zqyWpKvgUPbq2oKOtrJGJkPH0= -github.com/swaggest/jsonschema-go v0.3.62/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.1 h1:MBRN/Z8H4U5wEKXiD67YbDAr5cj/DOStmSga70/2qKc= -github.com/zalando/go-keyring v0.2.1/go.mod h1:g63M2PPn0w5vjmEbwAX3ib5I+41zdm4esSETOn9Y6Dw= -go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= -go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= -go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= -go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= -go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= -go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= -go.opentelemetry.io/otel/sdk/metric v1.19.0 h1:EJoTO5qysMsYCa+w4UghwFV/ptQgqSL/8Ni+hx+8i1k= -go.opentelemetry.io/otel/sdk/metric v1.19.0/go.mod h1:XjG0jQyFJrv2PbMvwND7LwCEhsJzCzV5210euduKcKY= -go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= -go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= -golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ= -golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 h1:Vve/L0v7CXXuxUmaMGIEK/dEeq7uiqb5qBgQrZzIE7E= -golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -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.22.5 h1:91BNch/e5B0uPbJFgqbxXuOnxBQjlS//icfQEGmvyjE= -modernc.org/libc v1.22.5/go.mod h1:jj+Z7dTNX8fBScMVNRAYZ/jF91K8fdT2hYMThc3YjBY= -modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ= -modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds= -modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= -modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.23.1 h1:nrSBg4aRQQwq59JpvGEQ15tNxoO5pX/kUjcRNwSAGQM= -modernc.org/sqlite v1.23.1/go.mod h1:OrDj17Mggn6MhE+iPbBNf7RGKODDE9NFT0f3EwDzJqk= -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/backend/online-boutique/services/ad-kotlin/pom.xml b/backend/online-boutique/services/ad-kotlin/pom.xml deleted file mode 100644 index d873ce92..00000000 --- a/backend/online-boutique/services/ad-kotlin/pom.xml +++ /dev/null @@ -1,198 +0,0 @@ - - - 4.0.0 - xyz.block - ad-kotlin - 1.0-SNAPSHOT - - - 1.0-SNAPSHOT - 11 - 1.9.0 - true - ${java.version} - ${java.version} - - - - - org.jetbrains.kotlin - kotlin-stdlib - ${kotlin.version} - - - ${project.groupId} - ftl-runtime - ${ftl.version} - - - ${project.groupId} - ftl-generator - ${ftl.version} - - - - - - - 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.2.0 - - - initialize - - copy - - - - - xyz.block - ftl-generator - ${ftl.version} - jar-with-dependencies - ftl-generator.jar - - - xyz.block - ftl-runtime - ${ftl.version} - jar-with-dependencies - ftl-runtime.jar - - - - - - copy-dependencies - compile - - copy-dependencies - - - ${project.build.directory}/dependency - runtime - - - - build-classpath - compile - - build-classpath - - - ${project.build.directory}/classpath.txt - generated.classpath - ${project.build.directory}/dependency - - - - - - - org.codehaus.mojo - exec-maven-plugin - 3.0.0 - - - initialize - - exec - - - java - - -jar - target/dependency/ftl-generator.jar - --endpoint=http://127.0.0.1:8892 - --dest=${project.build.directory} - --module=ad - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.2.0 - - - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/ftl - - - - - - - com.github.ozsie - detekt-maven-plugin - 1.23.3 - - true - ${generated.classpath} - ${java.version} - ${project.build.directory}/detekt.yml - - - ${project.build.directory}/dependency/ftl-runtime-${ftl.version}.jar - - - - - - compile - - check-with-type-resolution - - - - - - xyz.block - ftl-runtime - ${ftl.version} - - - - - - \ No newline at end of file diff --git a/backend/online-boutique/services/ad-kotlin/src/main/kotlin/ftl/ad/Ad.kt b/backend/online-boutique/services/ad-kotlin/src/main/kotlin/ftl/ad/Ad.kt deleted file mode 100644 index ea57769f..00000000 --- a/backend/online-boutique/services/ad-kotlin/src/main/kotlin/ftl/ad/Ad.kt +++ /dev/null @@ -1,78 +0,0 @@ -package ftl.ad - -import com.google.gson.Gson -import com.google.gson.annotations.SerializedName -import com.google.gson.reflect.TypeToken -import xyz.block.ftl.Context -import xyz.block.ftl.Ingress -import xyz.block.ftl.Method -import xyz.block.ftl.Verb -import xyz.block.ftl.serializer.makeGson -import java.util.* - -data class Ad(@SerializedName("RedirectURL") val redirectUrl: String, @SerializedName("Text") val text: String) -data class AdRequest(val contextKeys: List) -data class AdResponse(val ads: List) - -class AdModule { - private val database: Map = loadDatabase() - - @Throws(Exception::class) - @Verb - @Ingress(Method.GET, "/get") - fun get(context: Context, req: AdRequest): AdResponse { - return when { - req.contextKeys.isNotEmpty() -> AdResponse(ads = contextualAds(req.contextKeys)) - else -> AdResponse(ads = randomAds()) - } - } - - private fun contextualAds(contextKeys: List): List { - return contextKeys.map { database[it] ?: throw Exception("no ad registered for this context key") } - } - - private fun randomAds(): List { - val ads = mutableListOf() - val random = Random() - repeat(MAX_ADS_TO_SERVE) { - ads.add(database.entries.elementAt(random.nextInt(database.size)).value) - } - return ads - } - - companion object { - private const val MAX_ADS_TO_SERVE = 2 - private const val DATABASE_JSON = "{\n" + - " \"hair\": {\n" + - " \"RedirectURL\": \"/product/2ZYFJ3GM2N\",\n" + - " \"Text\": \"Hairdryer for sale. 50% off.\"\n" + - " },\n" + - " \"clothing\": {\n" + - " \"RedirectURL\": \"/product/66VCHSJNUP\",\n" + - " \"Text\": \"Tank top for sale. 20% off.\"\n" + - " },\n" + - " \"accessories\": {\n" + - " \"RedirectURL\": \"/product/1YMWWN1N4O\",\n" + - " \"Text\": \"Watch for sale. Buy one, get second kit for free\"\n" + - " },\n" + - " \"footwear\": {\n" + - " \"RedirectURL\": \"/product/L9ECAV7KIM\",\n" + - " \"Text\": \"Loafers for sale. Buy one, get second one for free\"\n" + - " },\n" + - " \"decor\": {\n" + - " \"RedirectURL\": \"/product/0PUK6V6EV0\",\n" + - " \"Text\": \"Candle holder for sale. 30% off.\"\n" + - " },\n" + - " \"kitchen\": {\n" + - " \"RedirectURL\": \"/product/9SIQT8TOJO\",\n" + - " \"Text\": \"Bamboo glass jar for sale. 10% off.\"\n" + - " }\n" + - "}" - - private fun loadDatabase(): Map { - return makeGson().fromJson>(DATABASE_JSON) - } - - inline fun Gson.fromJson(json: String) = fromJson(json, object : TypeToken() {}.type) - } -} diff --git a/backend/online-boutique/services/ad/ad.go b/backend/online-boutique/services/ad/ad.go index a9ca5752..63024c78 100644 --- a/backend/online-boutique/services/ad/ad.go +++ b/backend/online-boutique/services/ad/ad.go @@ -6,9 +6,8 @@ import ( _ "embed" "math/rand" - "golang.org/x/exp/maps" - "github.com/TBD54566975/ftl/examples/online-boutique/common" + "golang.org/x/exp/maps" ) const maxAdsToServe = 2 @@ -29,7 +28,8 @@ type Ad struct { } type AdResponse struct { - Ads []Ad + Name string + Ads []Ad } //ftl:verb diff --git a/backend/online-boutique/services/ad/ftl.toml b/backend/online-boutique/services/ad/ftl.toml index cf1f57ac..ad433ebe 100644 --- a/backend/online-boutique/services/ad/ftl.toml +++ b/backend/online-boutique/services/ad/ftl.toml @@ -1,5 +1,2 @@ module = "ad" language = "go" -deploy = [ - "main" -] diff --git a/backend/online-boutique/services/ad/go.mod b/backend/online-boutique/services/ad/go.mod new file mode 100644 index 00000000..b44a3d07 --- /dev/null +++ b/backend/online-boutique/services/ad/go.mod @@ -0,0 +1,10 @@ +module ftl/ad + +go 1.21.6 + +replace github.com/TBD54566975/ftl/examples/online-boutique => ../.. + +require ( + github.com/TBD54566975/ftl/examples/online-boutique v0.0.0-00010101000000-000000000000 + golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 +) diff --git a/backend/online-boutique/services/ad/go.sum b/backend/online-boutique/services/ad/go.sum new file mode 100644 index 00000000..3707af3c --- /dev/null +++ b/backend/online-boutique/services/ad/go.sum @@ -0,0 +1,2 @@ +golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o= +golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= diff --git a/backend/online-boutique/services/ad/main b/backend/online-boutique/services/ad/main deleted file mode 100644 index 9ee66d2a..00000000 Binary files a/backend/online-boutique/services/ad/main and /dev/null differ diff --git a/backend/online-boutique/services/cart/ftl.toml b/backend/online-boutique/services/cart/ftl.toml new file mode 100644 index 00000000..36d2a708 --- /dev/null +++ b/backend/online-boutique/services/cart/ftl.toml @@ -0,0 +1,2 @@ +module = "cart" +language = "go" diff --git a/backend/online-boutique/services/cart/go.mod b/backend/online-boutique/services/cart/go.mod new file mode 100644 index 00000000..c47e2897 --- /dev/null +++ b/backend/online-boutique/services/cart/go.mod @@ -0,0 +1,7 @@ +module ftl/cart + +go 1.21.6 + +replace github.com/TBD54566975/ftl/examples/online-boutique => ../.. + +require github.com/hashicorp/golang-lru/v2 v2.0.7 diff --git a/backend/online-boutique/services/cart/go.sum b/backend/online-boutique/services/cart/go.sum new file mode 100644 index 00000000..a33c54a1 --- /dev/null +++ b/backend/online-boutique/services/cart/go.sum @@ -0,0 +1,2 @@ +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= diff --git a/backend/online-boutique/services/checkout/checkout.go b/backend/online-boutique/services/checkout/checkout.go index 85f5a011..fd020495 100644 --- a/backend/online-boutique/services/checkout/checkout.go +++ b/backend/online-boutique/services/checkout/checkout.go @@ -7,13 +7,14 @@ import ( "github.com/google/uuid" + "ftl/cart" + "ftl/currency" + "ftl/payment" + "ftl/productcatalog" + "ftl/shipping" + "github.com/TBD54566975/ftl/backend/common/slices" "github.com/TBD54566975/ftl/examples/online-boutique/common/money" - "github.com/TBD54566975/ftl/examples/online-boutique/services/cart" - "github.com/TBD54566975/ftl/examples/online-boutique/services/currency" - "github.com/TBD54566975/ftl/examples/online-boutique/services/payment" - "github.com/TBD54566975/ftl/examples/online-boutique/services/productcatalog" - "github.com/TBD54566975/ftl/examples/online-boutique/services/shipping" ftl "github.com/TBD54566975/ftl/go-runtime/sdk" ) @@ -28,19 +29,19 @@ type PlaceOrderRequest struct { type OrderItem struct { Item cart.Item - Cost money.Money + Cost currency.Money } type Order struct { ID string ShippingTrackingID string - ShippingCost money.Money + ShippingCost currency.Money ShippingAddress shipping.Address Items []OrderItem } //ftl:verb -//ftl:ingress POST /checkout +//ftl:ingress POST /checkout/{userID} func PlaceOrder(ctx context.Context, req PlaceOrderRequest) (Order, error) { cartItems, err := ftl.Call(ctx, cart.GetCart, cart.GetCartRequest{UserID: req.UserID}) if err != nil { @@ -49,7 +50,7 @@ func PlaceOrder(ctx context.Context, req PlaceOrderRequest) (Order, error) { orders := make([]OrderItem, len(cartItems.Items)) for i, item := range cartItems.Items { - product, err := ftl.Call(ctx, productcatalog.Get, productcatalog.GetRequest{ID: item.ProductID}) + product, err := ftl.Call(ctx, productcatalog.Get, productcatalog.GetRequest{Id: item.ProductID}) if err != nil { return Order{}, fmt.Errorf("failed to get product #%q: %w", item.ProductID, err) } @@ -81,7 +82,7 @@ func PlaceOrder(ctx context.Context, req PlaceOrderRequest) (Order, error) { return Order{}, fmt.Errorf("failed to convert shipping cost to currency: %w", err) } - total := money.Money{CurrencyCode: req.UserCurrency} + total := currency.Money{CurrencyCode: req.UserCurrency} total = money.Must(money.Sum(total, shippingPrice)) for _, it := range orders { multPrice := money.MultiplySlow(it.Cost, uint32(it.Item.Quantity)) @@ -103,14 +104,14 @@ func PlaceOrder(ctx context.Context, req PlaceOrderRequest) (Order, error) { if err != nil { return Order{}, fmt.Errorf("shipping error: %w", err) } - fmt.Printf("Shipped order, tracking ID %s", shippingTrackingID.ID) + fmt.Printf("Shipped order, tracking ID %s", shippingTrackingID.Id) // Empty the cart, but don't worry about errors. _, _ = ftl.Call(ctx, cart.EmptyCart, cart.EmptyCartRequest{UserID: req.UserID}) order := Order{ ID: uuid.New().String(), - ShippingTrackingID: shippingTrackingID.ID, + ShippingTrackingID: shippingTrackingID.Id, ShippingCost: shippingPrice, ShippingAddress: req.Address, Items: orders, diff --git a/backend/online-boutique/services/checkout/ftl.toml b/backend/online-boutique/services/checkout/ftl.toml new file mode 100644 index 00000000..6096398f --- /dev/null +++ b/backend/online-boutique/services/checkout/ftl.toml @@ -0,0 +1,2 @@ +module = "checkout" +language = "go" diff --git a/backend/online-boutique/services/checkout/go.mod b/backend/online-boutique/services/checkout/go.mod new file mode 100644 index 00000000..f2b1ef2d --- /dev/null +++ b/backend/online-boutique/services/checkout/go.mod @@ -0,0 +1,49 @@ +module ftl/checkout + +go 1.21.6 + +replace github.com/TBD54566975/ftl/examples/online-boutique => ../.. + +require ( + github.com/TBD54566975/ftl v0.99.0 + github.com/TBD54566975/ftl/examples/online-boutique v0.0.0-00010101000000-000000000000 + github.com/google/uuid v1.5.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.9.0 // 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/iancoleman/strcase v0.2.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.2 // 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.21.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect + golang.design/x/reflect v0.0.0-20220504060917-02c43be63f3b // indirect + golang.org/x/crypto v0.18.0 // indirect + golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect +) diff --git a/backend/online-boutique/services/checkout/go.sum b/backend/online-boutique/services/checkout/go.sum new file mode 100644 index 00000000..fd3ee3fb --- /dev/null +++ b/backend/online-boutique/services/checkout/go.sum @@ -0,0 +1,147 @@ +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.99.0 h1:IBdJoPwajme+8EUwlLQPwT+aVgLWM4OibO3Dbamf80w= +github.com/TBD54566975/ftl v0.99.0/go.mod h1:KJrJ1KFFWdXFoZghKYBkHbrCkUaQYfcLhFs9jOZ4mcc= +github.com/alecthomas/assert/v2 v2.4.1 h1:mwPZod/d35nlaCppr6sFP0rbCL05WH9fIo7lvsf47zo= +github.com/alecthomas/assert/v2 v2.4.1/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.9.0 h1:g/P/fNElr7Ot1tWxSEms/I2gnRemxAqGNeetW6HOlO4= +github.com/alecthomas/types v0.9.0/go.mod h1:t7PnU03TVweFpbPVKaeLtFykjJD8rqiBJ7gfkp6UvLQ= +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.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.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/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +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.2 h1:iLlpgp4Cp/gC9Xuscl7lFL1PhhW+ZLtXZcrfCt4C3tA= +github.com/jackc/pgx/v5 v5.5.2/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.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/sdk/metric v1.21.0 h1:smhI5oD714d6jHE6Tie36fPx4WDFIg+Y6RfAY4ICcR0= +go.opentelemetry.io/otel/sdk/metric v1.21.0/go.mod h1:FJ8RAsoPGv/wYMgBdUJXOm+6pzFY3YdljnXtv1SBE8Q= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +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.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/exp v0.0.0-20231127185646-65229373498e h1:Gvh4YaCaXNs6dKTlfgismwWZKyjVZXwOPfIyUaqU3No= +golang.org/x/exp v0.0.0-20231127185646-65229373498e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +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.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.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/backend/online-boutique/services/currency/currency.go b/backend/online-boutique/services/currency/currency.go index cf0d9775..5e153031 100644 --- a/backend/online-boutique/services/currency/currency.go +++ b/backend/online-boutique/services/currency/currency.go @@ -10,7 +10,6 @@ import ( "golang.org/x/exp/maps" "github.com/TBD54566975/ftl/examples/online-boutique/common" - "github.com/TBD54566975/ftl/examples/online-boutique/common/money" ) var ( @@ -19,6 +18,24 @@ var ( database = common.LoadDatabase[map[string]float64](databaseJSON) ) +// Money represents an amount of money along with the currency type. +type Money struct { + // The 3-letter currency code defined in ISO 4217. + CurrencyCode string `json:"currencyCode"` + + // The whole units of the amount. + // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + Units int `json:"units"` + + // Number of nano (10^-9) units of the amount. + // The value must be between -999,999,999 and +999,999,999 inclusive. + // If `units` is positive, `nanos` must be positive or zero. + // If `units` is zero, `nanos` can be positive, zero, or negative. + // If `units` is negative, `nanos` must be negative or zero. + // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + Nanos int `json:"nanos"` +} + type GetSupportedCurrenciesRequest struct { } @@ -33,21 +50,21 @@ func GetSupportedCurrencies(ctx context.Context, req GetSupportedCurrenciesReque } type ConvertRequest struct { - From money.Money + From Money ToCode string } //ftl:verb //ftl:ingress POST /currency/convert -func Convert(ctx context.Context, req ConvertRequest) (money.Money, error) { +func Convert(ctx context.Context, req ConvertRequest) (Money, error) { from := req.From fromRate, ok := database[from.CurrencyCode] if !ok { - return money.Money{}, fmt.Errorf("unknown origin currency %q", req.From.CurrencyCode) + return Money{}, fmt.Errorf("unknown origin currency %q", req.From.CurrencyCode) } toRate, ok := database[req.ToCode] if !ok { - return money.Money{}, fmt.Errorf("unknown destination currency %q", req.ToCode) + return Money{}, fmt.Errorf("unknown destination currency %q", req.ToCode) } euros := carry(float64(from.Units)/fromRate, float64(from.Nanos)/fromRate) to := carry(float64(euros.Units)*toRate, float64(euros.Nanos)*toRate) @@ -56,12 +73,12 @@ func Convert(ctx context.Context, req ConvertRequest) (money.Money, error) { } // carry is a helper function that handles decimal/fractional carrying. -func carry(units float64, nanos float64) money.Money { +func carry(units float64, nanos float64) Money { const fractionSize = 1000000000 // 1B nanos += math.Mod(units, 1.0) * fractionSize units = math.Floor(units) + math.Floor(nanos/fractionSize) nanos = math.Mod(nanos, fractionSize) - return money.Money{ + return Money{ Units: int(units), Nanos: int(nanos), } diff --git a/backend/online-boutique/services/currency/ftl.toml b/backend/online-boutique/services/currency/ftl.toml new file mode 100644 index 00000000..07218ce6 --- /dev/null +++ b/backend/online-boutique/services/currency/ftl.toml @@ -0,0 +1,2 @@ +module = "currency" +language = "go" diff --git a/backend/online-boutique/services/currency/go.mod b/backend/online-boutique/services/currency/go.mod new file mode 100644 index 00000000..f6ba4a87 --- /dev/null +++ b/backend/online-boutique/services/currency/go.mod @@ -0,0 +1,10 @@ +module ftl/currency + +go 1.21.6 + +replace github.com/TBD54566975/ftl/examples/online-boutique => ../.. + +require ( + github.com/TBD54566975/ftl/examples/online-boutique v0.0.0-00010101000000-000000000000 + golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 +) diff --git a/backend/online-boutique/services/currency/go.sum b/backend/online-boutique/services/currency/go.sum new file mode 100644 index 00000000..3707af3c --- /dev/null +++ b/backend/online-boutique/services/currency/go.sum @@ -0,0 +1,2 @@ +golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o= +golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= diff --git a/backend/online-boutique/services/echo/generated_ftl_module.go b/backend/online-boutique/services/echo/generated_ftl_module.go deleted file mode 100644 index 1e6a4c37..00000000 --- a/backend/online-boutique/services/echo/generated_ftl_module.go +++ /dev/null @@ -1,6 +0,0 @@ -//ftl:module echo -package echo - -import ( - "context" -) diff --git a/backend/online-boutique/services/email/email.go b/backend/online-boutique/services/email/email.go deleted file mode 100644 index 8774a6ef..00000000 --- a/backend/online-boutique/services/email/email.go +++ /dev/null @@ -1 +0,0 @@ -package email diff --git a/backend/online-boutique/services/payment/ftl.toml b/backend/online-boutique/services/payment/ftl.toml new file mode 100644 index 00000000..cd591d5b --- /dev/null +++ b/backend/online-boutique/services/payment/ftl.toml @@ -0,0 +1,2 @@ +module = "payment" +language = "go" diff --git a/backend/online-boutique/services/payment/go.mod b/backend/online-boutique/services/payment/go.mod new file mode 100644 index 00000000..934e6e6f --- /dev/null +++ b/backend/online-boutique/services/payment/go.mod @@ -0,0 +1,7 @@ +module ftl/payment + +go 1.21.6 + +replace github.com/TBD54566975/ftl/examples/online-boutique => ../.. + +require github.com/google/uuid v1.5.0 diff --git a/backend/online-boutique/services/payment/go.sum b/backend/online-boutique/services/payment/go.sum new file mode 100644 index 00000000..040e2213 --- /dev/null +++ b/backend/online-boutique/services/payment/go.sum @@ -0,0 +1,2 @@ +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= diff --git a/backend/online-boutique/services/payment/payment.go b/backend/online-boutique/services/payment/payment.go index adc54bcb..588293db 100644 --- a/backend/online-boutique/services/payment/payment.go +++ b/backend/online-boutique/services/payment/payment.go @@ -9,7 +9,7 @@ import ( "github.com/google/uuid" - "github.com/TBD54566975/ftl/examples/online-boutique/common/money" + "ftl/currency" ) type InvalidCreditCardErr struct{} @@ -43,7 +43,7 @@ func (c CreditCardInfo) LastFour() string { } type ChargeRequest struct { - Amount money.Money + Amount currency.Money CreditCard CreditCardInfo } diff --git a/backend/online-boutique/services/productcatalog/ftl.toml b/backend/online-boutique/services/productcatalog/ftl.toml new file mode 100644 index 00000000..b66dc497 --- /dev/null +++ b/backend/online-boutique/services/productcatalog/ftl.toml @@ -0,0 +1,2 @@ +module = "productcatalog" +language = "go" diff --git a/backend/online-boutique/services/productcatalog/go.mod b/backend/online-boutique/services/productcatalog/go.mod new file mode 100644 index 00000000..928224da --- /dev/null +++ b/backend/online-boutique/services/productcatalog/go.mod @@ -0,0 +1,7 @@ +module ftl/productcatalog + +go 1.21.6 + +replace github.com/TBD54566975/ftl/examples/online-boutique => ../.. + +require github.com/TBD54566975/ftl/examples/online-boutique v0.0.0-00010101000000-000000000000 diff --git a/backend/online-boutique/services/productcatalog/go.sum b/backend/online-boutique/services/productcatalog/go.sum new file mode 100644 index 00000000..e69de29b diff --git a/backend/online-boutique/services/productcatalog/productcatalog.go b/backend/online-boutique/services/productcatalog/productcatalog.go index d07d7519..dfc9af0d 100644 --- a/backend/online-boutique/services/productcatalog/productcatalog.go +++ b/backend/online-boutique/services/productcatalog/productcatalog.go @@ -4,12 +4,12 @@ package productcatalog import ( "context" _ "embed" + "fmt" "strings" - "github.com/alecthomas/errors" + "ftl/currency" "github.com/TBD54566975/ftl/examples/online-boutique/common" - "github.com/TBD54566975/ftl/examples/online-boutique/common/money" ) var ( @@ -19,11 +19,11 @@ var ( ) type Product struct { - ID string `json:"id"` - Name string `json:"name"` - Description string `json:"description"` - Picture string `json:"picture"` - PriceUSD money.Money `json:"priceUSD"` + ID string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + Picture string `json:"picture"` + PriceUSD currency.Money `json:"priceUSD"` // Categories such as "clothing" or "kitchen" that can be used to look up // other related products. @@ -47,14 +47,14 @@ type GetRequest struct { } //ftl:verb -//ftl:ingress GET /productcatalog/id +//ftl:ingress GET /productcatalog/{id} func Get(ctx context.Context, req GetRequest) (Product, error) { for _, p := range database { if p.ID == req.ID { return p, nil } } - return Product{}, errors.Errorf("product not found: %q", req.ID) + return Product{}, fmt.Errorf("product not found: %q", req.ID) } type SearchRequest struct { diff --git a/backend/online-boutique/services/recommendation/ftl.toml b/backend/online-boutique/services/recommendation/ftl.toml new file mode 100644 index 00000000..b9adcbd9 --- /dev/null +++ b/backend/online-boutique/services/recommendation/ftl.toml @@ -0,0 +1,2 @@ +module = "recommendation" +language = "go" diff --git a/backend/online-boutique/services/recommendation/go.mod b/backend/online-boutique/services/recommendation/go.mod new file mode 100644 index 00000000..98cb2547 --- /dev/null +++ b/backend/online-boutique/services/recommendation/go.mod @@ -0,0 +1,46 @@ +module ftl/recommendation + +go 1.21.6 + +replace github.com/TBD54566975/ftl/examples/online-boutique => ../.. + +require github.com/TBD54566975/ftl v0.99.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.9.0 // 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.5.0 // indirect + github.com/iancoleman/strcase v0.2.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.2 // 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.21.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect + golang.design/x/reflect v0.0.0-20220504060917-02c43be63f3b // indirect + golang.org/x/crypto v0.18.0 // indirect + golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect +) diff --git a/backend/online-boutique/services/recommendation/go.sum b/backend/online-boutique/services/recommendation/go.sum new file mode 100644 index 00000000..fd3ee3fb --- /dev/null +++ b/backend/online-boutique/services/recommendation/go.sum @@ -0,0 +1,147 @@ +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.99.0 h1:IBdJoPwajme+8EUwlLQPwT+aVgLWM4OibO3Dbamf80w= +github.com/TBD54566975/ftl v0.99.0/go.mod h1:KJrJ1KFFWdXFoZghKYBkHbrCkUaQYfcLhFs9jOZ4mcc= +github.com/alecthomas/assert/v2 v2.4.1 h1:mwPZod/d35nlaCppr6sFP0rbCL05WH9fIo7lvsf47zo= +github.com/alecthomas/assert/v2 v2.4.1/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.9.0 h1:g/P/fNElr7Ot1tWxSEms/I2gnRemxAqGNeetW6HOlO4= +github.com/alecthomas/types v0.9.0/go.mod h1:t7PnU03TVweFpbPVKaeLtFykjJD8rqiBJ7gfkp6UvLQ= +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.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.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/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +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.2 h1:iLlpgp4Cp/gC9Xuscl7lFL1PhhW+ZLtXZcrfCt4C3tA= +github.com/jackc/pgx/v5 v5.5.2/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.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/sdk/metric v1.21.0 h1:smhI5oD714d6jHE6Tie36fPx4WDFIg+Y6RfAY4ICcR0= +go.opentelemetry.io/otel/sdk/metric v1.21.0/go.mod h1:FJ8RAsoPGv/wYMgBdUJXOm+6pzFY3YdljnXtv1SBE8Q= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +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.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/exp v0.0.0-20231127185646-65229373498e h1:Gvh4YaCaXNs6dKTlfgismwWZKyjVZXwOPfIyUaqU3No= +golang.org/x/exp v0.0.0-20231127185646-65229373498e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +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.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.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/backend/online-boutique/services/recommendation/recommendation.go b/backend/online-boutique/services/recommendation/recommendation.go index b23a8ada..ab3b1a5d 100644 --- a/backend/online-boutique/services/recommendation/recommendation.go +++ b/backend/online-boutique/services/recommendation/recommendation.go @@ -3,11 +3,11 @@ package recommendation import ( "context" + "fmt" "math/rand" - "github.com/alecthomas/errors" + "ftl/productcatalog" - "github.com/TBD54566975/ftl/examples/online-boutique/services/productcatalog" ftl "github.com/TBD54566975/ftl/go-runtime/sdk" ) @@ -26,7 +26,7 @@ func List(ctx context.Context, req ListRequest) (ListResponse, error) { catalog, err := ftl.Call(ctx, productcatalog.List, productcatalog.ListRequest{}) if err != nil { - return ListResponse{}, errors.Wrap(err, "failed to retrieve product catalog") + return ListResponse{}, fmt.Errorf("%s: %w", "failed to retrieve product catalog", err) } // Remove user-provided products from the catalog, to avoid recommending @@ -37,10 +37,10 @@ func List(ctx context.Context, req ListRequest) (ListResponse, error) { } filtered := make([]string, 0, len(catalog.Products)) for _, product := range catalog.Products { - if _, ok := userIDs[product.ID]; ok { + if _, ok := userIDs[product.Id]; ok { continue } - filtered = append(filtered, product.ID) + filtered = append(filtered, product.Id) } // Sample from filtered products and return them. diff --git a/backend/online-boutique/services/shipping/ftl.toml b/backend/online-boutique/services/shipping/ftl.toml new file mode 100644 index 00000000..c7cbbc52 --- /dev/null +++ b/backend/online-boutique/services/shipping/ftl.toml @@ -0,0 +1,2 @@ +module = "shipping" +language = "go" diff --git a/backend/online-boutique/services/shipping/go.mod b/backend/online-boutique/services/shipping/go.mod new file mode 100644 index 00000000..c5e6d966 --- /dev/null +++ b/backend/online-boutique/services/shipping/go.mod @@ -0,0 +1,5 @@ +module ftl/shipping + +go 1.21.6 + +replace github.com/TBD54566975/ftl/examples/online-boutique => ../.. diff --git a/backend/online-boutique/services/shipping/go.sum b/backend/online-boutique/services/shipping/go.sum new file mode 100644 index 00000000..e69de29b diff --git a/backend/online-boutique/services/shipping/shipping.go b/backend/online-boutique/services/shipping/shipping.go index 25412cdc..5f7e178e 100644 --- a/backend/online-boutique/services/shipping/shipping.go +++ b/backend/online-boutique/services/shipping/shipping.go @@ -6,8 +6,8 @@ import ( "fmt" "math" - "github.com/TBD54566975/ftl/examples/online-boutique/common/money" - "github.com/TBD54566975/ftl/examples/online-boutique/services/cart" + "ftl/cart" + "ftl/currency" ) type Address struct { @@ -25,7 +25,7 @@ type ShippingRequest struct { //ftl:verb //ftl:ingress POST /shipping/quote -func GetQuote(ctx context.Context, req ShippingRequest) (money.Money, error) { +func GetQuote(ctx context.Context, req ShippingRequest) (currency.Money, error) { return moneyFromUSD(8.99), nil } @@ -40,9 +40,9 @@ func ShipOrder(ctx context.Context, req ShippingRequest) (ShipOrderResponse, err return ShipOrderResponse{ID: createTrackingID(baseAddress)}, nil } -func moneyFromUSD(value float64) money.Money { +func moneyFromUSD(value float64) currency.Money { units, fraction := math.Modf(value) - return money.Money{ + return currency.Money{ CurrencyCode: "USD", Units: int(units), Nanos: int(math.Trunc(fraction * 10000000)), diff --git a/backend/online-boutique/services/time/generated_ftl_module.go b/backend/online-boutique/services/time/generated_ftl_module.go deleted file mode 100644 index adc2749b..00000000 --- a/backend/online-boutique/services/time/generated_ftl_module.go +++ /dev/null @@ -1,21 +0,0 @@ -//ftl:module time -package time - -import ( - "context" - "time" -) - -type TimeRequest struct { -} - -type TimeResponse struct { - Time time.Time `json:"time"` -} - -// Time returns the current time. -// -//ftl:verb -func Time(context.Context, TimeRequest) (TimeResponse, error) { - panic("Verb stubs should not be called directly, instead use github.com/TBD54566975/ftl/runtime-go/sdk.Call()") -} diff --git a/bin/.flutter-3.13.8.pkg b/bin/.flutter-3.16.8.pkg similarity index 100% rename from bin/.flutter-3.13.8.pkg rename to bin/.flutter-3.16.8.pkg diff --git a/bin/.go-1.21.3.pkg b/bin/.go-1.21.6.pkg similarity index 100% rename from bin/.go-1.21.3.pkg rename to bin/.go-1.21.6.pkg diff --git a/bin/.goreman-0.3.15.pkg b/bin/.goreman-0.3.15.pkg new file mode 120000 index 00000000..383f4511 --- /dev/null +++ b/bin/.goreman-0.3.15.pkg @@ -0,0 +1 @@ +hermit \ No newline at end of file diff --git a/bin/.just-1.23.0.pkg b/bin/.just-1.23.0.pkg new file mode 120000 index 00000000..383f4511 --- /dev/null +++ b/bin/.just-1.23.0.pkg @@ -0,0 +1 @@ +hermit \ No newline at end of file diff --git a/bin/.watchexec-1.25.1.pkg b/bin/.watchexec-1.25.1.pkg new file mode 120000 index 00000000..383f4511 --- /dev/null +++ b/bin/.watchexec-1.25.1.pkg @@ -0,0 +1 @@ +hermit \ No newline at end of file diff --git a/bin/dart b/bin/dart index 012cf9d3..b56aeab9 120000 --- a/bin/dart +++ b/bin/dart @@ -1 +1 @@ -.flutter-3.13.8.pkg \ No newline at end of file +.flutter-3.16.8.pkg \ No newline at end of file diff --git a/bin/flutter b/bin/flutter index 012cf9d3..b56aeab9 120000 --- a/bin/flutter +++ b/bin/flutter @@ -1 +1 @@ -.flutter-3.13.8.pkg \ No newline at end of file +.flutter-3.16.8.pkg \ No newline at end of file diff --git a/bin/go b/bin/go index 5ce3df00..e93cdb3c 120000 --- a/bin/go +++ b/bin/go @@ -1 +1 @@ -.go-1.21.3.pkg \ No newline at end of file +.go-1.21.6.pkg \ No newline at end of file diff --git a/bin/gofmt b/bin/gofmt index 5ce3df00..e93cdb3c 120000 --- a/bin/gofmt +++ b/bin/gofmt @@ -1 +1 @@ -.go-1.21.3.pkg \ No newline at end of file +.go-1.21.6.pkg \ No newline at end of file diff --git a/bin/goreman b/bin/goreman new file mode 120000 index 00000000..7546a72e --- /dev/null +++ b/bin/goreman @@ -0,0 +1 @@ +.goreman-0.3.15.pkg \ No newline at end of file diff --git a/bin/just b/bin/just new file mode 120000 index 00000000..38ec3579 --- /dev/null +++ b/bin/just @@ -0,0 +1 @@ +.just-1.23.0.pkg \ No newline at end of file diff --git a/bin/watchexec b/bin/watchexec new file mode 120000 index 00000000..57e2eae0 --- /dev/null +++ b/bin/watchexec @@ -0,0 +1 @@ +.watchexec-1.25.1.pkg \ No newline at end of file