Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
9e13f28
feat: expose type data and record subgraphs for enums (#1495)
thisisnithin Jan 8, 2025
8b8abc9
chore(release): Publish [skip ci]
Jan 8, 2025
73ed728
feat: improve rate limit responses (add code, hide stats) (#1497)
jensneuse Jan 8, 2025
9afbe41
chore(release): Publish [skip ci]
Jan 8, 2025
7f0f4bb
fix: provider should be specified in the config.yaml (#1397)
alepane21 Jan 8, 2025
d425aa1
fix: update the timeouts for clickhouse and platform service (#1500)
JivusAyrus Jan 8, 2025
6876c4f
chore(release): Publish [skip ci]
Jan 8, 2025
2a70c94
fix: add edfs to the demo environment (#1505)
alepane21 Jan 9, 2025
cc893ee
docs(CONTRIBUTING): fixup minor mistake in CONTRIBUTING.md under Go w…
endigma Jan 9, 2025
beab806
fix: full demo broken in main branch (#1508)
alepane21 Jan 10, 2025
1d67742
feat(router): optionally add jitter to config polling interval (#1506)
endigma Jan 11, 2025
36478fe
chore(release): Publish [skip ci]
Jan 11, 2025
e6f4b9b
fix(router): remove wildcard from router graphql path (#1509)
Noroth Jan 13, 2025
77a16d2
fix: use gauge for server.uptime metric (#1510)
StarpTech Jan 14, 2025
948edd2
feat: cache warmer (#1501)
JivusAyrus Jan 17, 2025
3b5aaab
chore(release): Publish [skip ci]
Jan 17, 2025
1d2f041
fix(cache warmup): consider only po of the last 7 days (#1513)
StarpTech Jan 18, 2025
ee89aaa
chore(release): Publish [skip ci]
Jan 18, 2025
d959e2c
fix(cache operation): swallow cache errors and other improvements (#1…
StarpTech Jan 19, 2025
acc0926
chore(release): Publish [skip ci]
Jan 19, 2025
6bb1231
feat: add variables remapping support (#1516)
devsergiy Jan 19, 2025
65bb031
chore(release): Publish [skip ci]
Jan 19, 2025
c09ecf4
fix(router): write proper line endings and header for multipart (#1517)
df-wg Jan 20, 2025
e21577a
chore(release): Publish [skip ci]
Jan 20, 2025
1d7047b
feat(router): optimize playground delivery, add concurrency_limit to …
df-wg Jan 22, 2025
d56dfb6
fix(router): enable health checks during startup (#1529)
Noroth Jan 23, 2025
2e3f0d2
feat: improve cache warmer (#1530)
StarpTech Jan 23, 2025
c0baf2e
chore(release): Publish [skip ci]
Jan 23, 2025
3b3a870
fix: remove semaphore from ResolveGraphQLSubscription (#1532)
alepane21 Jan 23, 2025
1c7b0c9
chore(release): Publish [skip ci]
Jan 23, 2025
4b8d60a
feat: add compatibility handshake between router and execution config…
Aenimus Jan 24, 2025
f342b2b
chore(release): Publish [skip ci]
Jan 24, 2025
f3f8fef
feat: also add handshake for static execution configs (#1535)
Aenimus Jan 26, 2025
e89d444
chore(router): bump demo library to pickup subscription fix (#1518)
df-wg Jan 27, 2025
90005c5
feat(router): add interface for trace propagation (#1526)
Noroth Jan 27, 2025
8e78a37
chore(release): Publish [skip ci]
Jan 27, 2025
3cfa2d5
fix: adding/removing directive is not picked up by wgc subgraph check…
JivusAyrus Jan 28, 2025
3f184cd
chore(deps): upgrade ristretto to v2 (#1538)
StarpTech Jan 28, 2025
60e3d0e
feat: add normalizedQuery to query plan and request info to trace (#1…
alepane21 Jan 29, 2025
d48255d
fix: add copy button to subgraph routing url (#1543)
thisisnithin Jan 29, 2025
3024dcf
fix: webhooks shot when schema is unchanged (#1542)
thisisnithin Jan 29, 2025
18a6025
fix: trim the inputs of group mappers (#1541)
JivusAyrus Jan 29, 2025
3bd7b36
fix: subgraphs search functionality (#1540)
JivusAyrus Jan 29, 2025
247d025
chore(release): Publish [skip ci]
Jan 29, 2025
00e2ee8
fix: increase max concurrent resolvers (#1544)
StarpTech Jan 29, 2025
ecdf74a
refactor(router): redesign JWK authentication logic (#1498)
Noroth Jan 30, 2025
3a12ec6
chore(release): Publish [skip ci]
Jan 30, 2025
b850fd7
fix: increase the test timeout value to prevent failures on slower ma…
alepane21 Jan 30, 2025
16ab8c6
fix: reduce the breaking change retention duration (#1550)
JivusAyrus Jan 30, 2025
38df3ee
fix: change the defaults of breaking-change-retention (#1551)
JivusAyrus Jan 30, 2025
806d3b4
feat(router): enable starting the router without subgraphs (#1533)
df-wg Jan 31, 2025
cbd8edc
fix(router): parse accept header per rfc 9110 (#1549)
df-wg Jan 31, 2025
c645f8e
chore(release): Publish [skip ci]
Jan 31, 2025
7c5b3a7
feat(router): enable using redis clusters for rate limiting and apq (…
df-wg Jan 31, 2025
b99e0bc
fix: json schema for traffic shaping subgraphs (#1552)
StarpTech Jan 31, 2025
a195546
Merge remote-tracking branch 'upstream/main' into chore/sync-upstream
james-braund-cabiri Jan 31, 2025
f93a499
chore: Update aws-lambda-router customisation after upstream sync
james-braund-cabiri Jan 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .github/workflows/router-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ jobs:
with:
cache-dependency-path: |
router-tests/go.sum
- name: Setup Redis Cluster (for Cluster tests)
uses: vishnudxb/redis-cluster@1.0.9
with:
master1-port: 7000
master2-port: 7001
master3-port: 7002
slave1-port: 7003
slave2-port: 7004
slave3-port: 7005
sleep-duration: 5
- uses: nick-fields/retry@v3
with:
timeout_minutes: 30
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ This guide assumes you have already installed the following software:
- Node.js [LTS](https://nodejs.org/en/about/releases/). You can also pnpm to [install](https://pnpm.io/cli/env) Node.js.
- [docker desktop](https://docs.docker.com/desktop/) (includes: engine, buildkit & compose) **or**:
- [docker engine](https://docs.docker.com/engine/) with:
- [docker buildkit](https://docs.docker.com/build/buildkit/), with optionally: [docker buildx plugin](https://docs.docker.com/build/install-buildx/)
- [docker compose plugin](https://docs.docker.com/compose/install/#scenario-two-install-the-compose-plugin)
- [docker buildkit](https://docs.docker.com/build/buildkit/), with optionally: [docker buildx plugin](https://docs.docker.com/build/install-buildx/)
- [docker compose plugin](https://docs.docker.com/compose/install/#scenario-two-install-the-compose-plugin)

## Monorepo

Expand All @@ -39,7 +39,7 @@ Ready! You can now start contributing to the WunderGraph Cosmo repository. Feel

## Go workspace

According to best practices, we don't commit the `go.work` or `go.sum` files. Those files are personal to each developer. As a result, we use the `go.mod` file to manage the dependencies and overwrites. You can still create `go.work` file in the root of the repository if you are feeling more comfortable with it or to improve tooling support.
According to best practices, we don't commit the `go.work` or `go.work.sum` files. Those files are personal to each developer. As a result, we use the `go.mod` file to manage the dependencies and overwrites. You can still create `go.work` file in the root of the repository if you are feeling more comfortable with it or to improve tooling support.

### Example

Expand Down Expand Up @@ -183,4 +183,4 @@ Grafana is available at [http://localhost:9300](http://localhost:9300) with the
```
Username: admin
Password: admin
```
```
2 changes: 1 addition & 1 deletion admission-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ FROM --platform=${BUILDPLATFORM} node:lts-slim

WORKDIR /app

ENV NODE_ENV production
ENV NODE_ENV=production

# Fetch built artifacts
COPY --from=builder /app/pruned .
Expand Down
7 changes: 3 additions & 4 deletions aws-lambda-router/config.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
version: '1'

authentication:
providers:
- name: Test Auth Service
jwks:
jwt:
jwks:
- url: https://www.googleapis.com/oauth2/v3/certs
# Example JWKS - Google OIDC
url: https://www.googleapis.com/oauth2/v3/certs
refresh_interval: 5m
headers:
all:
Expand Down
6 changes: 3 additions & 3 deletions aws-lambda-router/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.23.4
require (
github.com/akrylysov/algnhsa v1.1.0
github.com/aws/aws-lambda-go v1.43.0
github.com/stretchr/testify v1.9.0
github.com/stretchr/testify v1.10.0
github.com/wundergraph/cosmo/router v0.0.0-20241115174502-7156536a93bf
go.uber.org/zap v1.27.0
)
Expand All @@ -26,7 +26,7 @@ require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudflare/backoff v0.0.0-20161212185259-647f3cdfc87a // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgraph-io/ristretto v0.1.2-0.20240723054643-f5997484152c // indirect
github.com/dgraph-io/ristretto/v2 v2.1.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/expr-lang/expr v1.16.9 // indirect
Expand Down Expand Up @@ -97,7 +97,7 @@ require (
github.com/twmb/franz-go v1.16.1 // indirect
github.com/twmb/franz-go/pkg/kmsg v1.7.0 // indirect
github.com/wundergraph/astjson v0.0.0-20250106123708-be463c97e083 // indirect
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.138.0.20250106145350-20e4f82cea6b // indirect
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.145 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.23.0 // indirect
Expand Down
17 changes: 12 additions & 5 deletions aws-lambda-router/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRB
github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
github.com/akrylysov/algnhsa v1.1.0 h1:G0SoP16tMRyiism7VNc3JFA0wq/cVgEkp/ExMVnc6PQ=
github.com/akrylysov/algnhsa v1.1.0/go.mod h1:+bOweRs/WBu5awl+ifCoSYAuKVPAmoTk8XOMrZ1xwiw=
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 h1:uvdUDbHQHO85qeSydJtItA4T55Pw6BtAejd0APRJOCE=
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
github.com/alicebob/miniredis/v2 v2.34.0 h1:mBFWMaJSNL9RwdGRyEDoAAv8OQc5UlEhLDQggTglU/0=
github.com/alicebob/miniredis/v2 v2.34.0/go.mod h1:kWShP4b58T1CW0Y5dViCd5ztzrDqRWqM3nksiyXk5s8=
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
github.com/aws/aws-lambda-go v1.43.0 h1:Tdu7SnMB5bD+CbdnSq1Dg4sM68vEuGIDcQFZ+IjUfx0=
Expand Down Expand Up @@ -40,8 +44,8 @@ github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3C
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/dgraph-io/ristretto v0.1.2-0.20240723054643-f5997484152c h1:V2+MhiAoTwUNENo9PFoz2NSr0VDJEzIARLuzb30YyqA=
github.com/dgraph-io/ristretto v0.1.2-0.20240723054643-f5997484152c/go.mod h1:swkazRqnUf1N62d0Nutz7KIj2UKqsm/H8tD0nBJAXqM=
github.com/dgraph-io/ristretto/v2 v2.1.0 h1:59LjpOJLNDULHh8MC4UaegN52lC4JnO2dITsie/Pa8I=
github.com/dgraph-io/ristretto/v2 v2.1.0/go.mod h1:uejeqfYXpUomfse0+lO+13ATz4TypQYLJZzBSAemuB4=
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y=
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
Expand Down Expand Up @@ -230,8 +234,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
Expand All @@ -256,8 +261,10 @@ github.com/vektah/gqlparser/v2 v2.5.16 h1:1gcmLTvs3JLKXckwCwlUagVn/IlV2bwqle0vJ0
github.com/vektah/gqlparser/v2 v2.5.16/go.mod h1:1lz1OeCqgQbQepsGxPVywrjdBHW2T08PUS3pJqepRww=
github.com/wundergraph/astjson v0.0.0-20250106123708-be463c97e083 h1:8/D7f8gKxTBjW+SZK4mhxTTBVpxcqeBgWF1Rfmltbfk=
github.com/wundergraph/astjson v0.0.0-20250106123708-be463c97e083/go.mod h1:eOTL6acwctsN4F3b7YE+eE2t8zcJ/doLm9sZzsxxxrE=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.138.0.20250106145350-20e4f82cea6b h1:DnIV7YVjrPcrJj2awt8M1F++ql6EfC0hB0Or0m4OXx4=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.138.0.20250106145350-20e4f82cea6b/go.mod h1:B7eV0Qh8Lop9QzIOQcsvKp3S0ejfC6mgyWoJnI917yQ=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.145 h1:3JuBmRux6YB/UZgh6COvgLXzQhMIsdHV7A02NsYdAVE=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.145/go.mod h1:B7eV0Qh8Lop9QzIOQcsvKp3S0ejfC6mgyWoJnI917yQ=
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24=
Expand Down
123 changes: 82 additions & 41 deletions aws-lambda-router/internal/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,47 +199,9 @@ func NewRouter(opts ...Option) (*core.Router, error) {
routerOpts = append(routerOpts, core.WithAccessLogs(c))
}

var authenticators []authentication.Authenticator
for i, auth := range cfg.Authentication.Providers {
if auth.JWKS != nil {
name := auth.Name
if name == "" {
name = fmt.Sprintf("jwks-#%d", i)
}
providerLogger := logger.With(zap.String("provider_name", name))
tokenDecoder, err := authentication.NewJwksTokenDecoder(ctx, providerLogger, auth.JWKS.URL, auth.JWKS.RefreshInterval)
if err != nil {
providerLogger.Error("Could not create JWKS token decoder", zap.Error(err))
return nil, err
}
opts := authentication.HttpHeaderAuthenticatorOptions{
Name: name,
URL: auth.JWKS.URL,
HeaderNames: auth.JWKS.HeaderNames,
HeaderValuePrefixes: auth.JWKS.HeaderValuePrefixes,
TokenDecoder: tokenDecoder,
}
authenticator, err := authentication.NewHttpHeaderAuthenticator(opts)
if err != nil {
providerLogger.Error("Could not create HttpHeader authenticator", zap.Error(err))
return nil, err
}
authenticators = append(authenticators, authenticator)

if cfg.WebSocket.Authentication.FromInitialPayload.Enabled {
opts := authentication.WebsocketInitialPayloadAuthenticatorOptions{
TokenDecoder: tokenDecoder,
Key: cfg.WebSocket.Authentication.FromInitialPayload.Key,
HeaderValuePrefixes: auth.JWKS.HeaderValuePrefixes,
}
authenticator, err = authentication.NewWebsocketInitialPayloadAuthenticator(opts)
if err != nil {
providerLogger.Error("Could not create WebsocketInitialPayload authenticator", zap.Error(err))
return nil, err
}
authenticators = append(authenticators, authenticator)
}
}
authenticators, err := setupAuthenticators(ctx, logger, cfg)
if err != nil {
return nil, fmt.Errorf("could not setup authenticators: %w", err)
}

if len(authenticators) > 0 {
Expand Down Expand Up @@ -352,3 +314,82 @@ func WithLogger(logger *zap.Logger) Option {
r.Logger = logger
}
}

func setupAuthenticators(ctx context.Context, logger *zap.Logger, cfg *config.Config) ([]authentication.Authenticator, error) {
jwtConf := cfg.Authentication.JWT
if len(jwtConf.JWKS) == 0 {
// No JWT authenticators configured
return nil, nil
}

var authenticators []authentication.Authenticator
configs := make([]authentication.JWKSConfig, 0, len(jwtConf.JWKS))

for _, jwks := range cfg.Authentication.JWT.JWKS {
configs = append(configs, authentication.JWKSConfig{
URL: jwks.URL,
RefreshInterval: jwks.RefreshInterval,
AllowedAlgorithms: jwks.Algorithms,
})
}

tokenDecoder, err := authentication.NewJwksTokenDecoder(ctx, logger, configs)
if err != nil {
return nil, err
}

// create a map for the `httpHeaderAuthenticator`
headerSourceMap := map[string][]string{
jwtConf.HeaderName: {jwtConf.HeaderValuePrefix},
}

// The `websocketInitialPayloadAuthenticator` has one key and uses a flat list of prefixes
prefixSet := make(map[string]struct{})

for _, s := range jwtConf.HeaderSources {
if s.Type != "header" {
continue
}

for _, prefix := range s.ValuePrefixes {
headerSourceMap[s.Name] = append(headerSourceMap[s.Name], prefix)
prefixSet[prefix] = struct{}{}
}

}

opts := authentication.HttpHeaderAuthenticatorOptions{
Name: "jwks",
HeaderSourcePrefixes: headerSourceMap,
TokenDecoder: tokenDecoder,
}

authenticator, err := authentication.NewHttpHeaderAuthenticator(opts)
if err != nil {
logger.Error("Could not create HttpHeader authenticator", zap.Error(err))
return nil, err
}

authenticators = append(authenticators, authenticator)

if cfg.WebSocket.Authentication.FromInitialPayload.Enabled {
headerPrefixes := make([]string, 0, len(prefixSet))
for prefix := range prefixSet {
headerPrefixes = append(headerPrefixes, prefix)
}

opts := authentication.WebsocketInitialPayloadAuthenticatorOptions{
TokenDecoder: tokenDecoder,
Key: cfg.WebSocket.Authentication.FromInitialPayload.Key,
HeaderValuePrefixes: headerPrefixes,
}
authenticator, err = authentication.NewWebsocketInitialPayloadAuthenticator(opts)
if err != nil {
logger.Error("Could not create WebsocketInitialPayload authenticator", zap.Error(err))
return nil, err
}
authenticators = append(authenticators, authenticator)
}

return authenticators, nil
}
2 changes: 1 addition & 1 deletion aws-lambda-router/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aws-lambda-router",
"version": "0.5.0",
"version": "0.6.0",
"private": true,
"description": "Placeholder package to simplify versioning and releasing with lerna.",
"keywords": [
Expand Down
12 changes: 12 additions & 0 deletions cdn-server/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ Binaries are attached to the github release otherwise all images can be found [h
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.13.0](https://github.com/wundergraph/cosmo/compare/cdn@0.12.0...cdn@0.13.0) (2025-01-17)

### Features

* cache warmer ([#1501](https://github.com/wundergraph/cosmo/issues/1501)) ([948edd2](https://github.com/wundergraph/cosmo/commit/948edd23e6d0ee968c91edd1a9e9943c3405ac2d)) (@JivusAyrus)

# [0.12.0](https://github.com/wundergraph/cosmo/compare/cdn@0.11.2...cdn@0.12.0) (2025-01-08)

### Features

* expose type data and record subgraphs for enums ([#1495](https://github.com/wundergraph/cosmo/issues/1495)) ([9e13f28](https://github.com/wundergraph/cosmo/commit/9e13f28c0a90b0d2f335c9b31f35e728c4a1799c)) (@thisisnithin)

## [0.11.2](https://github.com/wundergraph/cosmo/compare/cdn@0.11.1...cdn@0.11.2) (2024-12-06)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion cdn-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ FROM --platform=${BUILDPLATFORM} node:lts-slim

WORKDIR /app

ENV NODE_ENV production
ENV NODE_ENV=production

# Fetch built artifacts
COPY --from=builder /app/pruned .
Expand Down
6 changes: 6 additions & 0 deletions cdn-server/cdn/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Binaries are attached to the github release otherwise all images can be found [h
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.8.0](https://github.com/wundergraph/cosmo/compare/@wundergraph/cosmo-cdn@0.7.1...@wundergraph/cosmo-cdn@0.8.0) (2025-01-17)

### Features

* cache warmer ([#1501](https://github.com/wundergraph/cosmo/issues/1501)) ([948edd2](https://github.com/wundergraph/cosmo/commit/948edd23e6d0ee968c91edd1a9e9943c3405ac2d)) (@JivusAyrus)

## [0.7.1](https://github.com/wundergraph/cosmo/compare/@wundergraph/cosmo-cdn@0.7.0...@wundergraph/cosmo-cdn@0.7.1) (2024-12-06)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion cdn-server/cdn/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wundergraph/cosmo-cdn",
"version": "0.7.1",
"version": "0.8.0",
"author": {
"name": "WunderGraph Maintainers",
"email": "info@wundergraph.com"
Expand Down
35 changes: 35 additions & 0 deletions cdn-server/cdn/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,36 @@ const draftRouterConfig = (storage: BlobStorage) => {
};
};

const cacheOperations = (storage: BlobStorage) => {
return async (c: Context) => {
const organizationId = c.get('authenticatedOrganizationId');
const federatedGraphId = c.get('authenticatedFederatedGraphId');

if (organizationId !== c.req.param('organization_id') || federatedGraphId !== c.req.param('federated_graph_id')) {
return c.text('Bad Request', 400);
}

const key = `${organizationId}/${federatedGraphId}/cache_warmup/operations.json`;
let blobObject: BlobObject;

try {
blobObject = await storage.getObject({ context: c, key, cacheControl: 'no-cache' });
} catch (e: any) {
if (e instanceof BlobNotFoundError) {
return c.notFound();
}
throw e;
}

c.header('Content-Type', 'application/json; charset=UTF-8');
c.header('Cache-Control', 'no-cache, no-store, must-revalidate');

return stream(c, async (stream) => {
await stream.pipe(blobObject.stream);
});
};
};

// eslint-disable-next-line @typescript-eslint/ban-types
export const cdn = <E extends Env, S extends Schema = {}, BasePath extends string = '/'>(
hono: Hono<E, S, BasePath>,
Expand All @@ -235,4 +265,9 @@ export const cdn = <E extends Env, S extends Schema = {}, BasePath extends strin
hono
.use(draftRouterConfigs, jwtMiddleware(opts.authAdmissionJwtSecret))
.get(draftRouterConfigs, draftRouterConfig(opts.blobStorage));

const cacheOperationsPath = '/:organization_id/:federated_graph_id/cache_warmup/operations.json';
hono
.use(cacheOperationsPath, jwtMiddleware(opts.authJwtSecret))
.get(cacheOperationsPath, cacheOperations(opts.blobStorage));
};
Loading