Compare commits
236 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 53141720ca | |||
|
e84df1db08
|
|||
| 9539e6bb1b | |||
| 291ef08ad7 | |||
| 98b84772df | |||
| 26278066b8 | |||
| 5bdacce71a | |||
|
0b4bbdeef0
|
|||
| 3c3c939447 | |||
|
93a12a2909
|
|||
| c36802570a | |||
| 5d64a3a45c | |||
| e55d3400e6 | |||
| 7da95e7566 | |||
| b8ea2690fc | |||
| 3689486fa8 | |||
| 1787815299 | |||
| 2886835d18 | |||
| 097e1274db | |||
| 640ede7de2 | |||
| 122c87dab4 | |||
| 4647d7ad1e | |||
| f2c73e8bf6 | |||
| ba7bbd082a | |||
| 2466d2a4ab | |||
| 86a61a1a64 | |||
| 75e85c0339 | |||
| d654ef1b81 | |||
|
55114c3d39
|
|||
| 0575c45d66 | |||
| d004745244 | |||
| 36ef6a85c2 | |||
| aa8363428f | |||
| 36a387040f | |||
| 5cf10efe15 | |||
| 73624e21d7 | |||
|
f53321368d
|
|||
|
59e0f17769
|
|||
| 8661c931a1 | |||
| f484bea8c4 | |||
| 8c4f579cef | |||
| 30ccbf9aab | |||
| 5973c1341d | |||
| 0285549431 | |||
|
3256819705
|
|||
| 578354ddeb | |||
| 12adc9bc48 | |||
| a44937e130 | |||
| 04a88bf310 | |||
| c1e5ee97ee | |||
| 66dd948181 | |||
| 6fc87e952b | |||
| dade16a10c | |||
| aa617ae11d | |||
|
a87b480345
|
|||
| 69e232cd7c | |||
| 5adfe0e711 | |||
| 7fa947a945 | |||
| a4552cb418 | |||
| c15371c236 | |||
|
aaa111dd20
|
|||
|
8e02bfb0a2
|
|||
| 1e34fe77eb | |||
| 30ca9091d2 | |||
|
4dd79e3d73
|
|||
| bdfbf6c22e | |||
| b6a281b5f2 | |||
| e8305441bb | |||
|
dd5c0f3dc0
|
|||
| f35be93cb6 | |||
| 3840c40c90 | |||
|
2ba10d763d
|
|||
| ba099eff51 | |||
| 2196f5a417 | |||
| 3e26aa0166 | |||
| fdf6402b7c | |||
| c6a5711dff | |||
| f82935e71a | |||
| b8053b6273 | |||
| 4086ddf73c | |||
| 8d5ff3863d | |||
| 19233af4a7 | |||
| b6ed3c7ad9 | |||
| 05eaa96d37 | |||
| 9b8f98c2d2 | |||
| d6a862ee94 | |||
| 574e6c8926 | |||
|
15eda6f0de
|
|||
| 46b624568e | |||
| 72bbf92265 | |||
| 313e43016b | |||
| 570a0114b3 | |||
|
a9c07bf4c2
|
|||
| f126c23b45 | |||
| 65dc35a5fc | |||
| b57080c9d0 | |||
| 19a826608c | |||
| 316d4a4c34 | |||
| 48873bf5ee | |||
| f9cce092b5 | |||
| ae8aa21388 | |||
| 7ba1d3ae08 | |||
| fd6e4a0cbd | |||
| 856b140538 | |||
| fdfbf823a6 | |||
| 697e6c3d75 | |||
| fdbb57e33a | |||
| 07057d7206 | |||
| d0afaa7815 | |||
|
ee378dc6a3
|
|||
|
7ffa9a3881
|
|||
|
683bf6bd85
|
|||
|
17a3edbc07
|
|||
|
318e211196
|
|||
| bf0b8f5935 | |||
| 1232ca62b2 | |||
| f6a1e47361 | |||
| f96e6e860b | |||
| 44cc6ccd16 | |||
| 6abc49a3fc | |||
| 7d7836fedf | |||
|
f62a8037bc
|
|||
| 08bba81ba0 | |||
| 881ff122f8 | |||
| 0d384e8a3f | |||
|
f49156f637
|
|||
| 62869e4a77 | |||
| ab2c55fb39 | |||
| ef271a88a9 | |||
|
14d3733bf5
|
|||
| 2cc4e379bc | |||
| d39427c9ff | |||
| 2cb2ba9754 | |||
| 53d5c21b77 | |||
| 2b09f6c3c5 | |||
| 9f2be264c3 | |||
| 31e8d8cd49 | |||
| b4e4c9e2e3 | |||
| 35bf4eb6dc | |||
| 7ddca97cce | |||
| 3a78d90c4b | |||
|
84b7d2bf74
|
|||
| 16008218a5 | |||
| 0908099d34 | |||
|
74823a8947
|
|||
| c5dcc6f87a | |||
| 8f2a88f405 | |||
| d88b6f2ee8 | |||
| 21e32b5b09 | |||
| cd08e429e8 | |||
| 73fdd8a2e7 | |||
| c73a6a2c1f | |||
| 22e0952012 | |||
| fe52ddbb3a | |||
| e229458c39 | |||
| c64f5ce1df | |||
| 7a95c98573 | |||
| 03ba8a774c | |||
| 23da66078a | |||
| 1e50301c3c | |||
| 8de129c925 | |||
| 660f07f3cd | |||
| fed6e512d3 | |||
| f1b7a36103 | |||
| 74ee419e56 | |||
| f8aa95ccd5 | |||
| e013762fd9 | |||
| f1ca04fb07 | |||
|
4be0518209
|
|||
| 649c297d5b | |||
| bc43aa3fae | |||
|
2861e9d067
|
|||
| cc668505e6 | |||
| 7af4548a8b | |||
| 8ce0fffb02 | |||
| 03cd2ab9a3 | |||
|
6bf0e2c12b
|
|||
| 6fc27915c9 | |||
| f18dbcae92 | |||
| c4ac7c6b6c | |||
| d8681ac484 | |||
| 75d9b9d719 | |||
| 09909ed26c | |||
| 68b80c51c1 | |||
| feec5b7bf2 | |||
|
b1c31afed3
|
|||
|
7fc195e44e
|
|||
| 8cb62f47b3 | |||
|
52ffdde1ca
|
|||
|
75909a3797
|
|||
| d605d8fa63 | |||
| 6809635518 | |||
| ffde98ffa7 | |||
| e14974623b | |||
| 1ac137a27d | |||
| b6fe4a34a3 | |||
| 8c269381d5 | |||
| 523be169ad | |||
| d3d197ab65 | |||
| 3992e6f61d | |||
| 92c7880271 | |||
| 1017c29527 | |||
| 1016a20fc3 | |||
| 9b388ef2eb | |||
| d8287c0797 | |||
| 1258c47ef5 | |||
| 01a6a79fd9 | |||
| dd7786d690 | |||
| d717fddec9 | |||
| cfa48a2b81 | |||
| 49cc4b392f | |||
| f9625ac4f5 | |||
| 91f232c54c | |||
| a97ed6018a | |||
| 9ccea01c4c | |||
| ad68feb8af | |||
|
9200aad878
|
|||
| 8cfa8a7e75 | |||
| 2720e14e8b | |||
| aed67aa0a3 | |||
| a7ce266a41 | |||
| 2235427f48 | |||
|
d07a714d3c
|
|||
| ce366061fc | |||
| 6200594ac6 | |||
| fcda9f1c46 | |||
| 6c505385e4 | |||
| 765a9abc04 | |||
| e8c1a56f40 | |||
| 06bb2d9ea8 | |||
|
e6152b379f
|
|||
| d5a171eb76 | |||
| 5472216ae8 | |||
| f364b7c8c7 | |||
| 9ceecd52f6 | |||
| 846614ca2f |
+12
-25
@@ -1,7 +1,11 @@
|
|||||||
include:
|
include:
|
||||||
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
|
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
|
||||||
|
- project: unboundsoftware/ci-templates
|
||||||
|
file: Defaults.gitlab-ci.yml
|
||||||
- project: unboundsoftware/ci-templates
|
- project: unboundsoftware/ci-templates
|
||||||
file: Release.gitlab-ci.yml
|
file: Release.gitlab-ci.yml
|
||||||
|
- project: unboundsoftware/ci-templates
|
||||||
|
file: Pre-Commit-Go.gitlab-ci.yml
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
@@ -11,34 +15,13 @@ stages:
|
|||||||
|
|
||||||
variables:
|
variables:
|
||||||
UNBOUND_RELEASE_TAG_ONLY: true
|
UNBOUND_RELEASE_TAG_ONLY: true
|
||||||
DOCKER_HOST: tcp://docker:2376
|
|
||||||
DOCKER_TLS_CERTDIR: "/certs"
|
|
||||||
DOCKER_TLS_VERIFY: 1
|
|
||||||
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
|
|
||||||
DOCKER_DRIVER: overlay2
|
|
||||||
|
|
||||||
.buildtools:
|
.buildtools:
|
||||||
image: buildtool/build-tools:${BUILDTOOLS_VERSION}
|
image: buildtool/build-tools:${BUILDTOOLS_VERSION}
|
||||||
services:
|
|
||||||
- docker:${DOCKER_DIND_VERSION}
|
|
||||||
|
|
||||||
run-pre-commit:
|
|
||||||
stage: .pre
|
|
||||||
image: unbound/pre-commit
|
|
||||||
variables:
|
|
||||||
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
|
|
||||||
cache:
|
|
||||||
- key:
|
|
||||||
files:
|
|
||||||
- .pre-commit-config.yaml
|
|
||||||
paths:
|
|
||||||
- ${PRE_COMMIT_HOME}
|
|
||||||
script:
|
|
||||||
- pre-commit run --all-files
|
|
||||||
|
|
||||||
check:
|
check:
|
||||||
stage: .pre
|
stage: .pre
|
||||||
image: golang:1.23.2
|
image: amd64/golang:1.24.4@sha256:3494bbe140127d12656113203ec91b8e3ff34e8a2b06a0a22bb0d8a41cc69e53
|
||||||
script:
|
script:
|
||||||
- go install mvdan.cc/gofumpt@latest
|
- go install mvdan.cc/gofumpt@latest
|
||||||
- go install golang.org/x/tools/cmd/goimports@latest
|
- go install golang.org/x/tools/cmd/goimports@latest
|
||||||
@@ -57,7 +40,7 @@ build:
|
|||||||
|
|
||||||
vulnerabilities:
|
vulnerabilities:
|
||||||
stage: build
|
stage: build
|
||||||
image: golang:1.23.2
|
image: amd64/golang:1.24.4@sha256:3494bbe140127d12656113203ec91b8e3ff34e8a2b06a0a22bb0d8a41cc69e53
|
||||||
script:
|
script:
|
||||||
- go install golang.org/x/vuln/cmd/govulncheck@latest
|
- go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||||
- govulncheck ./...
|
- govulncheck ./...
|
||||||
@@ -73,12 +56,15 @@ deploy-prod:
|
|||||||
- if: $CI_COMMIT_BRANCH == "main"
|
- if: $CI_COMMIT_BRANCH == "main"
|
||||||
environment:
|
environment:
|
||||||
name: prod
|
name: prod
|
||||||
|
resource_group: prod
|
||||||
|
|
||||||
check_release:
|
check_release:
|
||||||
stage: test
|
stage: test
|
||||||
image:
|
image:
|
||||||
name: goreleaser/goreleaser:v2.3.2
|
name: goreleaser/goreleaser:v2.10.2@sha256:ebc884882268c835edd70c628dbdf830481ae23a569b343cd7d7b178c91573ac
|
||||||
entrypoint: [ '' ]
|
entrypoint: [ '' ]
|
||||||
|
variables:
|
||||||
|
GOTOOLCHAIN: auto
|
||||||
script: |
|
script: |
|
||||||
goreleaser check
|
goreleaser check
|
||||||
goreleaser release --snapshot --clean
|
goreleaser release --snapshot --clean
|
||||||
@@ -88,13 +74,14 @@ release:
|
|||||||
needs:
|
needs:
|
||||||
- unbound_release_prepare_release
|
- unbound_release_prepare_release
|
||||||
image:
|
image:
|
||||||
name: goreleaser/goreleaser:v2.3.2
|
name: goreleaser/goreleaser:v2.10.2@sha256:ebc884882268c835edd70c628dbdf830481ae23a569b343cd7d7b178c91573ac
|
||||||
entrypoint: [ '' ]
|
entrypoint: [ '' ]
|
||||||
variables:
|
variables:
|
||||||
# Disable shallow cloning so that goreleaser can diff between tags to
|
# Disable shallow cloning so that goreleaser can diff between tags to
|
||||||
# generate a changelog.
|
# generate a changelog.
|
||||||
GIT_DEPTH: 0
|
GIT_DEPTH: 0
|
||||||
GITLAB_TOKEN: $GITLAB_CI_TOKEN
|
GITLAB_TOKEN: $GITLAB_CI_TOKEN
|
||||||
|
GOTOOLCHAIN: auto
|
||||||
# Only run this release job for tags, not every commit (for example).
|
# Only run this release job for tags, not every commit (for example).
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_TAG
|
- if: $CI_COMMIT_TAG
|
||||||
|
|||||||
@@ -1,2 +1,22 @@
|
|||||||
|
version: "2"
|
||||||
run:
|
run:
|
||||||
allow-parallel-runners: true
|
allow-parallel-runners: true
|
||||||
|
linters:
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
presets:
|
||||||
|
- comments
|
||||||
|
- common-false-positives
|
||||||
|
- legacy
|
||||||
|
- std-error-handling
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
|
formatters:
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
|
|||||||
+10
-4
@@ -16,18 +16,24 @@ builds:
|
|||||||
- amd64
|
- amd64
|
||||||
- arm64
|
- arm64
|
||||||
|
|
||||||
brews:
|
homebrew_casks:
|
||||||
- name: unbound-schemas
|
- name: unbound-schemas
|
||||||
repository:
|
repository:
|
||||||
owner: unboundsoftware
|
owner: unboundsoftware
|
||||||
name: homebrew-taps
|
name: homebrew-taps
|
||||||
directory: Formula
|
binary: schemactl
|
||||||
install: |
|
directory: Casks
|
||||||
bin.install "schemactl"
|
conflicts:
|
||||||
|
- formula: unbound-schemas
|
||||||
commit_author:
|
commit_author:
|
||||||
name: "Joakim Olsson"
|
name: "Joakim Olsson"
|
||||||
email: joakim@unbound.se
|
email: joakim@unbound.se
|
||||||
homepage: "https://schemas.unbound.se/"
|
homepage: "https://schemas.unbound.se/"
|
||||||
|
hooks:
|
||||||
|
post:
|
||||||
|
install: |
|
||||||
|
# replace foo with the actual binary name
|
||||||
|
system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/schemactl"]
|
||||||
|
|
||||||
archives:
|
archives:
|
||||||
- id: unbound-schemas
|
- id: unbound-schemas
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ repos:
|
|||||||
- --project
|
- --project
|
||||||
- unboundsoftware/schemas
|
- unboundsoftware/schemas
|
||||||
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
|
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
|
||||||
rev: v9.18.0
|
rev: v9.22.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: commitlint
|
- id: commitlint
|
||||||
stages: [ commit-msg ]
|
stages: [ commit-msg ]
|
||||||
@@ -37,11 +37,11 @@ repos:
|
|||||||
- id: go-test
|
- id: go-test
|
||||||
- id: gofumpt
|
- id: gofumpt
|
||||||
- repo: https://github.com/golangci/golangci-lint
|
- repo: https://github.com/golangci/golangci-lint
|
||||||
rev: v1.61.0
|
rev: v2.1.6
|
||||||
hooks:
|
hooks:
|
||||||
- id: golangci-lint-full
|
- id: golangci-lint-full
|
||||||
- repo: https://github.com/gitleaks/gitleaks
|
- repo: https://github.com/gitleaks/gitleaks
|
||||||
rev: v8.21.1
|
rev: v8.27.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: gitleaks
|
- id: gitleaks
|
||||||
exclude: '^ctl/generated.go|graph/generated/.*$|^graph/model/models_gen.go|^tools/.*$$'
|
exclude: '^ctl/generated.go|graph/generated/.*$|^graph/model/models_gen.go|^tools/.*$$'
|
||||||
|
|||||||
+201
@@ -2,6 +2,207 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [0.5.3] - 2025-06-13
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.187
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.188
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.189
|
||||||
|
|
||||||
|
### 🚜 Refactor
|
||||||
|
|
||||||
|
- Remove Sentry integration and replace with OpenTelemetry
|
||||||
|
|
||||||
|
## [0.5.2] - 2025-06-09
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- *(goreleaser)* Specify binary name in configuration
|
||||||
|
|
||||||
|
## [0.5.1] - 2025-06-09
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- *(deps)* Update module github.com/alecthomas/kong to v1.11.0
|
||||||
|
- *(deps)* Update module github.com/getsentry/sentry-go to v0.33.0
|
||||||
|
- *(deps)* Update module github.com/khan/genqlient to v0.8.1
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.179
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.180
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.181
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.182
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.183
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.74
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.184
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.185
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.186
|
||||||
|
|
||||||
|
## [0.5.0] - 2025-05-15
|
||||||
|
|
||||||
|
### 🚀 Features
|
||||||
|
|
||||||
|
- *(k8s)* Add PodDisruptionBudget for schemas service
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- *(deps)* Update module github.com/vektah/gqlparser/v2 to v2.5.26
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.173
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.174
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.175
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.176
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.73
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.177
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.178
|
||||||
|
- *(deps)* Update module github.com/pressly/goose/v3 to v3.24.3
|
||||||
|
- *(deps)* Update module github.com/vektah/gqlparser/v2 to v2.5.27
|
||||||
|
- *(k8s)* Update apiVersion for external secrets
|
||||||
|
|
||||||
|
### ⚙️ Miscellaneous Tasks
|
||||||
|
|
||||||
|
- *(ci)* Update GitLab CI configuration for templates
|
||||||
|
|
||||||
|
## [0.4.1] - 2025-04-24
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- *(deps)* Update module github.com/vektah/gqlparser/v2 to v2.5.25
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.170
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.71
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.72
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.171
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.172
|
||||||
|
|
||||||
|
## [0.4.0] - 2025-04-12
|
||||||
|
|
||||||
|
### 🚀 Features
|
||||||
|
|
||||||
|
- *(service)* Implement graceful shutdown for HTTP server
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- *(secrets)* Remove namespace from ExternalSecret definition
|
||||||
|
- *(deps)* Update module github.com/sparetimecoders/goamqp to v0.3.2
|
||||||
|
- *(deps)* Update module github.com/vektah/gqlparser/v2 to v2.5.24
|
||||||
|
- *(deps)* Update module github.com/getsentry/sentry-go to v0.32.0
|
||||||
|
- *(k8s)* Increase CPU request for better performance
|
||||||
|
- *(deps)* Update module gitlab.com/unboundsoftware/eventsourced/amqp to v1.8.1
|
||||||
|
|
||||||
|
### 🚜 Refactor
|
||||||
|
|
||||||
|
- *(deploy)* Remove cpu and memory limits for schemas
|
||||||
|
|
||||||
|
## [0.3.0] - 2025-04-08
|
||||||
|
|
||||||
|
### 🚀 Features
|
||||||
|
|
||||||
|
- *(k8s)* Add RabbitMQ configurations and update secrets
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.161
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.162
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.163
|
||||||
|
- *(deps)* Update module github.com/auth0/go-jwt-middleware/v2 to v2.3.0
|
||||||
|
- *(deps)* Update module gitlab.com/unboundsoftware/eventsourced/eventsourced to v1.18.0
|
||||||
|
- *(deps)* Update module gitlab.com/unboundsoftware/eventsourced/eventsourced to v1.18.1
|
||||||
|
- *(deps)* Update module github.com/alecthomas/kong to v1.9.0
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.164
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.165
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.68
|
||||||
|
- *(deps)* Update module github.com/golang-jwt/jwt/v5 to v5.2.2
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.166
|
||||||
|
- *(deps)* Update module gitlab.com/unboundsoftware/eventsourced/eventsourced to v1.19.0
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.69
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.70
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.167
|
||||||
|
- *(deps)* Update module gitlab.com/unboundsoftware/eventsourced/eventsourced to v1.19.1
|
||||||
|
- *(deps)* Update module github.com/pressly/goose/v3 to v3.24.2
|
||||||
|
- *(deps)* Update module github.com/alecthomas/kong to v1.10.0
|
||||||
|
- *(deps)* Update eventsourced
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.168
|
||||||
|
- *(deps)* Update module github.com/wundergraph/graphql-go-tools/v2 to v2.0.0-rc.169
|
||||||
|
|
||||||
|
## [0.2.0] - 2025-02-28
|
||||||
|
|
||||||
|
### 🚀 Features
|
||||||
|
|
||||||
|
- *(dependencies)* Add Eventsourced package group for updates
|
||||||
|
- *(sdlmerge)* Add shared types for GraphQL schema handling
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.64
|
||||||
|
- *(deps)* Update module github.com/alecthomas/kong to v1.7.0
|
||||||
|
- *(deps)* Update module github.com/khan/genqlient to v0.8.0
|
||||||
|
- *(deps)* Update module github.com/alecthomas/kong to v1.8.0
|
||||||
|
- *(ci)* Update golang image to improve compatibility
|
||||||
|
- *(ci)* Add resource group to production deployment configuration
|
||||||
|
- *(deps)* Update module github.com/alecthomas/kong to v1.8.1
|
||||||
|
- *(deps)* Update dependencies to latest versions
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.65
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.66
|
||||||
|
- *(deps)* Update eventsourced
|
||||||
|
- *(deps)* Update module github.com/vektah/gqlparser/v2 to v2.5.23
|
||||||
|
|
||||||
|
### ⚙️ Miscellaneous Tasks
|
||||||
|
|
||||||
|
- *(go)* Update go version to 1.23.6 and remove toolchain
|
||||||
|
- *(docker)* Update base image architecture to amd64
|
||||||
|
|
||||||
|
## [0.1.1] - 2025-01-24
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- *(deps)* Update module github.com/getsentry/sentry-go to v0.31.0
|
||||||
|
- *(deps)* Update module github.com/getsentry/sentry-go to v0.31.1
|
||||||
|
- *(deps)* Update module github.com/alecthomas/kong to v1.6.1
|
||||||
|
- *(deps)* Update module github.com/pressly/goose/v3 to v3.24.1
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.63
|
||||||
|
- *(k8s)* Standardize app label to app.kubernetes.io/name
|
||||||
|
|
||||||
|
## [0.1.0] - 2025-01-01
|
||||||
|
|
||||||
|
### 🚀 Features
|
||||||
|
|
||||||
|
- Add timeout configuration to golangci-lint
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- *(deps)* Update module github.com/alecthomas/kong to v1.3.0
|
||||||
|
- No digest pinning of own image
|
||||||
|
- *(deps)* Update module github.com/alecthomas/kong to v1.4.0
|
||||||
|
- *(deps)* Update module github.com/vektah/gqlparser/v2 to v2.5.19
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.56
|
||||||
|
- *(deps)* Update module github.com/pressly/goose/v3 to v3.23.0
|
||||||
|
- *(deps)* Update module github.com/stretchr/testify to v1.10.0
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.57
|
||||||
|
- *(deps)* Update module github.com/vektah/gqlparser/v2 to v2.5.20
|
||||||
|
- *(deps)* Update module gitlab.com/unboundsoftware/eventsourced/eventsourced to v1.16.0
|
||||||
|
- *(deps)* Update module gitlab.com/unboundsoftware/eventsourced/amqp to v1.7.0
|
||||||
|
- *(deps)* Update module gitlab.com/unboundsoftware/eventsourced/pg to v1.15.0
|
||||||
|
- *(deps)* Update module github.com/alecthomas/kong to v1.5.0
|
||||||
|
- *(deps)* Update module github.com/alecthomas/kong to v1.5.1
|
||||||
|
- *(deps)* Update module github.com/getsentry/sentry-go to v0.30.0
|
||||||
|
- *(deps)* Update module github.com/alecthomas/kong to v1.6.0
|
||||||
|
- *(k8s)* Adjust CPU requests for better resource allocation
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.58
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.59
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.60
|
||||||
|
- *(deps)* Update module github.com/pressly/goose/v3 to v3.23.1
|
||||||
|
- *(deps)* Update module github.com/pressly/goose/v3 to v3.24.0
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.61
|
||||||
|
- *(deps)* Update module github.com/vektah/gqlparser/v2 to v2.5.21
|
||||||
|
- *(deps)* Update module github.com/99designs/gqlgen to v0.17.62
|
||||||
|
|
||||||
|
### 🚜 Refactor
|
||||||
|
|
||||||
|
- Use common pre-commit job
|
||||||
|
|
||||||
|
### ⚙️ Miscellaneous Tasks
|
||||||
|
|
||||||
|
- Remove unnecessary Docker variables from configuration
|
||||||
|
- *(ci)* Remove unused docker service from buildtools
|
||||||
|
|
||||||
## [0.0.7] - 2024-10-22
|
## [0.0.7] - 2024-10-22
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.23.2 as modules
|
FROM amd64/golang:1.24.4@sha256:3494bbe140127d12656113203ec91b8e3ff34e8a2b06a0a22bb0d8a41cc69e53 as modules
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
ADD go.* /build
|
ADD go.* /build
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,9 +2,9 @@ package cache
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log/slog"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/apex/log"
|
|
||||||
"github.com/sparetimecoders/goamqp"
|
"github.com/sparetimecoders/goamqp"
|
||||||
|
|
||||||
"gitlab.com/unboundsoftware/schemas/domain"
|
"gitlab.com/unboundsoftware/schemas/domain"
|
||||||
@@ -18,7 +18,7 @@ type Cache struct {
|
|||||||
services map[string]map[string]map[string]struct{}
|
services map[string]map[string]map[string]struct{}
|
||||||
subGraphs map[string]string
|
subGraphs map[string]string
|
||||||
lastUpdate map[string]string
|
lastUpdate map[string]string
|
||||||
logger log.Interface
|
logger *slog.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cache) OrganizationByAPIKey(apiKey string) *domain.Organization {
|
func (c *Cache) OrganizationByAPIKey(apiKey string) *domain.Organization {
|
||||||
@@ -98,7 +98,7 @@ func (c *Cache) Update(msg any, _ goamqp.Headers) (any, error) {
|
|||||||
case *domain.SubGraph:
|
case *domain.SubGraph:
|
||||||
c.updateSubGraph(m.OrganizationId, m.Ref, m.ID.String(), m.Service, m.ChangedAt)
|
c.updateSubGraph(m.OrganizationId, m.Ref, m.ID.String(), m.Service, m.ChangedAt)
|
||||||
default:
|
default:
|
||||||
c.logger.Warnf("unexpected message received: %+v", msg)
|
c.logger.With("msg", msg).Warn("unexpected message received")
|
||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ func (c *Cache) addUser(sub string, organization domain.Organization) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(logger log.Interface) *Cache {
|
func New(logger *slog.Logger) *Cache {
|
||||||
return &Cache{
|
return &Cache{
|
||||||
organizations: make(map[string]domain.Organization),
|
organizations: make(map[string]domain.Organization),
|
||||||
users: make(map[string][]string),
|
users: make(map[string][]string),
|
||||||
|
|||||||
+49
-65
@@ -2,7 +2,9 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@@ -12,14 +14,14 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/99designs/gqlgen/graphql/handler"
|
"github.com/99designs/gqlgen/graphql/handler"
|
||||||
|
"github.com/99designs/gqlgen/graphql/handler/extension"
|
||||||
|
"github.com/99designs/gqlgen/graphql/handler/lru"
|
||||||
|
"github.com/99designs/gqlgen/graphql/handler/transport"
|
||||||
"github.com/99designs/gqlgen/graphql/playground"
|
"github.com/99designs/gqlgen/graphql/playground"
|
||||||
"github.com/alecthomas/kong"
|
"github.com/alecthomas/kong"
|
||||||
"github.com/apex/log"
|
|
||||||
"github.com/apex/log/handlers/json"
|
|
||||||
"github.com/getsentry/sentry-go"
|
|
||||||
sentryhttp "github.com/getsentry/sentry-go/http"
|
|
||||||
"github.com/rs/cors"
|
"github.com/rs/cors"
|
||||||
"github.com/sparetimecoders/goamqp"
|
"github.com/sparetimecoders/goamqp"
|
||||||
|
"github.com/vektah/gqlparser/v2/ast"
|
||||||
"gitlab.com/unboundsoftware/eventsourced/amqp"
|
"gitlab.com/unboundsoftware/eventsourced/amqp"
|
||||||
"gitlab.com/unboundsoftware/eventsourced/eventsourced"
|
"gitlab.com/unboundsoftware/eventsourced/eventsourced"
|
||||||
"gitlab.com/unboundsoftware/eventsourced/pg"
|
"gitlab.com/unboundsoftware/eventsourced/pg"
|
||||||
@@ -28,7 +30,9 @@ import (
|
|||||||
"gitlab.com/unboundsoftware/schemas/domain"
|
"gitlab.com/unboundsoftware/schemas/domain"
|
||||||
"gitlab.com/unboundsoftware/schemas/graph"
|
"gitlab.com/unboundsoftware/schemas/graph"
|
||||||
"gitlab.com/unboundsoftware/schemas/graph/generated"
|
"gitlab.com/unboundsoftware/schemas/graph/generated"
|
||||||
|
"gitlab.com/unboundsoftware/schemas/logging"
|
||||||
"gitlab.com/unboundsoftware/schemas/middleware"
|
"gitlab.com/unboundsoftware/schemas/middleware"
|
||||||
|
"gitlab.com/unboundsoftware/schemas/monitoring"
|
||||||
"gitlab.com/unboundsoftware/schemas/store"
|
"gitlab.com/unboundsoftware/schemas/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -36,16 +40,12 @@ type CLI struct {
|
|||||||
AmqpURL string `name:"amqp-url" env:"AMQP_URL" help:"URL to use to connect to RabbitMQ" default:"amqp://user:password@unbound-control-plane.orb.local:5672/"`
|
AmqpURL string `name:"amqp-url" env:"AMQP_URL" help:"URL to use to connect to RabbitMQ" default:"amqp://user:password@unbound-control-plane.orb.local:5672/"`
|
||||||
Port int `name:"port" env:"PORT" help:"Listen-port for GraphQL API" default:"8080"`
|
Port int `name:"port" env:"PORT" help:"Listen-port for GraphQL API" default:"8080"`
|
||||||
LogLevel string `name:"log-level" env:"LOG_LEVEL" help:"The level of logging to use (debug, info, warn, error, fatal)" default:"info"`
|
LogLevel string `name:"log-level" env:"LOG_LEVEL" help:"The level of logging to use (debug, info, warn, error, fatal)" default:"info"`
|
||||||
|
LogFormat string `name:"log-format" env:"LOG_FORMAT" help:"The format of logs" default:"text" enum:"otel,json,text"`
|
||||||
DatabaseURL string `name:"postgres-url" env:"POSTGRES_URL" help:"URL to use to connect to Postgres" default:"postgres://postgres:postgres@unbound-control-plane.orb.local:5432/schemas?sslmode=disable"`
|
DatabaseURL string `name:"postgres-url" env:"POSTGRES_URL" help:"URL to use to connect to Postgres" default:"postgres://postgres:postgres@unbound-control-plane.orb.local:5432/schemas?sslmode=disable"`
|
||||||
DatabaseDriverName string `name:"db-driver" env:"DB_DRIVER" help:"Driver to use to connect to db" default:"postgres"`
|
DatabaseDriverName string `name:"db-driver" env:"DB_DRIVER" help:"Driver to use to connect to db" default:"postgres"`
|
||||||
Issuer string `name:"issuer" env:"ISSUER" help:"The JWT token issuer to use" default:"unbound.eu.auth0.com"`
|
Issuer string `name:"issuer" env:"ISSUER" help:"The JWT token issuer to use" default:"unbound.eu.auth0.com"`
|
||||||
StrictSSL bool `name:"strict-ssl" env:"STRICT_SSL" help:"Should strict SSL handling be enabled" default:"true"`
|
StrictSSL bool `name:"strict-ssl" env:"STRICT_SSL" help:"Should strict SSL handling be enabled" default:"true"`
|
||||||
SentryConfig
|
Environment string `name:"environment" env:"ENVIRONMENT" help:"The environment we are running in" default:"development" enum:"development,staging,production"`
|
||||||
}
|
|
||||||
|
|
||||||
type SentryConfig struct {
|
|
||||||
DSN string `name:"sentry-dsn" env:"SENTRY_DSN" help:"Sentry dsn" default:""`
|
|
||||||
Environment string `name:"sentry-environment" env:"SENTRY_ENVIRONMENT" help:"Sentry environment" default:"development"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var buildVersion = "none"
|
var buildVersion = "none"
|
||||||
@@ -55,9 +55,7 @@ const serviceName = "schemas"
|
|||||||
func main() {
|
func main() {
|
||||||
var cli CLI
|
var cli CLI
|
||||||
_ = kong.Parse(&cli)
|
_ = kong.Parse(&cli)
|
||||||
log.SetHandler(json.New(os.Stdout))
|
logger := logging.SetupLogger(cli.LogLevel, cli.LogFormat, serviceName, buildVersion)
|
||||||
log.SetLevelFromString(cli.LogLevel)
|
|
||||||
logger := log.WithField("service", serviceName)
|
|
||||||
closeEvents := make(chan error)
|
closeEvents := make(chan error)
|
||||||
|
|
||||||
if err := start(
|
if err := start(
|
||||||
@@ -66,19 +64,22 @@ func main() {
|
|||||||
ConnectAMQP,
|
ConnectAMQP,
|
||||||
cli,
|
cli,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
logger.WithError(err).Error("process error")
|
logger.With("error", err).Error("process error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func start(closeEvents chan error, logger *log.Entry, connectToAmqpFunc func(url string) (Connection, error), cli CLI) error {
|
func start(closeEvents chan error, logger *slog.Logger, connectToAmqpFunc func(url string) (Connection, error), cli CLI) error {
|
||||||
if err := setupSentry(logger, cli.SentryConfig); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer sentry.Flush(2 * time.Second)
|
|
||||||
|
|
||||||
rootCtx, rootCancel := context.WithCancel(context.Background())
|
rootCtx, rootCancel := context.WithCancel(context.Background())
|
||||||
defer rootCancel()
|
defer rootCancel()
|
||||||
|
|
||||||
|
shutdownFn, err := monitoring.SetupOTelSDK(rootCtx, cli.LogFormat == "otel", serviceName, buildVersion, cli.Environment)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
_ = errors.Join(shutdownFn(context.Background()))
|
||||||
|
}()
|
||||||
|
|
||||||
db, err := store.SetupDB(cli.DatabaseDriverName, cli.DatabaseURL)
|
db, err := store.SetupDB(cli.DatabaseDriverName, cli.DatabaseURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to setup DB: %v", err)
|
return fmt.Errorf("failed to setup DB: %v", err)
|
||||||
@@ -119,7 +120,7 @@ func start(closeEvents chan error, logger *log.Entry, connectToAmqpFunc func(url
|
|||||||
return fmt.Errorf("caching subgraphs: %w", err)
|
return fmt.Errorf("caching subgraphs: %w", err)
|
||||||
}
|
}
|
||||||
setups := []goamqp.Setup{
|
setups := []goamqp.Setup{
|
||||||
goamqp.UseLogger(logger.Error),
|
goamqp.UseLogger(func(s string) { logger.Error(s) }),
|
||||||
goamqp.CloseListener(closeEvents),
|
goamqp.CloseListener(closeEvents),
|
||||||
goamqp.WithPrefetchLimit(20),
|
goamqp.WithPrefetchLimit(20),
|
||||||
goamqp.EventStreamPublisher(publisher),
|
goamqp.EventStreamPublisher(publisher),
|
||||||
@@ -165,7 +166,7 @@ func start(closeEvents chan error, logger *log.Entry, connectToAmqpFunc func(url
|
|||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
err := <-closeEvents
|
err := <-closeEvents
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.WithError(err).Error("received close from AMQP")
|
logger.With("error", err).Error("received close from AMQP")
|
||||||
rootCancel()
|
rootCancel()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -175,8 +176,11 @@ func start(closeEvents chan error, logger *log.Entry, connectToAmqpFunc func(url
|
|||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
<-rootCtx.Done()
|
<-rootCtx.Done()
|
||||||
|
|
||||||
if err := httpSrv.Close(); err != nil {
|
shutdownCtx, shutdownRelease := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
logger.WithError(err).Error("close http server")
|
defer shutdownRelease()
|
||||||
|
|
||||||
|
if err := httpSrv.Shutdown(shutdownCtx); err != nil {
|
||||||
|
logger.With("error", err).Error("close http server")
|
||||||
}
|
}
|
||||||
close(sigint)
|
close(sigint)
|
||||||
close(closeEvents)
|
close(closeEvents)
|
||||||
@@ -201,15 +205,27 @@ func start(closeEvents chan error, logger *log.Entry, connectToAmqpFunc func(url
|
|||||||
mw := middleware.NewAuth0("https://schemas.unbound.se", cli.Issuer, cli.StrictSSL)
|
mw := middleware.NewAuth0("https://schemas.unbound.se", cli.Issuer, cli.StrictSSL)
|
||||||
authMiddleware := middleware.NewAuth(serviceCache)
|
authMiddleware := middleware.NewAuth(serviceCache)
|
||||||
config.Directives.Auth = authMiddleware.Directive
|
config.Directives.Auth = authMiddleware.Directive
|
||||||
srv := handler.NewDefaultServer(generated.NewExecutableSchema(
|
srv := handler.New(generated.NewExecutableSchema(config))
|
||||||
config,
|
|
||||||
))
|
|
||||||
|
|
||||||
sentryHandler := sentryhttp.New(sentryhttp.Options{Repanic: true})
|
srv.AddTransport(transport.Websocket{
|
||||||
mux.Handle("/", sentryHandler.HandleFunc(playground.Handler("GraphQL playground", "/query")))
|
KeepAlivePingInterval: 10 * time.Second,
|
||||||
|
})
|
||||||
|
srv.AddTransport(transport.Options{})
|
||||||
|
srv.AddTransport(transport.GET{})
|
||||||
|
srv.AddTransport(transport.POST{})
|
||||||
|
srv.AddTransport(transport.MultipartForm{})
|
||||||
|
|
||||||
|
srv.SetQueryCache(lru.New[*ast.QueryDocument](1000))
|
||||||
|
|
||||||
|
srv.Use(extension.Introspection{})
|
||||||
|
srv.Use(extension.AutomaticPersistedQuery{
|
||||||
|
Cache: lru.New[string](100),
|
||||||
|
})
|
||||||
|
|
||||||
|
mux.Handle("/", monitoring.Handler(playground.Handler("GraphQL playground", "/query")))
|
||||||
mux.Handle("/health", http.HandlerFunc(healthFunc))
|
mux.Handle("/health", http.HandlerFunc(healthFunc))
|
||||||
mux.Handle("/query", cors.AllowAll().Handler(
|
mux.Handle("/query", cors.AllowAll().Handler(
|
||||||
sentryHandler.Handle(
|
monitoring.Handler(
|
||||||
mw.Middleware().CheckJWT(
|
mw.Middleware().CheckJWT(
|
||||||
apiKeyMiddleware.Handler(
|
apiKeyMiddleware.Handler(
|
||||||
authMiddleware.Handler(srv),
|
authMiddleware.Handler(srv),
|
||||||
@@ -218,10 +234,10 @@ func start(closeEvents chan error, logger *log.Entry, connectToAmqpFunc func(url
|
|||||||
),
|
),
|
||||||
))
|
))
|
||||||
|
|
||||||
logger.Infof("connect to http://localhost:%d/ for GraphQL playground", cli.Port)
|
logger.Info(fmt.Sprintf("connect to http://localhost:%d/ for GraphQL playground", cli.Port))
|
||||||
|
|
||||||
if err := httpSrv.ListenAndServe(); err != nil {
|
if err := httpSrv.ListenAndServe(); !errors.Is(err, http.ErrServerClosed) {
|
||||||
logger.WithError(err).Error("listen http")
|
logger.With("error", err).Error("listen http")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@@ -270,38 +286,6 @@ func healthFunc(w http.ResponseWriter, _ *http.Request) {
|
|||||||
_, _ = w.Write([]byte("OK"))
|
_, _ = w.Write([]byte("OK"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupSentry(logger log.Interface, args SentryConfig) error {
|
|
||||||
if args.Environment == "" {
|
|
||||||
return fmt.Errorf("no Sentry environment supplied, exiting")
|
|
||||||
}
|
|
||||||
cfg := sentry.ClientOptions{
|
|
||||||
Dsn: args.DSN,
|
|
||||||
Environment: args.Environment,
|
|
||||||
Release: fmt.Sprintf("%s-%s", serviceName, buildVersion),
|
|
||||||
}
|
|
||||||
switch args.Environment {
|
|
||||||
case "development":
|
|
||||||
cfg.Debug = true
|
|
||||||
cfg.EnableTracing = false
|
|
||||||
cfg.TracesSampleRate = 0.0
|
|
||||||
case "production":
|
|
||||||
if args.DSN == "" {
|
|
||||||
return fmt.Errorf("no DSN supplied for non-dev environment, exiting")
|
|
||||||
}
|
|
||||||
cfg.Debug = false
|
|
||||||
cfg.EnableTracing = true
|
|
||||||
cfg.TracesSampleRate = 0.01
|
|
||||||
default:
|
|
||||||
return fmt.Errorf("illegal environment %s", args.Environment)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := sentry.Init(cfg); err != nil {
|
|
||||||
return fmt.Errorf("sentry setup: %w", err)
|
|
||||||
}
|
|
||||||
logger.Infof("configured Sentry for env: %s", args.Environment)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func ConnectAMQP(url string) (Connection, error) {
|
func ConnectAMQP(url string) (Connection, error) {
|
||||||
return goamqp.NewFromURL(serviceName, url)
|
return goamqp.NewFromURL(serviceName, url)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,61 +1,79 @@
|
|||||||
module gitlab.com/unboundsoftware/schemas
|
module gitlab.com/unboundsoftware/schemas
|
||||||
|
|
||||||
go 1.22.5
|
go 1.24.4
|
||||||
|
|
||||||
toolchain go1.23.2
|
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/99designs/gqlgen v0.17.55
|
github.com/99designs/gqlgen v0.17.74
|
||||||
github.com/Khan/genqlient v0.7.0
|
github.com/Khan/genqlient v0.8.1
|
||||||
github.com/alecthomas/kong v1.2.1
|
github.com/alecthomas/kong v1.11.0
|
||||||
github.com/apex/log v1.9.0
|
github.com/apex/log v1.9.0
|
||||||
github.com/auth0/go-jwt-middleware/v2 v2.2.2
|
github.com/auth0/go-jwt-middleware/v2 v2.3.0
|
||||||
github.com/getsentry/sentry-go v0.29.1
|
github.com/golang-jwt/jwt/v5 v5.2.2
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.1
|
|
||||||
github.com/jmoiron/sqlx v1.4.0
|
github.com/jmoiron/sqlx v1.4.0
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/pressly/goose/v3 v3.22.1
|
github.com/pressly/goose/v3 v3.24.3
|
||||||
github.com/rs/cors v1.11.1
|
github.com/rs/cors v1.11.1
|
||||||
github.com/sparetimecoders/goamqp v0.3.1
|
github.com/sparetimecoders/goamqp v0.3.2
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.10.0
|
||||||
github.com/vektah/gqlparser/v2 v2.5.18
|
github.com/vektah/gqlparser/v2 v2.5.27
|
||||||
github.com/wundergraph/graphql-go-tools v1.67.4
|
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.189
|
||||||
gitlab.com/unboundsoftware/eventsourced/amqp v1.6.6
|
gitlab.com/unboundsoftware/eventsourced/amqp v1.8.1
|
||||||
gitlab.com/unboundsoftware/eventsourced/eventsourced v1.15.0
|
gitlab.com/unboundsoftware/eventsourced/eventsourced v1.19.2
|
||||||
gitlab.com/unboundsoftware/eventsourced/pg v1.14.4
|
gitlab.com/unboundsoftware/eventsourced/pg v1.17.0
|
||||||
|
go.opentelemetry.io/contrib/bridges/otelslog v0.11.0
|
||||||
|
go.opentelemetry.io/otel v1.36.0
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.36.0
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.36.0
|
||||||
|
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.12.2
|
||||||
|
go.opentelemetry.io/otel/log v0.12.2
|
||||||
|
go.opentelemetry.io/otel/sdk v1.36.0
|
||||||
|
go.opentelemetry.io/otel/sdk/log v0.12.2
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.36.0
|
||||||
|
go.opentelemetry.io/otel/trace v1.36.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/agnivade/levenshtein v1.1.1 // indirect
|
github.com/agnivade/levenshtein v1.2.1 // indirect
|
||||||
github.com/buger/jsonparser v1.1.1 // indirect
|
github.com/buger/jsonparser v1.1.1 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
github.com/cenkalti/backoff/v5 v5.0.2 // indirect
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
github.com/go-logr/logr v1.4.2 // indirect
|
||||||
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
|
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/gorilla/websocket v1.5.1 // indirect
|
github.com/gorilla/websocket v1.5.1 // indirect
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
|
||||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||||
github.com/jensneuse/byte-template v0.0.0-20200214152254-4f3cf06e5c68 // indirect
|
|
||||||
github.com/lib/pq v1.10.9 // indirect
|
github.com/lib/pq v1.10.9 // indirect
|
||||||
github.com/mfridman/interpolate v0.0.2 // indirect
|
github.com/mfridman/interpolate v0.0.2 // indirect
|
||||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/rabbitmq/amqp091-go v1.10.0 // indirect
|
github.com/rabbitmq/amqp091-go v1.10.0 // indirect
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||||
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
|
|
||||||
github.com/sethvargo/go-retry v0.3.0 // indirect
|
github.com/sethvargo/go-retry v0.3.0 // indirect
|
||||||
github.com/sosodev/duration v1.3.1 // indirect
|
github.com/sosodev/duration v1.3.1 // indirect
|
||||||
github.com/tidwall/gjson v1.17.0 // indirect
|
github.com/tidwall/gjson v1.17.0 // indirect
|
||||||
github.com/tidwall/match v1.1.1 // indirect
|
github.com/tidwall/match v1.1.1 // indirect
|
||||||
github.com/tidwall/pretty v1.2.1 // indirect
|
github.com/tidwall/pretty v1.2.1 // indirect
|
||||||
github.com/tidwall/sjson v1.2.5 // indirect
|
github.com/tidwall/sjson v1.2.5 // indirect
|
||||||
github.com/urfave/cli/v2 v2.27.4 // indirect
|
github.com/urfave/cli/v2 v2.27.6 // indirect
|
||||||
|
github.com/wundergraph/astjson v0.0.0-20250106123708-be463c97e083 // indirect
|
||||||
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
|
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
|
||||||
|
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.36.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/metric v1.36.0 // indirect
|
||||||
|
go.opentelemetry.io/proto/otlp v1.6.0 // indirect
|
||||||
go.uber.org/multierr v1.11.0 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
golang.org/x/mod v0.20.0 // indirect
|
golang.org/x/mod v0.24.0 // indirect
|
||||||
golang.org/x/net v0.29.0 // indirect
|
golang.org/x/net v0.40.0 // indirect
|
||||||
golang.org/x/sync v0.8.0 // indirect
|
golang.org/x/sync v0.14.0 // indirect
|
||||||
golang.org/x/sys v0.25.0 // indirect
|
golang.org/x/sys v0.33.0 // indirect
|
||||||
golang.org/x/text v0.18.0 // indirect
|
golang.org/x/text v0.25.0 // indirect
|
||||||
golang.org/x/tools v0.24.0 // indirect
|
golang.org/x/tools v0.33.0 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 // indirect
|
||||||
|
google.golang.org/grpc v1.72.1 // indirect
|
||||||
|
google.golang.org/protobuf v1.36.6 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||||
github.com/99designs/gqlgen v0.17.55 h1:3vzrNWYyzSZjGDFo68e5j9sSauLxfKvLp+6ioRokVtM=
|
github.com/99designs/gqlgen v0.17.74 h1:1FuVtkXxOc87xpKio3f6sohREmec+Jvy86PcYOuwgWo=
|
||||||
github.com/99designs/gqlgen v0.17.55/go.mod h1:3Bq768f8hgVPGZxL8aY9MaYmbxa6llPM/qu1IGH1EJo=
|
github.com/99designs/gqlgen v0.17.74/go.mod h1:a+iR6mfRLNRp++kDpooFHiPWYiWX3Yu1BIilQRHgh10=
|
||||||
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
|
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
|
||||||
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
|
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
|
||||||
github.com/Khan/genqlient v0.7.0 h1:GZ1meyRnzcDTK48EjqB8t3bcfYvHArCUUvgOwpz1D4w=
|
github.com/Khan/genqlient v0.8.1 h1:wtOCc8N9rNynRLXN3k3CnfzheCUNKBcvXmVv5zt6WCs=
|
||||||
github.com/Khan/genqlient v0.7.0/go.mod h1:HNyy3wZvuYwmW3Y7mkoQLZsa/R5n5yIRajS1kPBvSFM=
|
github.com/Khan/genqlient v0.8.1/go.mod h1:R2G6DzjBvCbhjsEajfRjbWdVglSH/73kSivC9TLWVjU=
|
||||||
github.com/PuerkitoBio/goquery v1.9.3 h1:mpJr/ikUA9/GNJB/DBZcGeFDXUtosHRyRrwh7KGdTG0=
|
github.com/PuerkitoBio/goquery v1.10.3 h1:pFYcNSqHxBD06Fpj/KsbStFRsgRATgnf3LeXiUkhzPo=
|
||||||
github.com/PuerkitoBio/goquery v1.9.3/go.mod h1:1ndLHPdTz+DyQPICCWYlYQMPl0oXZj0G6D4LCYA6u4U=
|
github.com/PuerkitoBio/goquery v1.10.3/go.mod h1:tMUX0zDMHXYlAQk6p35XxQMqMweEKB7iK7iLNd4RH4Y=
|
||||||
github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8=
|
github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM=
|
||||||
github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
|
github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU=
|
||||||
github.com/alecthomas/assert/v2 v2.10.0 h1:jjRCHsj6hBJhkmhznrCzoNpbA3zqy0fYiUcYZP/GkPY=
|
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
|
||||||
github.com/alecthomas/assert/v2 v2.10.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
|
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
|
||||||
github.com/alecthomas/kong v1.2.1 h1:E8jH4Tsgv6wCRX2nGrdPyHDUCSG83WH2qE4XLACD33Q=
|
github.com/alecthomas/kong v1.11.0 h1:y++1gI7jf8O7G7l4LZo5ASFhrhJvzc+WgF/arranEmM=
|
||||||
github.com/alecthomas/kong v1.2.1/go.mod h1:rKTSFhbdp3Ryefn8x5MOEprnRFQ7nlmMC01GKhehhBM=
|
github.com/alecthomas/kong v1.11.0/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU=
|
||||||
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
|
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
|
||||||
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
|
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
|
||||||
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
|
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
|
||||||
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
|
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
|
||||||
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
|
github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM=
|
||||||
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
|
github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA=
|
||||||
github.com/apex/log v1.9.0 h1:FHtw/xuaM8AgmvDDTI9fiwoAL25Sq2cxojnZICUU8l0=
|
github.com/apex/log v1.9.0 h1:FHtw/xuaM8AgmvDDTI9fiwoAL25Sq2cxojnZICUU8l0=
|
||||||
github.com/apex/log v1.9.0/go.mod h1:m82fZlWIuiWzWP04XCTXmnX0xRkYYbCdYn8jbJeLBEA=
|
github.com/apex/log v1.9.0/go.mod h1:m82fZlWIuiWzWP04XCTXmnX0xRkYYbCdYn8jbJeLBEA=
|
||||||
github.com/apex/logs v1.0.0/go.mod h1:XzxuLZ5myVHDy9SAmYpamKKRNApGj54PfYLcFrXqDwo=
|
github.com/apex/logs v1.0.0/go.mod h1:XzxuLZ5myVHDy9SAmYpamKKRNApGj54PfYLcFrXqDwo=
|
||||||
@@ -27,54 +27,58 @@ github.com/aphistic/golf v0.0.0-20180712155816-02c07f170c5a/go.mod h1:3NqKYiepwy
|
|||||||
github.com/aphistic/sweet v0.2.0/go.mod h1:fWDlIh/isSE9n6EPsRmC0det+whmX6dJid3stzu0Xys=
|
github.com/aphistic/sweet v0.2.0/go.mod h1:fWDlIh/isSE9n6EPsRmC0det+whmX6dJid3stzu0Xys=
|
||||||
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
|
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
|
||||||
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
|
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
|
||||||
github.com/auth0/go-jwt-middleware/v2 v2.2.2 h1:vrvkFZf72r3Qbt45KLjBG3/6Xq2r3NTixWKu2e8de9I=
|
github.com/auth0/go-jwt-middleware/v2 v2.3.0 h1:4QREj6cS3d8dS05bEm443jhnqQF97FX9sMBeWqnNRzE=
|
||||||
github.com/auth0/go-jwt-middleware/v2 v2.2.2/go.mod h1:4vwxpVtu/Kl4c4HskT+gFLjq0dra8F1joxzamrje6J0=
|
github.com/auth0/go-jwt-middleware/v2 v2.3.0/go.mod h1:dL4ObBs1/dj4/W4cYxd8rqAdDGXYyd5rqbpMIxcbVrU=
|
||||||
github.com/aws/aws-sdk-go v1.20.6/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
github.com/aws/aws-sdk-go v1.20.6/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||||
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I=
|
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I=
|
||||||
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
|
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
|
||||||
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
||||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
github.com/cenkalti/backoff/v5 v5.0.2 h1:rIfFVxEf1QsI7E1ZHfp/B4DF/6QBAUhmgkxc0H7Zss8=
|
||||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cenkalti/backoff/v5 v5.0.2/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g=
|
github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54 h1:SG7nF6SRlWhcT7cNTs5R6Hk4V2lcmLz2NsG2VnInyNo=
|
||||||
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
|
github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
|
||||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
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/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||||
github.com/evanphx/json-patch/v5 v5.1.0 h1:B0aXl1o/1cP8NbviYiBMkcHBtUjIJ1/Ccg6b+SwCLQg=
|
|
||||||
github.com/evanphx/json-patch/v5 v5.1.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4=
|
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
github.com/getsentry/sentry-go v0.29.1 h1:DyZuChN8Hz3ARxGVV8ePaNXh1dQ7d76AiB117xcREwA=
|
|
||||||
github.com/getsentry/sentry-go v0.29.1/go.mod h1:x3AtIzN01d6SiWkderzaH28Tm0lgkafpJ5Bm3li39O0=
|
|
||||||
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
|
||||||
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
|
||||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||||
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
|
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||||
|
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
||||||
|
github.com/go-logr/logr v1.4.2/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/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
|
github.com/go-sql-driver/mysql v1.9.2 h1:4cNKDYQ1I84SXslGddlsrMhc8k4LeDVj6Ad6WRjiHuU=
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
github.com/go-sql-driver/mysql v1.9.2/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU=
|
||||||
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
|
github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss=
|
||||||
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||||
|
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
|
||||||
|
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
||||||
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
|
||||||
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
|
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=
|
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
||||||
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
|
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/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
github.com/jensneuse/byte-template v0.0.0-20200214152254-4f3cf06e5c68 h1:E80wOd3IFQcoBxLkAUpUQ3BoGrZ4DxhQdP21+HH1s6A=
|
|
||||||
github.com/jensneuse/byte-template v0.0.0-20200214152254-4f3cf06e5c68/go.mod h1:0D5r/VSW6D/o65rKLL9xk7sZxL2+oku2HvFPYeIMFr4=
|
|
||||||
github.com/jensneuse/diffview v1.0.0 h1:4b6FQJ7y3295JUHU3tRko6euyEboL825ZsXeZZM47Z4=
|
github.com/jensneuse/diffview v1.0.0 h1:4b6FQJ7y3295JUHU3tRko6euyEboL825ZsXeZZM47Z4=
|
||||||
github.com/jensneuse/diffview v1.0.0/go.mod h1:i6IacuD8LnEaPuiyzMHA+Wfz5mAuycMOf3R/orUY9y4=
|
github.com/jensneuse/diffview v1.0.0/go.mod h1:i6IacuD8LnEaPuiyzMHA+Wfz5mAuycMOf3R/orUY9y4=
|
||||||
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||||
@@ -86,8 +90,9 @@ github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
|
|||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
|
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
|
||||||
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||||
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
||||||
@@ -101,36 +106,30 @@ github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxU
|
|||||||
github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY=
|
github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY=
|
||||||
github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg=
|
github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg=
|
||||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
|
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
|
||||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
|
||||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
|
||||||
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
||||||
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||||
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
|
|
||||||
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
|
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/pressly/goose/v3 v3.22.1 h1:2zICEfr1O3yTP9BRZMGPj7qFxQ+ik6yeo+z1LMuioLc=
|
github.com/pressly/goose/v3 v3.24.3 h1:DSWWNwwggVUsYZ0X2VitiAa9sKuqtBfe+Jr9zFGwWlM=
|
||||||
github.com/pressly/goose/v3 v3.22.1/go.mod h1:xtMpbstWyCpyH+0cxLTMCENWBG+0CSxvTsXhW95d5eo=
|
github.com/pressly/goose/v3 v3.24.3/go.mod h1:v9zYL4xdViLHCUUJh/mhjnm6JrK7Eul8AS93IxiZM4E=
|
||||||
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
|
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
|
||||||
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
|
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
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/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||||
github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||||
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||||
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||||
github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA=
|
github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA=
|
||||||
github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
|
github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/sanity-io/litter v1.5.5 h1:iE+sBxPBzoK6uaEP5Lt3fHNgpKcHXc/A2HGETy0uJQo=
|
github.com/sanity-io/litter v1.5.8 h1:uM/2lKrWdGbRXDrIq08Lh9XtVYoeGtcQxk9rtQ7+rYg=
|
||||||
github.com/sanity-io/litter v1.5.5/go.mod h1:9gzJgR2i4ZpjZHsKvUXIRQVk7P+yM3e+jAF7bU2UI5U=
|
github.com/sanity-io/litter v1.5.8/go.mod h1:9gzJgR2i4ZpjZHsKvUXIRQVk7P+yM3e+jAF7bU2UI5U=
|
||||||
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/sebdah/goldie/v2 v2.5.3 h1:9ES/mNN+HNUbNWpVAlrzuZ7jE+Nrczbj8uFRjM7624Y=
|
github.com/sebdah/goldie/v2 v2.5.3 h1:9ES/mNN+HNUbNWpVAlrzuZ7jE+Nrczbj8uFRjM7624Y=
|
||||||
github.com/sebdah/goldie/v2 v2.5.3/go.mod h1:oZ9fp0+se1eapSRjfYbsV/0Hqhbuu3bJVvKI/NNtssI=
|
github.com/sebdah/goldie/v2 v2.5.3/go.mod h1:oZ9fp0+se1eapSRjfYbsV/0Hqhbuu3bJVvKI/NNtssI=
|
||||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||||
@@ -143,19 +142,13 @@ github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h
|
|||||||
github.com/smartystreets/gunit v1.0.0/go.mod h1:qwPWnhz6pn0NnRBP++URONOVyNkPyr4SauJk4cUOwJs=
|
github.com/smartystreets/gunit v1.0.0/go.mod h1:qwPWnhz6pn0NnRBP++URONOVyNkPyr4SauJk4cUOwJs=
|
||||||
github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq4=
|
github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq4=
|
||||||
github.com/sosodev/duration v1.3.1/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg=
|
github.com/sosodev/duration v1.3.1/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg=
|
||||||
github.com/sparetimecoders/goamqp v0.3.1 h1:NCzdyAz84G679HlO+ivhyoI1aMgXEe3qfqpn4EChu1s=
|
github.com/sparetimecoders/goamqp v0.3.2 h1:XdlyUBAJS5RcURw+SnnPjPJJuofddZwQsjAf05VPXvI=
|
||||||
github.com/sparetimecoders/goamqp v0.3.1/go.mod h1:PjkgrmsuMVgRbiQDTLs0pCWYrcQgqcUee38JjCDZdlk=
|
github.com/sparetimecoders/goamqp v0.3.2/go.mod h1:W9NRCpWLE+Vruv2dcRSbszNil2O826d2Nv6kAkETW5o=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
|
||||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
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/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||||
github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM=
|
github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM=
|
||||||
github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||||
@@ -173,51 +166,93 @@ github.com/tj/go-buffer v1.1.0/go.mod h1:iyiJpfFcR2B9sXu7KvjbT9fpM4mOelRSDTbntVj
|
|||||||
github.com/tj/go-elastic v0.0.0-20171221160941-36157cbbebc2/go.mod h1:WjeM0Oo1eNAjXGDx2yma7uG2XoyRZTq1uv3M/o7imD0=
|
github.com/tj/go-elastic v0.0.0-20171221160941-36157cbbebc2/go.mod h1:WjeM0Oo1eNAjXGDx2yma7uG2XoyRZTq1uv3M/o7imD0=
|
||||||
github.com/tj/go-kinesis v0.0.0-20171128231115-08b17f58cb1b/go.mod h1:/yhzCV0xPfx6jb1bBgRFjl5lytqVqZXEaeqWP8lTEao=
|
github.com/tj/go-kinesis v0.0.0-20171128231115-08b17f58cb1b/go.mod h1:/yhzCV0xPfx6jb1bBgRFjl5lytqVqZXEaeqWP8lTEao=
|
||||||
github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4=
|
github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4=
|
||||||
github.com/urfave/cli/v2 v2.27.4 h1:o1owoI+02Eb+K107p27wEX9Bb8eqIoZCfLXloLUSWJ8=
|
github.com/urfave/cli/v2 v2.27.6 h1:VdRdS98FNhKZ8/Az8B7MTyGQmpIr36O1EHybx/LaZ4g=
|
||||||
github.com/urfave/cli/v2 v2.27.4/go.mod h1:m4QzxcD2qpra4z7WhzEGn74WZLViBnMpb1ToCAKdGRQ=
|
github.com/urfave/cli/v2 v2.27.6/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ=
|
||||||
github.com/vektah/gqlparser/v2 v2.5.18 h1:zSND3GtutylAQ1JpWnTHcqtaRZjl+y3NROeW8vuNo6Y=
|
github.com/vektah/gqlparser/v2 v2.5.27 h1:RHPD3JOplpk5mP5JGX8RKZkt2/Vwj/PZv0HxTdwFp0s=
|
||||||
github.com/vektah/gqlparser/v2 v2.5.18/go.mod h1:6HLzf7JKv9Fi3APymudztFQNmLXR5qJeEo6BOFcXVfc=
|
github.com/vektah/gqlparser/v2 v2.5.27/go.mod h1:D1/VCZtV3LPnQrcPBeR/q5jkSQIPti0uYCP/RI0gIeo=
|
||||||
github.com/wundergraph/graphql-go-tools v1.67.4 h1:1QtoftaZz5sScV/J6XLZ/oTfi1lMHp6UmFkYRQfY2/g=
|
github.com/wundergraph/astjson v0.0.0-20250106123708-be463c97e083 h1:8/D7f8gKxTBjW+SZK4mhxTTBVpxcqeBgWF1Rfmltbfk=
|
||||||
github.com/wundergraph/graphql-go-tools v1.67.4/go.mod h1:UFvflYjB/qnSCdgcHQuE6dTfwZ6viJB7yPnGOtBuibo=
|
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.189 h1:vcMuks7xty+2LbNpBYuUtBhUUA8jI1/Y2n24fGMRSCg=
|
||||||
|
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.189/go.mod h1:DaBrBCMgKGd3t7zg7z11jKm+0mVJiesr/IQCRG9qgP0=
|
||||||
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
|
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
|
||||||
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
|
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
|
||||||
gitlab.com/unboundsoftware/eventsourced/amqp v1.6.6 h1:v0HmyqTBBODtJf0kCxt/g8iJuLp31EfjPLVbDVnSt38=
|
gitlab.com/unboundsoftware/eventsourced/amqp v1.8.1 h1:MGHH2Uxp68J9i4V3/3vApB6gjBUjn6RjiPHhbc8Wsno=
|
||||||
gitlab.com/unboundsoftware/eventsourced/amqp v1.6.6/go.mod h1:dUyrC2fqHNkW8yFT/XQYtITxgFT/Q4U7le3efu8p0qU=
|
gitlab.com/unboundsoftware/eventsourced/amqp v1.8.1/go.mod h1:clGBkdpFWb5/27aLOhJ6+DB15enJf+T4J5lR6X0lqAs=
|
||||||
gitlab.com/unboundsoftware/eventsourced/eventsourced v1.15.0 h1:dW/w53Mz/TykCU7led8VTUoNZzy57o9MPjbK5I/4+mo=
|
gitlab.com/unboundsoftware/eventsourced/eventsourced v1.19.2 h1:8sCnThNHEPB3BQomcJ7u6fmc2t043fAZSMmVPDDbQOs=
|
||||||
gitlab.com/unboundsoftware/eventsourced/eventsourced v1.15.0/go.mod h1:8IGvjd/6NXjLUrmyETGjr+IkiEIuRSPlefwiLlnoBUM=
|
gitlab.com/unboundsoftware/eventsourced/eventsourced v1.19.2/go.mod h1:KeLn3U67hxbdFLfeXd0c0LI/r1C5rijbWrfNdARWe98=
|
||||||
gitlab.com/unboundsoftware/eventsourced/pg v1.14.4 h1:8akaF80HFGfaPba2uE8VL3w6W8rv4HlATmrqMczbTKo=
|
gitlab.com/unboundsoftware/eventsourced/pg v1.17.0 h1:pUJzMpNPX0GVsffRZXlpKR1d7Ws96KTxJwbLFPpASSc=
|
||||||
gitlab.com/unboundsoftware/eventsourced/pg v1.14.4/go.mod h1:O8sLw27s5ulJJOVX6TdmkWg3N2pVlrd3s8QSvwF+CB4=
|
gitlab.com/unboundsoftware/eventsourced/pg v1.17.0/go.mod h1:WgPrZhyCbsZ3TG2tPUbh2MUjOEaANJjsWi/0hlIwRVU=
|
||||||
|
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||||
|
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||||
|
go.opentelemetry.io/contrib/bridges/otelslog v0.11.0 h1:EMIiYTms4Z4m3bBuKp1VmMNRLZcl6j4YbvOPL1IhlWo=
|
||||||
|
go.opentelemetry.io/contrib/bridges/otelslog v0.11.0/go.mod h1:DIEZmUR7tzuOOVUTDKvkGWtYWSHFV18Qg8+GMb8wPJw=
|
||||||
|
go.opentelemetry.io/otel v1.36.0 h1:UumtzIklRBY6cI/lllNZlALOF5nNIzJVb16APdvgTXg=
|
||||||
|
go.opentelemetry.io/otel v1.36.0/go.mod h1:/TcFMXYjyRNh8khOAO9ybYkqaDBb/70aVwkNML4pP8E=
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.36.0 h1:gAU726w9J8fwr4qRDqu1GYMNNs4gXrU+Pv20/N1UpB4=
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.36.0/go.mod h1:RboSDkp7N292rgu+T0MgVt2qgFGu6qa1RpZDOtpL76w=
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.36.0 h1:dNzwXjZKpMpE2JhmO+9HsPl42NIXFIFSUSSs0fiqra0=
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.36.0/go.mod h1:90PoxvaEB5n6AOdZvi+yWJQoE95U8Dhhw2bSyRqnTD0=
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.36.0 h1:nRVXXvf78e00EwY6Wp0YII8ww2JVWshZ20HfTlE11AM=
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.36.0/go.mod h1:r49hO7CgrxY9Voaj3Xe8pANWtr0Oq916d0XAmOoCZAQ=
|
||||||
|
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.12.2 h1:12vMqzLLNZtXuXbJhSENRg+Vvx+ynNilV8twBLBsXMY=
|
||||||
|
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.12.2/go.mod h1:ZccPZoPOoq8x3Trik/fCsba7DEYDUnN6yX79pgp2BUQ=
|
||||||
|
go.opentelemetry.io/otel/log v0.12.2 h1:yob9JVHn2ZY24byZeaXpTVoPS6l+UrrxmxmPKohXTwc=
|
||||||
|
go.opentelemetry.io/otel/log v0.12.2/go.mod h1:ShIItIxSYxufUMt+1H5a2wbckGli3/iCfuEbVZi/98E=
|
||||||
|
go.opentelemetry.io/otel/metric v1.36.0 h1:MoWPKVhQvJ+eeXWHFBOPoBOi20jh6Iq2CcCREuTYufE=
|
||||||
|
go.opentelemetry.io/otel/metric v1.36.0/go.mod h1:zC7Ks+yeyJt4xig9DEw9kuUFe5C3zLbVjV2PzT6qzbs=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.36.0 h1:b6SYIuLRs88ztox4EyrvRti80uXIFy+Sqzoh9kFULbs=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.36.0/go.mod h1:+lC+mTgD+MUWfjJubi2vvXWcVxyr9rmlshZni72pXeY=
|
||||||
|
go.opentelemetry.io/otel/sdk/log v0.12.2 h1:yNoETvTByVKi7wHvYS6HMcZrN5hFLD7I++1xIZ/k6W0=
|
||||||
|
go.opentelemetry.io/otel/sdk/log v0.12.2/go.mod h1:DcpdmUXHJgSqN/dh+XMWa7Vf89u9ap0/AAk/XGLnEzY=
|
||||||
|
go.opentelemetry.io/otel/sdk/log/logtest v0.0.0-20250521073539-a85ae98dcedc h1:uqxdywfHqqCl6LmZzI3pUnXT1RGFYyUgxj0AkWPFxi0=
|
||||||
|
go.opentelemetry.io/otel/sdk/log/logtest v0.0.0-20250521073539-a85ae98dcedc/go.mod h1:TY/N/FT7dmFrP/r5ym3g0yysP1DefqGpAZr4f82P0dE=
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.36.0 h1:r0ntwwGosWGaa0CrSt8cuNuTcccMXERFwHX4dThiPis=
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.36.0/go.mod h1:qTNOhFDfKRwX0yXOqJYegL5WRaW376QbB7P4Pb0qva4=
|
||||||
|
go.opentelemetry.io/otel/trace v1.36.0 h1:ahxWNuqZjpdiFAyrIoQ4GIiAIhxAunQR6MUoKrsNd4w=
|
||||||
|
go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2szhehOBB/tGA=
|
||||||
|
go.opentelemetry.io/proto/otlp v1.6.0 h1:jQjP+AQyTf+Fe7OKj/MfkDrmK4MNVtw2NpXsf9fefDI=
|
||||||
|
go.opentelemetry.io/proto/otlp v1.6.0/go.mod h1:cicgGehlFuNdgZkcALOCh3VE6K/u2tAjzlRhDwmVpZc=
|
||||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
|
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
|
||||||
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
|
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
|
||||||
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
|
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 h1:y5zboxd6LQAqYIhHnB48p0ByQ/GnQx2BE33L8BOHQkI=
|
||||||
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ=
|
||||||
|
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
|
||||||
|
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
|
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
|
||||||
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
|
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
|
||||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
|
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||||
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
|
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
||||||
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
|
golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc=
|
||||||
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
|
golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237 h1:Kog3KlB4xevJlAcbbbzPfRG0+X9fdoGM+UBRKVz6Wr0=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237/go.mod h1:ezi0AVyMKDWy5xAncvjLWH7UcLBB5n7y2fQ8MzjJcto=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 h1:cJfm9zPbe1e873mHJzmQ1nwVEeRDU/T1wXDK2kUSU34=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
|
||||||
|
google.golang.org/grpc v1.72.1 h1:HR03wO6eyZ7lknl75XlxABNVLLFc2PAb6mHlYh756mA=
|
||||||
|
google.golang.org/grpc v1.72.1/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
|
||||||
|
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||||
|
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
@@ -228,21 +263,15 @@ gopkg.in/go-jose/go-jose.v2 v2.6.3/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEI
|
|||||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
|
||||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 h1:5D53IMaUuA5InSeMu9eJtlQXS2NxAhyWQvkKEgXZhHI=
|
modernc.org/libc v1.65.0 h1:e183gLDnAp9VJh6gWKdTy0CThL9Pt7MfcR/0bgb7Y1Y=
|
||||||
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4=
|
modernc.org/libc v1.65.0/go.mod h1:7m9VzGq7APssBTydds2zBcxGREwvIGpuUBaKTXdm2Qs=
|
||||||
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
|
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
|
||||||
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
|
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
|
||||||
modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E=
|
modernc.org/memory v1.10.0 h1:fzumd51yQ1DxcOxSO+S6X7+QTuVU+n8/Aj7swYjFfC4=
|
||||||
modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU=
|
modernc.org/memory v1.10.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
|
||||||
modernc.org/sqlite v1.33.0 h1:WWkA/T2G17okiLGgKAj4/RMIvgyMT19yQ038160IeYk=
|
modernc.org/sqlite v1.37.0 h1:s1TMe7T3Q3ovQiK2Ouz4Jwh7dw4ZDqbebSDTlSJdfjI=
|
||||||
modernc.org/sqlite v1.33.0/go.mod h1:9uQ9hF/pCZoYZK73D/ud5Z7cIRIILSZI8NdIemVMTX8=
|
modernc.org/sqlite v1.37.0/go.mod h1:5YiWv+YviqGMuGw4V+PNplcyaJ5v+vQd7TQOgkACoJM=
|
||||||
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
|
|
||||||
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
|
|
||||||
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
|
|
||||||
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
|
||||||
|
|||||||
+481
-267
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -3,8 +3,8 @@ package graph
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log/slog"
|
||||||
|
|
||||||
"github.com/apex/log"
|
|
||||||
"gitlab.com/unboundsoftware/eventsourced/eventsourced"
|
"gitlab.com/unboundsoftware/eventsourced/eventsourced"
|
||||||
|
|
||||||
"gitlab.com/unboundsoftware/schemas/cache"
|
"gitlab.com/unboundsoftware/schemas/cache"
|
||||||
@@ -26,7 +26,7 @@ type Publisher interface {
|
|||||||
type Resolver struct {
|
type Resolver struct {
|
||||||
EventStore eventsourced.EventStore
|
EventStore eventsourced.EventStore
|
||||||
Publisher Publisher
|
Publisher Publisher
|
||||||
Logger log.Interface
|
Logger *slog.Logger
|
||||||
Cache *cache.Cache
|
Cache *cache.Cache
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/wundergraph/graphql-go-tools/pkg/federation/sdlmerge"
|
|
||||||
"gitlab.com/unboundsoftware/eventsourced/eventsourced"
|
"gitlab.com/unboundsoftware/eventsourced/eventsourced"
|
||||||
|
|
||||||
"gitlab.com/unboundsoftware/schemas/domain"
|
"gitlab.com/unboundsoftware/schemas/domain"
|
||||||
@@ -17,6 +16,7 @@ import (
|
|||||||
"gitlab.com/unboundsoftware/schemas/graph/model"
|
"gitlab.com/unboundsoftware/schemas/graph/model"
|
||||||
"gitlab.com/unboundsoftware/schemas/middleware"
|
"gitlab.com/unboundsoftware/schemas/middleware"
|
||||||
"gitlab.com/unboundsoftware/schemas/rand"
|
"gitlab.com/unboundsoftware/schemas/rand"
|
||||||
|
"gitlab.com/unboundsoftware/schemas/sdlmerge"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AddOrganization is the resolver for the addOrganization field.
|
// AddOrganization is the resolver for the addOrganization field.
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ apiVersion: autoscaling/v2
|
|||||||
kind: HorizontalPodAutoscaler
|
kind: HorizontalPodAutoscaler
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: schemas
|
app.kubernetes.io/name: schemas
|
||||||
name: schemas
|
name: schemas
|
||||||
spec:
|
spec:
|
||||||
scaleTargetRef:
|
scaleTargetRef:
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: schemas
|
||||||
|
data:
|
||||||
|
LOG_FORMAT: "otel"
|
||||||
|
ENVIRONMENT: "production"
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: schemas
|
||||||
|
data:
|
||||||
|
ENVIRONMENT: "development"
|
||||||
+8
-11
@@ -7,7 +7,7 @@ apiVersion: apps/v1
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: schemas
|
app.kubernetes.io/name: schemas
|
||||||
name: schemas
|
name: schemas
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/change-cause: "${TIMESTAMP} Deployed commit id: ${COMMIT}"
|
kubernetes.io/change-cause: "${TIMESTAMP} Deployed commit id: ${COMMIT}"
|
||||||
@@ -15,7 +15,7 @@ spec:
|
|||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: schemas
|
app.kubernetes.io/name: schemas
|
||||||
strategy:
|
strategy:
|
||||||
rollingUpdate:
|
rollingUpdate:
|
||||||
maxSurge: 1
|
maxSurge: 1
|
||||||
@@ -24,7 +24,7 @@ spec:
|
|||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: schemas
|
app.kubernetes.io/name: schemas
|
||||||
spec:
|
spec:
|
||||||
affinity:
|
affinity:
|
||||||
podAntiAffinity:
|
podAntiAffinity:
|
||||||
@@ -33,7 +33,7 @@ spec:
|
|||||||
podAffinityTerm:
|
podAffinityTerm:
|
||||||
labelSelector:
|
labelSelector:
|
||||||
matchExpressions:
|
matchExpressions:
|
||||||
- key: "app"
|
- key: "app.kubernetes.io/name"
|
||||||
operator: In
|
operator: In
|
||||||
values:
|
values:
|
||||||
- schemas
|
- schemas
|
||||||
@@ -41,11 +41,8 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: schemas
|
- name: schemas
|
||||||
resources:
|
resources:
|
||||||
limits:
|
|
||||||
cpu: "500m"
|
|
||||||
memory: "100Mi"
|
|
||||||
requests:
|
requests:
|
||||||
cpu: "100m"
|
cpu: "20m"
|
||||||
memory: "20Mi"
|
memory: "20Mi"
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
@@ -60,10 +57,10 @@ spec:
|
|||||||
- name: api
|
- name: api
|
||||||
containerPort: 8080
|
containerPort: 8080
|
||||||
envFrom:
|
envFrom:
|
||||||
- secretRef:
|
- configMapRef:
|
||||||
name: schemas
|
name: schemas
|
||||||
- secretRef:
|
- secretRef:
|
||||||
name: rabbitmq
|
name: schemas
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
serviceAccountName: schemas
|
serviceAccountName: schemas
|
||||||
---
|
---
|
||||||
@@ -79,5 +76,5 @@ spec:
|
|||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: 8080
|
targetPort: 8080
|
||||||
selector:
|
selector:
|
||||||
app: schemas
|
app.kubernetes.io/name: schemas
|
||||||
type: NodePort
|
type: NodePort
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: policy/v1
|
||||||
|
kind: PodDisruptionBudget
|
||||||
|
metadata:
|
||||||
|
name: schemas-pdb
|
||||||
|
spec:
|
||||||
|
minAvailable: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: schemas
|
||||||
@@ -5,3 +5,4 @@ metadata:
|
|||||||
stringData:
|
stringData:
|
||||||
API_KEY: supersecret123!
|
API_KEY: supersecret123!
|
||||||
POSTGRES_URL: "postgres://postgres:postgres@postgres:5432/schemas?sslmode=disable"
|
POSTGRES_URL: "postgres://postgres:postgres@postgres:5432/schemas?sslmode=disable"
|
||||||
|
AMQP_URL: "amqp://user:password@rabbitmq:5672/"
|
||||||
|
|||||||
+5
-4
@@ -1,8 +1,7 @@
|
|||||||
apiVersion: external-secrets.io/v1beta1
|
apiVersion: external-secrets.io/v1
|
||||||
kind: ExternalSecret
|
kind: ExternalSecret
|
||||||
metadata:
|
metadata:
|
||||||
name: schemas
|
name: schemas
|
||||||
namespace: default
|
|
||||||
spec:
|
spec:
|
||||||
refreshInterval: 1h
|
refreshInterval: 1h
|
||||||
secretStoreRef:
|
secretStoreRef:
|
||||||
@@ -11,13 +10,15 @@ spec:
|
|||||||
target:
|
target:
|
||||||
creationPolicy: Owner
|
creationPolicy: Owner
|
||||||
template:
|
template:
|
||||||
|
mergePolicy: Merge
|
||||||
|
engineVersion: 'v2'
|
||||||
data:
|
data:
|
||||||
POSTGRES_URL: "postgres://{{ .DB_USERNAME }}:{{ .DB_PASSWORD }}@{{ .DB_HOST }}:{{ .DB_PORT }}/schemas?sslmode=disable"
|
POSTGRES_URL: "postgres://{{ .DB_USERNAME }}:{{ .DB_PASSWORD }}@{{ .DB_HOST }}:{{ .DB_PORT }}/schemas?sslmode=disable"
|
||||||
API_KEY: "{{ .API_KEY }}"
|
API_KEY: "{{ .API_KEY }}"
|
||||||
SENTRY_DSN: "{{ .SENTRY_DSN }}"
|
|
||||||
SENTRY_ENVIRONMENT: "{{ .SENTRY_ENVIRONMENT }}"
|
|
||||||
dataFrom:
|
dataFrom:
|
||||||
- extract:
|
- extract:
|
||||||
key: services/schemas
|
key: services/schemas
|
||||||
- extract:
|
- extract:
|
||||||
key: rds/postgres/prod-psql
|
key: rds/postgres/prod-psql
|
||||||
|
- extract:
|
||||||
|
key: mq/rabbit/prod
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package logging
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"log/slog"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/contrib/bridges/otelslog"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Logger interface {
|
||||||
|
Info(msg string, args ...any)
|
||||||
|
Warn(msg string, args ...any)
|
||||||
|
Error(msg string, args ...any)
|
||||||
|
}
|
||||||
|
|
||||||
|
var defaultLogger *slog.Logger
|
||||||
|
|
||||||
|
type contextKey string
|
||||||
|
|
||||||
|
const loggerKey = contextKey("logger")
|
||||||
|
|
||||||
|
func SetupLogger(logLevel, logFormat, serviceName, buildVersion string) *slog.Logger {
|
||||||
|
var leveler slog.LevelVar
|
||||||
|
|
||||||
|
err := leveler.UnmarshalText([]byte(logLevel))
|
||||||
|
|
||||||
|
handlerOpts := &slog.HandlerOptions{
|
||||||
|
AddSource: false,
|
||||||
|
Level: leveler.Level(),
|
||||||
|
ReplaceAttr: nil,
|
||||||
|
}
|
||||||
|
|
||||||
|
var handler slog.Handler
|
||||||
|
switch logFormat {
|
||||||
|
case "json":
|
||||||
|
handler = slog.NewJSONHandler(os.Stdout, handlerOpts)
|
||||||
|
case "text":
|
||||||
|
handler = slog.NewTextHandler(os.Stdout, handlerOpts)
|
||||||
|
case "otel":
|
||||||
|
handler = otelslog.NewHandler(serviceName,
|
||||||
|
otelslog.WithVersion(buildVersion))
|
||||||
|
}
|
||||||
|
defaultLogger = slog.New(handler).With("service", serviceName).With("version", buildVersion)
|
||||||
|
if err != nil {
|
||||||
|
defaultLogger.With("err", err).Error("Failed to parse log level")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
slog.SetDefault(defaultLogger)
|
||||||
|
return defaultLogger
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextWithLogger returns a new Context with the logger attached
|
||||||
|
func ContextWithLogger(ctx context.Context, logger *slog.Logger) context.Context {
|
||||||
|
return context.WithValue(ctx, loggerKey, logger)
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoggerFromContext returns a logger from the passed context or the default logger
|
||||||
|
func LoggerFromContext(ctx context.Context) *slog.Logger {
|
||||||
|
logger := ctx.Value(loggerKey)
|
||||||
|
if l, ok := logger.(*slog.Logger); ok {
|
||||||
|
return l
|
||||||
|
}
|
||||||
|
return defaultLogger
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package logging
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"log/slog"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewMockLogger() *MockLogger {
|
||||||
|
logged := &bytes.Buffer{}
|
||||||
|
|
||||||
|
return &MockLogger{
|
||||||
|
logged: logged,
|
||||||
|
logger: slog.New(slog.NewTextHandler(logged, &slog.HandlerOptions{
|
||||||
|
ReplaceAttr: func(groups []string, a slog.Attr) slog.Attr {
|
||||||
|
if a.Key == "time" {
|
||||||
|
return slog.Attr{}
|
||||||
|
}
|
||||||
|
return a
|
||||||
|
},
|
||||||
|
})),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type MockLogger struct {
|
||||||
|
logger *slog.Logger
|
||||||
|
logged *bytes.Buffer
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MockLogger) Logger() *slog.Logger {
|
||||||
|
return m.logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MockLogger) Check(t testing.TB, wantLogged []string) {
|
||||||
|
var gotLogged []string
|
||||||
|
if m.logged.String() != "" {
|
||||||
|
gotLogged = strings.Split(m.logged.String(), "\n")
|
||||||
|
gotLogged = gotLogged[:len(gotLogged)-1]
|
||||||
|
}
|
||||||
|
if len(wantLogged) == 0 {
|
||||||
|
assert.Empty(t, gotLogged)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
assert.Equal(t, wantLogged, gotLogged)
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package monitoring
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/99designs/gqlgen/graphql"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AroundOperations(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler {
|
||||||
|
op := graphql.GetOperationContext(ctx)
|
||||||
|
spanName := fmt.Sprintf("graphql:operation:%s", op.OperationName)
|
||||||
|
// Span always injected in the http handler above
|
||||||
|
sp := trace.SpanFromContext(ctx)
|
||||||
|
if sp != nil {
|
||||||
|
sp.SetName(spanName)
|
||||||
|
}
|
||||||
|
return next(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
func AroundRootFields(ctx context.Context, next graphql.RootResolver) graphql.Marshaler {
|
||||||
|
oc := graphql.GetRootFieldContext(ctx)
|
||||||
|
spanCtx, span := StartSpan(ctx, fmt.Sprintf("graphql:rootfield:%s", oc.Field.Name))
|
||||||
|
defer span.Finish()
|
||||||
|
return next(spanCtx)
|
||||||
|
}
|
||||||
|
|
||||||
|
func AroundFields(ctx context.Context, next graphql.Resolver) (res any, err error) {
|
||||||
|
oc := graphql.GetFieldContext(ctx)
|
||||||
|
var span Span
|
||||||
|
if oc.IsResolver {
|
||||||
|
ctx, span = StartSpan(ctx, fmt.Sprintf("graphql:field:%s", oc.Field.Name))
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
if span != nil {
|
||||||
|
span.Finish()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
return next(ctx)
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package monitoring
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel"
|
||||||
|
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp"
|
||||||
|
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp"
|
||||||
|
"go.opentelemetry.io/otel/exporters/stdout/stdoutlog"
|
||||||
|
"go.opentelemetry.io/otel/log/global"
|
||||||
|
"go.opentelemetry.io/otel/propagation"
|
||||||
|
"go.opentelemetry.io/otel/sdk/log"
|
||||||
|
"go.opentelemetry.io/otel/sdk/metric"
|
||||||
|
"go.opentelemetry.io/otel/sdk/trace"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SetupOTelSDK bootstraps the OpenTelemetry pipeline.
|
||||||
|
func SetupOTelSDK(ctx context.Context, enabled bool, serviceName, buildVersion, environment string) (func(context.Context) error, error) {
|
||||||
|
if os.Getenv("OTEL_RESOURCE_ATTRIBUTES") == "" {
|
||||||
|
if err := os.Setenv("OTEL_RESOURCE_ATTRIBUTES", fmt.Sprintf("service.name=%s,service.version=%s,service.environment=%s", serviceName, buildVersion, environment)); err != nil {
|
||||||
|
return func(context.Context) error {
|
||||||
|
return nil
|
||||||
|
}, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var shutdownFuncs []func(context.Context) error
|
||||||
|
if !enabled {
|
||||||
|
return func(context.Context) error {
|
||||||
|
return nil
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
shutdown := func(ctx context.Context) error {
|
||||||
|
var err error
|
||||||
|
for _, fn := range shutdownFuncs {
|
||||||
|
err = errors.Join(err, fn(ctx))
|
||||||
|
}
|
||||||
|
shutdownFuncs = nil
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// handleErr calls shutdown for cleanup and makes sure that all errors are returned.
|
||||||
|
handleErr := func(inErr error) (func(context.Context) error, error) {
|
||||||
|
return nil, errors.Join(inErr, shutdown(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up the propagator.
|
||||||
|
prop := propagation.NewCompositeTextMapPropagator(
|
||||||
|
propagation.TraceContext{},
|
||||||
|
propagation.Baggage{},
|
||||||
|
)
|
||||||
|
otel.SetTextMapPropagator(prop)
|
||||||
|
|
||||||
|
traceExporter, err := otlptracehttp.New(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return handleErr(err)
|
||||||
|
}
|
||||||
|
shutdownFuncs = append(shutdownFuncs, traceExporter.Shutdown)
|
||||||
|
|
||||||
|
tracerProvider := trace.NewTracerProvider(
|
||||||
|
trace.WithBatcher(traceExporter,
|
||||||
|
trace.WithBatchTimeout(5*time.Second)),
|
||||||
|
)
|
||||||
|
shutdownFuncs = append(shutdownFuncs, tracerProvider.Shutdown)
|
||||||
|
otel.SetTracerProvider(tracerProvider)
|
||||||
|
|
||||||
|
logExporter, err := stdoutlog.New()
|
||||||
|
if err != nil {
|
||||||
|
return handleErr(err)
|
||||||
|
}
|
||||||
|
processor := log.NewSimpleProcessor(logExporter)
|
||||||
|
logProvider := log.NewLoggerProvider(log.WithProcessor(processor))
|
||||||
|
|
||||||
|
global.SetLoggerProvider(logProvider)
|
||||||
|
shutdownFuncs = append(shutdownFuncs, logProvider.Shutdown)
|
||||||
|
|
||||||
|
exp, err := otlpmetrichttp.New(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return handleErr(err)
|
||||||
|
}
|
||||||
|
meterProvider := metric.NewMeterProvider(metric.WithReader(metric.NewPeriodicReader(exp)))
|
||||||
|
shutdownFuncs = append(shutdownFuncs, meterProvider.Shutdown)
|
||||||
|
|
||||||
|
otel.SetMeterProvider(meterProvider)
|
||||||
|
return shutdown, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func Handler(h http.Handler) http.Handler {
|
||||||
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
ctx := otel.GetTextMapPropagator().Extract(r.Context(), propagation.HeaderCarrier(r.Header))
|
||||||
|
spanCtx, s := StartSpan(ctx, "http")
|
||||||
|
defer s.Finish()
|
||||||
|
|
||||||
|
h.ServeHTTP(w, r.WithContext(spanCtx))
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package monitoring
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Span interface {
|
||||||
|
Context() context.Context
|
||||||
|
Finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
type span struct {
|
||||||
|
otelSpan trace.Span
|
||||||
|
ctx context.Context
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *span) Finish() {
|
||||||
|
s.otelSpan.End()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *span) Context() context.Context {
|
||||||
|
return s.ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
func StartSpan(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, Span) {
|
||||||
|
ctx, otelSpan := otel.Tracer("").Start(ctx, name, opts...)
|
||||||
|
|
||||||
|
return ctx, &span{
|
||||||
|
otelSpan: otelSpan,
|
||||||
|
ctx: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type TraceHandlerFunc func(ctx context.Context, name string) (context.Context, func())
|
||||||
|
|
||||||
|
func (t TraceHandlerFunc) Trace(tx context.Context, name string) (context.Context, func()) {
|
||||||
|
return t(tx, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Trace(ctx context.Context, name string) (context.Context, func()) {
|
||||||
|
ctx, s := StartSpan(ctx, name)
|
||||||
|
return ctx, s.Finish
|
||||||
|
}
|
||||||
@@ -2,5 +2,22 @@
|
|||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": [
|
"extends": [
|
||||||
"config:recommended"
|
"config:recommended"
|
||||||
|
],
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"matchManagers": [
|
||||||
|
"kubernetes"
|
||||||
|
],
|
||||||
|
"matchPackageNames": [
|
||||||
|
"registry.gitlab.com/unboundsoftware/schemas"
|
||||||
|
],
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupName": "Eventsourced",
|
||||||
|
"matchPackageNames": [
|
||||||
|
"gitlab.com/unboundsoftware/eventsourced/**"
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/operationreport"
|
||||||
|
)
|
||||||
|
|
||||||
|
type collectEntitiesVisitor struct {
|
||||||
|
*astvisitor.Walker
|
||||||
|
document *ast.Document
|
||||||
|
collectedEntities entitySet
|
||||||
|
}
|
||||||
|
|
||||||
|
func newCollectEntitiesVisitor(collectedEntities entitySet) *collectEntitiesVisitor {
|
||||||
|
return &collectEntitiesVisitor{
|
||||||
|
collectedEntities: collectedEntities,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *collectEntitiesVisitor) Register(walker *astvisitor.Walker) {
|
||||||
|
c.Walker = walker
|
||||||
|
walker.RegisterEnterDocumentVisitor(c)
|
||||||
|
walker.RegisterEnterInterfaceTypeDefinitionVisitor(c)
|
||||||
|
walker.RegisterEnterObjectTypeDefinitionVisitor(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *collectEntitiesVisitor) EnterDocument(operation, _ *ast.Document) {
|
||||||
|
c.document = operation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *collectEntitiesVisitor) EnterInterfaceTypeDefinition(ref int) {
|
||||||
|
interfaceType := c.document.InterfaceTypeDefinitions[ref]
|
||||||
|
name := c.document.InterfaceTypeDefinitionNameString(ref)
|
||||||
|
if err := c.resolvePotentialEntity(name, interfaceType.Directives.Refs); err != nil {
|
||||||
|
c.StopWithExternalErr(*err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *collectEntitiesVisitor) EnterObjectTypeDefinition(ref int) {
|
||||||
|
objectType := c.document.ObjectTypeDefinitions[ref]
|
||||||
|
name := c.document.ObjectTypeDefinitionNameString(ref)
|
||||||
|
if err := c.resolvePotentialEntity(name, objectType.Directives.Refs); err != nil {
|
||||||
|
c.StopWithExternalErr(*err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *collectEntitiesVisitor) resolvePotentialEntity(name string, directiveRefs []int) *operationreport.ExternalError {
|
||||||
|
if _, exists := c.collectedEntities[name]; exists {
|
||||||
|
err := operationreport.ErrEntitiesMustNotBeDuplicated(name)
|
||||||
|
return &err
|
||||||
|
}
|
||||||
|
for _, directiveRef := range directiveRefs {
|
||||||
|
if c.document.DirectiveNameString(directiveRef) != "key" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
c.collectedEntities[name] = struct{}{}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/operationreport"
|
||||||
|
)
|
||||||
|
|
||||||
|
type extendEnumTypeDefinitionVisitor struct {
|
||||||
|
*astvisitor.Walker
|
||||||
|
document *ast.Document
|
||||||
|
}
|
||||||
|
|
||||||
|
func newExtendEnumTypeDefinition() *extendEnumTypeDefinitionVisitor {
|
||||||
|
return &extendEnumTypeDefinitionVisitor{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendEnumTypeDefinitionVisitor) Register(walker *astvisitor.Walker) {
|
||||||
|
e.Walker = walker
|
||||||
|
walker.RegisterEnterDocumentVisitor(e)
|
||||||
|
walker.RegisterEnterEnumTypeExtensionVisitor(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendEnumTypeDefinitionVisitor) EnterDocument(operation, _ *ast.Document) {
|
||||||
|
e.document = operation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendEnumTypeDefinitionVisitor) EnterEnumTypeExtension(ref int) {
|
||||||
|
nodes, exists := e.document.Index.NodesByNameBytes(e.document.EnumTypeExtensionNameBytes(ref))
|
||||||
|
if !exists {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
hasExtended := false
|
||||||
|
for i := range nodes {
|
||||||
|
if nodes[i].Kind != ast.NodeKindEnumTypeDefinition {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if hasExtended {
|
||||||
|
e.StopWithExternalErr(operationreport.ErrSharedTypesMustNotBeExtended(e.document.EnumTypeExtensionNameString(ref)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
e.document.ExtendEnumTypeDefinitionByEnumTypeExtension(nodes[i].Ref, ref)
|
||||||
|
hasExtended = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if !hasExtended {
|
||||||
|
e.StopWithExternalErr(operationreport.ErrExtensionOrphansMustResolveInSupergraph(e.document.EnumTypeExtensionNameBytes(ref)))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/operationreport"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newExtendInputObjectTypeDefinition() *extendInputObjectTypeDefinitionVisitor {
|
||||||
|
return &extendInputObjectTypeDefinitionVisitor{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type extendInputObjectTypeDefinitionVisitor struct {
|
||||||
|
*astvisitor.Walker
|
||||||
|
document *ast.Document
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendInputObjectTypeDefinitionVisitor) Register(walker *astvisitor.Walker) {
|
||||||
|
e.Walker = walker
|
||||||
|
walker.RegisterEnterDocumentVisitor(e)
|
||||||
|
walker.RegisterEnterInputObjectTypeExtensionVisitor(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendInputObjectTypeDefinitionVisitor) EnterDocument(operation, _ *ast.Document) {
|
||||||
|
e.document = operation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendInputObjectTypeDefinitionVisitor) EnterInputObjectTypeExtension(ref int) {
|
||||||
|
nodes, exists := e.document.Index.NodesByNameBytes(e.document.InputObjectTypeExtensionNameBytes(ref))
|
||||||
|
if !exists {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
hasExtended := false
|
||||||
|
for i := range nodes {
|
||||||
|
if nodes[i].Kind != ast.NodeKindInputObjectTypeDefinition {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if hasExtended {
|
||||||
|
e.StopWithExternalErr(operationreport.ErrSharedTypesMustNotBeExtended(e.document.InputObjectTypeExtensionNameString(ref)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
e.document.ExtendInputObjectTypeDefinitionByInputObjectTypeExtension(nodes[i].Ref, ref)
|
||||||
|
hasExtended = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if !hasExtended {
|
||||||
|
e.StopWithExternalErr(operationreport.ErrExtensionOrphansMustResolveInSupergraph(e.document.InputObjectTypeExtensionNameBytes(ref)))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/operationreport"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newExtendInterfaceTypeDefinition(collectedEntities entitySet) *extendInterfaceTypeDefinitionVisitor {
|
||||||
|
return &extendInterfaceTypeDefinitionVisitor{
|
||||||
|
collectedEntities: collectedEntities,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type extendInterfaceTypeDefinitionVisitor struct {
|
||||||
|
*astvisitor.Walker
|
||||||
|
document *ast.Document
|
||||||
|
collectedEntities entitySet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendInterfaceTypeDefinitionVisitor) Register(walker *astvisitor.Walker) {
|
||||||
|
e.Walker = walker
|
||||||
|
walker.RegisterEnterDocumentVisitor(e)
|
||||||
|
walker.RegisterEnterInterfaceTypeExtensionVisitor(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendInterfaceTypeDefinitionVisitor) EnterDocument(operation, _ *ast.Document) {
|
||||||
|
e.document = operation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendInterfaceTypeDefinitionVisitor) EnterInterfaceTypeExtension(ref int) {
|
||||||
|
nameBytes := e.document.InterfaceTypeExtensionNameBytes(ref)
|
||||||
|
nodes, exists := e.document.Index.NodesByNameBytes(nameBytes)
|
||||||
|
if !exists {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var nodeToExtend *ast.Node
|
||||||
|
isEntity := false
|
||||||
|
for i := range nodes {
|
||||||
|
if nodes[i].Kind != ast.NodeKindInterfaceTypeDefinition {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if nodeToExtend != nil {
|
||||||
|
e.StopWithExternalErr(*multipleExtensionError(isEntity, nameBytes))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var err *operationreport.ExternalError
|
||||||
|
extension := e.document.InterfaceTypeExtensions[ref]
|
||||||
|
if isEntity, err = e.collectedEntities.isExtensionForEntity(nameBytes, extension.Directives.Refs, e.document); err != nil {
|
||||||
|
e.StopWithExternalErr(*err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
nodeToExtend = &nodes[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
if nodeToExtend == nil {
|
||||||
|
e.StopWithExternalErr(operationreport.ErrExtensionOrphansMustResolveInSupergraph(e.document.InterfaceTypeExtensionNameBytes(ref)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
e.document.ExtendInterfaceTypeDefinitionByInterfaceTypeExtension(nodeToExtend.Ref, ref)
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/operationreport"
|
||||||
|
)
|
||||||
|
|
||||||
|
type mergeDuplicatedFieldsVisitor struct {
|
||||||
|
*astvisitor.Walker
|
||||||
|
document *ast.Document
|
||||||
|
}
|
||||||
|
|
||||||
|
func newMergeDuplicatedFieldsVisitor() *mergeDuplicatedFieldsVisitor {
|
||||||
|
return &mergeDuplicatedFieldsVisitor{
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *mergeDuplicatedFieldsVisitor) Register(walker *astvisitor.Walker) {
|
||||||
|
m.Walker = walker
|
||||||
|
walker.RegisterEnterDocumentVisitor(m)
|
||||||
|
walker.RegisterLeaveObjectTypeDefinitionVisitor(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *mergeDuplicatedFieldsVisitor) EnterDocument(document, _ *ast.Document) {
|
||||||
|
m.document = document
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *mergeDuplicatedFieldsVisitor) LeaveObjectTypeDefinition(ref int) {
|
||||||
|
var refsForDeletion []int
|
||||||
|
fieldByTypeRefSet := make(map[string]int)
|
||||||
|
for _, fieldRef := range m.document.ObjectTypeDefinitions[ref].FieldsDefinition.Refs {
|
||||||
|
fieldName := m.document.FieldDefinitionNameString(fieldRef)
|
||||||
|
newTypeRef := m.document.FieldDefinitions[fieldRef].Type
|
||||||
|
if oldTypeRef, ok := fieldByTypeRefSet[fieldName]; ok {
|
||||||
|
if m.document.TypesAreEqualDeep(oldTypeRef, newTypeRef) {
|
||||||
|
refsForDeletion = append(refsForDeletion, fieldRef)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
oldFieldTypeNameBytes, err := m.document.PrintTypeBytes(oldTypeRef, nil)
|
||||||
|
if err != nil {
|
||||||
|
m.StopWithInternalErr(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
newFieldTypeNameBytes, err := m.document.PrintTypeBytes(newTypeRef, nil)
|
||||||
|
if err != nil {
|
||||||
|
m.StopWithInternalErr(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
m.StopWithExternalErr(operationreport.ErrDuplicateFieldsMustBeIdentical(
|
||||||
|
fieldName, m.document.ObjectTypeDefinitionNameString(ref), string(oldFieldTypeNameBytes), string(newFieldTypeNameBytes),
|
||||||
|
))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldByTypeRefSet[fieldName] = newTypeRef
|
||||||
|
}
|
||||||
|
|
||||||
|
m.document.RemoveFieldDefinitionsFromObjectTypeDefinition(refsForDeletion, ref)
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/operationreport"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newExtendObjectTypeDefinition(collectedEntities entitySet) *extendObjectTypeDefinitionVisitor {
|
||||||
|
return &extendObjectTypeDefinitionVisitor{
|
||||||
|
collectedEntities: collectedEntities,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type extendObjectTypeDefinitionVisitor struct {
|
||||||
|
*astvisitor.Walker
|
||||||
|
document *ast.Document
|
||||||
|
collectedEntities entitySet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendObjectTypeDefinitionVisitor) Register(walker *astvisitor.Walker) {
|
||||||
|
e.Walker = walker
|
||||||
|
walker.RegisterEnterDocumentVisitor(e)
|
||||||
|
walker.RegisterEnterObjectTypeExtensionVisitor(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendObjectTypeDefinitionVisitor) EnterDocument(operation, _ *ast.Document) {
|
||||||
|
e.document = operation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendObjectTypeDefinitionVisitor) EnterObjectTypeExtension(ref int) {
|
||||||
|
nameBytes := e.document.ObjectTypeExtensionNameBytes(ref)
|
||||||
|
nodes, exists := e.document.Index.NodesByNameBytes(nameBytes)
|
||||||
|
if !exists {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var nodeToExtend *ast.Node
|
||||||
|
isEntity := false
|
||||||
|
for i := range nodes {
|
||||||
|
if nodes[i].Kind != ast.NodeKindObjectTypeDefinition {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if nodeToExtend != nil {
|
||||||
|
e.StopWithExternalErr(*multipleExtensionError(isEntity, nameBytes))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var err *operationreport.ExternalError
|
||||||
|
extension := e.document.ObjectTypeExtensions[ref]
|
||||||
|
if isEntity, err = e.collectedEntities.isExtensionForEntity(nameBytes, extension.Directives.Refs, e.document); err != nil {
|
||||||
|
e.StopWithExternalErr(*err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
nodeToExtend = &nodes[i]
|
||||||
|
if ast.IsRootType(nameBytes) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if nodeToExtend == nil {
|
||||||
|
e.StopWithExternalErr(operationreport.ErrExtensionOrphansMustResolveInSupergraph(nameBytes))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
e.document.ExtendObjectTypeDefinitionByObjectTypeExtension(nodeToExtend.Ref, ref)
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/operationreport"
|
||||||
|
)
|
||||||
|
|
||||||
|
type removeDuplicateFieldedSharedTypesVisitor struct {
|
||||||
|
*astvisitor.Walker
|
||||||
|
document *ast.Document
|
||||||
|
sharedTypeSet map[string]fieldedSharedType
|
||||||
|
rootNodesToRemove []ast.Node
|
||||||
|
lastInputRef int
|
||||||
|
lastInterfaceRef int
|
||||||
|
lastObjectRef int
|
||||||
|
}
|
||||||
|
|
||||||
|
func newRemoveDuplicateFieldedSharedTypesVisitor() *removeDuplicateFieldedSharedTypesVisitor {
|
||||||
|
return &removeDuplicateFieldedSharedTypesVisitor{
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
|
make(map[string]fieldedSharedType),
|
||||||
|
nil,
|
||||||
|
ast.InvalidRef,
|
||||||
|
ast.InvalidRef,
|
||||||
|
ast.InvalidRef,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeDuplicateFieldedSharedTypesVisitor) Register(walker *astvisitor.Walker) {
|
||||||
|
r.Walker = walker
|
||||||
|
walker.RegisterEnterDocumentVisitor(r)
|
||||||
|
walker.RegisterEnterInputObjectTypeDefinitionVisitor(r)
|
||||||
|
walker.RegisterEnterInterfaceTypeDefinitionVisitor(r)
|
||||||
|
walker.RegisterEnterObjectTypeDefinitionVisitor(r)
|
||||||
|
walker.RegisterLeaveDocumentVisitor(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeDuplicateFieldedSharedTypesVisitor) EnterDocument(operation, _ *ast.Document) {
|
||||||
|
r.document = operation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeDuplicateFieldedSharedTypesVisitor) EnterInputObjectTypeDefinition(ref int) {
|
||||||
|
if ref <= r.lastInputRef {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
name := r.document.InputObjectTypeDefinitionNameString(ref)
|
||||||
|
refs := r.document.InputObjectTypeDefinitions[ref].InputFieldsDefinition.Refs
|
||||||
|
input, exists := r.sharedTypeSet[name]
|
||||||
|
if exists {
|
||||||
|
if !input.areFieldsIdentical(refs) {
|
||||||
|
r.StopWithExternalErr(operationreport.ErrSharedTypesMustBeIdenticalToFederate(name))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r.rootNodesToRemove = append(r.rootNodesToRemove, ast.Node{Kind: ast.NodeKindInputObjectTypeDefinition, Ref: ref})
|
||||||
|
} else {
|
||||||
|
r.sharedTypeSet[name] = newFieldedSharedType(r.document, ast.NodeKindInputValueDefinition, refs)
|
||||||
|
}
|
||||||
|
r.lastInputRef = ref
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeDuplicateFieldedSharedTypesVisitor) EnterInterfaceTypeDefinition(ref int) {
|
||||||
|
if ref <= r.lastInterfaceRef {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
name := r.document.InterfaceTypeDefinitionNameString(ref)
|
||||||
|
interfaceType := r.document.InterfaceTypeDefinitions[ref]
|
||||||
|
refs := interfaceType.FieldsDefinition.Refs
|
||||||
|
iFace, exists := r.sharedTypeSet[name]
|
||||||
|
if exists {
|
||||||
|
if !iFace.areFieldsIdentical(refs) {
|
||||||
|
r.StopWithExternalErr(operationreport.ErrSharedTypesMustBeIdenticalToFederate(name))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r.rootNodesToRemove = append(r.rootNodesToRemove, ast.Node{Kind: ast.NodeKindInterfaceTypeDefinition, Ref: ref})
|
||||||
|
} else {
|
||||||
|
r.sharedTypeSet[name] = newFieldedSharedType(r.document, ast.NodeKindFieldDefinition, refs)
|
||||||
|
}
|
||||||
|
r.lastInterfaceRef = ref
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeDuplicateFieldedSharedTypesVisitor) EnterObjectTypeDefinition(ref int) {
|
||||||
|
if ref <= r.lastObjectRef {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
name := r.document.ObjectTypeDefinitionNameString(ref)
|
||||||
|
objectType := r.document.ObjectTypeDefinitions[ref]
|
||||||
|
refs := objectType.FieldsDefinition.Refs
|
||||||
|
object, exists := r.sharedTypeSet[name]
|
||||||
|
if exists {
|
||||||
|
if !object.areFieldsIdentical(refs) {
|
||||||
|
r.StopWithExternalErr(operationreport.ErrSharedTypesMustBeIdenticalToFederate(name))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r.rootNodesToRemove = append(r.rootNodesToRemove, ast.Node{Kind: ast.NodeKindObjectTypeDefinition, Ref: ref})
|
||||||
|
} else {
|
||||||
|
r.sharedTypeSet[name] = newFieldedSharedType(r.document, ast.NodeKindFieldDefinition, refs)
|
||||||
|
}
|
||||||
|
r.lastObjectRef = ref
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeDuplicateFieldedSharedTypesVisitor) LeaveDocument(_, _ *ast.Document) {
|
||||||
|
if r.rootNodesToRemove != nil {
|
||||||
|
r.document.DeleteRootNodes(r.rootNodesToRemove)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/operationreport"
|
||||||
|
)
|
||||||
|
|
||||||
|
type removeDuplicateFieldlessSharedTypesVisitor struct {
|
||||||
|
*astvisitor.Walker
|
||||||
|
document *ast.Document
|
||||||
|
sharedTypeSet map[string]fieldlessSharedType
|
||||||
|
rootNodesToRemove []ast.Node
|
||||||
|
lastEnumRef int
|
||||||
|
lastUnionRef int
|
||||||
|
lastScalarRef int
|
||||||
|
}
|
||||||
|
|
||||||
|
func newRemoveDuplicateFieldlessSharedTypesVisitor() *removeDuplicateFieldlessSharedTypesVisitor {
|
||||||
|
return &removeDuplicateFieldlessSharedTypesVisitor{
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
|
make(map[string]fieldlessSharedType),
|
||||||
|
nil,
|
||||||
|
ast.InvalidRef,
|
||||||
|
ast.InvalidRef,
|
||||||
|
ast.InvalidRef,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeDuplicateFieldlessSharedTypesVisitor) Register(walker *astvisitor.Walker) {
|
||||||
|
r.Walker = walker
|
||||||
|
walker.RegisterEnterDocumentVisitor(r)
|
||||||
|
walker.RegisterEnterEnumTypeDefinitionVisitor(r)
|
||||||
|
walker.RegisterEnterScalarTypeDefinitionVisitor(r)
|
||||||
|
walker.RegisterEnterUnionTypeDefinitionVisitor(r)
|
||||||
|
walker.RegisterLeaveDocumentVisitor(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeDuplicateFieldlessSharedTypesVisitor) EnterDocument(operation, _ *ast.Document) {
|
||||||
|
r.document = operation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeDuplicateFieldlessSharedTypesVisitor) EnterEnumTypeDefinition(ref int) {
|
||||||
|
if ref <= r.lastEnumRef {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
name := r.document.EnumTypeDefinitionNameString(ref)
|
||||||
|
enum, exists := r.sharedTypeSet[name]
|
||||||
|
if exists {
|
||||||
|
if !enum.areValuesIdentical(r.document.EnumTypeDefinitions[ref].EnumValuesDefinition.Refs) {
|
||||||
|
r.StopWithExternalErr(operationreport.ErrSharedTypesMustBeIdenticalToFederate(name))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r.rootNodesToRemove = append(r.rootNodesToRemove, ast.Node{Kind: ast.NodeKindEnumTypeDefinition, Ref: ref})
|
||||||
|
} else {
|
||||||
|
r.sharedTypeSet[name] = newEnumSharedType(r.document, ref)
|
||||||
|
}
|
||||||
|
r.lastEnumRef = ref
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeDuplicateFieldlessSharedTypesVisitor) EnterScalarTypeDefinition(ref int) {
|
||||||
|
if ref <= r.lastScalarRef {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
name := r.document.ScalarTypeDefinitionNameString(ref)
|
||||||
|
_, exists := r.sharedTypeSet[name]
|
||||||
|
if exists {
|
||||||
|
r.rootNodesToRemove = append(r.rootNodesToRemove, ast.Node{Kind: ast.NodeKindScalarTypeDefinition, Ref: ref})
|
||||||
|
} else {
|
||||||
|
r.sharedTypeSet[name] = scalarSharedType{}
|
||||||
|
}
|
||||||
|
r.lastScalarRef = ref
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeDuplicateFieldlessSharedTypesVisitor) EnterUnionTypeDefinition(ref int) {
|
||||||
|
if ref <= r.lastUnionRef {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
name := r.document.UnionTypeDefinitionNameString(ref)
|
||||||
|
union, exists := r.sharedTypeSet[name]
|
||||||
|
if exists {
|
||||||
|
if !union.areValuesIdentical(r.document.UnionTypeDefinitions[ref].UnionMemberTypes.Refs) {
|
||||||
|
r.StopWithExternalErr(operationreport.ErrSharedTypesMustBeIdenticalToFederate(name))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r.rootNodesToRemove = append(r.rootNodesToRemove, ast.Node{Kind: ast.NodeKindUnionTypeDefinition, Ref: ref})
|
||||||
|
} else {
|
||||||
|
r.sharedTypeSet[name] = newUnionSharedType(r.document, ref)
|
||||||
|
}
|
||||||
|
r.lastUnionRef = ref
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeDuplicateFieldlessSharedTypesVisitor) LeaveDocument(_, _ *ast.Document) {
|
||||||
|
if r.rootNodesToRemove != nil {
|
||||||
|
r.document.DeleteRootNodes(r.rootNodesToRemove)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newRemoveEmptyObjectTypeDefinition() *removeEmptyObjectTypeDefinition {
|
||||||
|
return &removeEmptyObjectTypeDefinition{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type removeEmptyObjectTypeDefinition struct{}
|
||||||
|
|
||||||
|
func (r *removeEmptyObjectTypeDefinition) Register(walker *astvisitor.Walker) {
|
||||||
|
walker.RegisterLeaveDocumentVisitor(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeEmptyObjectTypeDefinition) LeaveDocument(operation, _ *ast.Document) {
|
||||||
|
for ref := range operation.ObjectTypeDefinitions {
|
||||||
|
if operation.ObjectTypeDefinitions[ref].HasFieldDefinitions {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
name := operation.ObjectTypeDefinitionNameString(ref)
|
||||||
|
node, ok := operation.Index.FirstNodeByNameStr(name)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
operation.RemoveRootNode(node)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newRemoveFieldDefinitions(directives ...string) *removeFieldDefinitionByDirective {
|
||||||
|
directivesSet := make(map[string]struct{}, len(directives))
|
||||||
|
for _, directive := range directives {
|
||||||
|
directivesSet[directive] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
return &removeFieldDefinitionByDirective{
|
||||||
|
directives: directivesSet,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type removeFieldDefinitionByDirective struct {
|
||||||
|
operation *ast.Document
|
||||||
|
directives map[string]struct{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeFieldDefinitionByDirective) Register(walker *astvisitor.Walker) {
|
||||||
|
walker.RegisterEnterDocumentVisitor(r)
|
||||||
|
walker.RegisterLeaveObjectTypeDefinitionVisitor(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeFieldDefinitionByDirective) EnterDocument(operation, _ *ast.Document) {
|
||||||
|
r.operation = operation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeFieldDefinitionByDirective) LeaveObjectTypeDefinition(ref int) {
|
||||||
|
var refsForDeletion []int
|
||||||
|
// select fields for deletion
|
||||||
|
for _, fieldRef := range r.operation.ObjectTypeDefinitions[ref].FieldsDefinition.Refs {
|
||||||
|
for _, directiveRef := range r.operation.FieldDefinitions[fieldRef].Directives.Refs {
|
||||||
|
directiveName := r.operation.DirectiveNameString(directiveRef)
|
||||||
|
if _, ok := r.directives[directiveName]; ok {
|
||||||
|
refsForDeletion = append(refsForDeletion, fieldRef)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// delete fields
|
||||||
|
r.operation.RemoveFieldDefinitionsFromObjectTypeDefinition(refsForDeletion, ref)
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newRemoveFieldDefinitionDirective(directives ...string) *removeFieldDefinitionDirective {
|
||||||
|
directivesSet := make(map[string]struct{}, len(directives))
|
||||||
|
for _, directive := range directives {
|
||||||
|
directivesSet[directive] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
return &removeFieldDefinitionDirective{
|
||||||
|
directives: directivesSet,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type removeFieldDefinitionDirective struct {
|
||||||
|
operation *ast.Document
|
||||||
|
directives map[string]struct{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeFieldDefinitionDirective) Register(walker *astvisitor.Walker) {
|
||||||
|
walker.RegisterEnterDocumentVisitor(r)
|
||||||
|
walker.RegisterEnterFieldDefinitionVisitor(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeFieldDefinitionDirective) EnterDocument(operation, _ *ast.Document) {
|
||||||
|
r.operation = operation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeFieldDefinitionDirective) EnterFieldDefinition(ref int) {
|
||||||
|
var refsForDeletion []int
|
||||||
|
// select directives for deletion
|
||||||
|
for _, directiveRef := range r.operation.FieldDefinitions[ref].Directives.Refs {
|
||||||
|
directiveName := r.operation.DirectiveNameString(directiveRef)
|
||||||
|
if _, ok := r.directives[directiveName]; ok {
|
||||||
|
refsForDeletion = append(refsForDeletion, directiveRef)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// delete directives
|
||||||
|
r.operation.RemoveDirectivesFromNode(ast.Node{Kind: ast.NodeKindFieldDefinition, Ref: ref}, refsForDeletion)
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newRemoveInterfaceDefinitionDirective(directives ...string) *removeInterfaceDefinitionDirective {
|
||||||
|
directivesSet := make(map[string]struct{}, len(directives))
|
||||||
|
for _, directive := range directives {
|
||||||
|
directivesSet[directive] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
return &removeInterfaceDefinitionDirective{
|
||||||
|
directives: directivesSet,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type removeInterfaceDefinitionDirective struct {
|
||||||
|
*astvisitor.Walker
|
||||||
|
operation *ast.Document
|
||||||
|
directives map[string]struct{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeInterfaceDefinitionDirective) Register(walker *astvisitor.Walker) {
|
||||||
|
walker.RegisterEnterDocumentVisitor(r)
|
||||||
|
walker.RegisterEnterInterfaceTypeDefinitionVisitor(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeInterfaceDefinitionDirective) EnterDocument(operation, _ *ast.Document) {
|
||||||
|
r.operation = operation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeInterfaceDefinitionDirective) EnterInterfaceTypeDefinition(ref int) {
|
||||||
|
var refsForDeletion []int
|
||||||
|
// select fields for deletion
|
||||||
|
for _, directiveRef := range r.operation.InterfaceTypeDefinitions[ref].Directives.Refs {
|
||||||
|
directiveName := r.operation.DirectiveNameString(directiveRef)
|
||||||
|
if _, ok := r.directives[directiveName]; ok {
|
||||||
|
refsForDeletion = append(refsForDeletion, directiveRef)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// delete directives
|
||||||
|
r.operation.RemoveDirectivesFromNode(ast.Node{Kind: ast.NodeKindInterfaceTypeDefinition, Ref: ref}, refsForDeletion)
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newRemoveObjectTypeDefinitionDirective(directives ...string) *removeObjectTypeDefinitionDirective {
|
||||||
|
directivesSet := make(map[string]struct{}, len(directives))
|
||||||
|
for _, directive := range directives {
|
||||||
|
directivesSet[directive] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
return &removeObjectTypeDefinitionDirective{
|
||||||
|
directives: directivesSet,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type removeObjectTypeDefinitionDirective struct {
|
||||||
|
operation *ast.Document
|
||||||
|
directives map[string]struct{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeObjectTypeDefinitionDirective) Register(walker *astvisitor.Walker) {
|
||||||
|
walker.RegisterEnterDocumentVisitor(r)
|
||||||
|
walker.RegisterEnterObjectTypeDefinitionVisitor(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeObjectTypeDefinitionDirective) EnterDocument(operation, _ *ast.Document) {
|
||||||
|
r.operation = operation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeObjectTypeDefinitionDirective) EnterObjectTypeDefinition(ref int) {
|
||||||
|
var refsForDeletion []int
|
||||||
|
// select fields for deletion
|
||||||
|
for _, directiveRef := range r.operation.ObjectTypeDefinitions[ref].Directives.Refs {
|
||||||
|
directiveName := r.operation.DirectiveNameString(directiveRef)
|
||||||
|
if _, ok := r.directives[directiveName]; ok {
|
||||||
|
refsForDeletion = append(refsForDeletion, directiveRef)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// delete directives
|
||||||
|
r.operation.RemoveDirectivesFromNode(ast.Node{Kind: ast.NodeKindObjectTypeDefinition, Ref: ref}, refsForDeletion)
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newRemoveMergedTypeExtensions() *removeMergedTypeExtensionsVisitor {
|
||||||
|
return &removeMergedTypeExtensionsVisitor{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type removeMergedTypeExtensionsVisitor struct{}
|
||||||
|
|
||||||
|
func (r *removeMergedTypeExtensionsVisitor) Register(walker *astvisitor.Walker) {
|
||||||
|
walker.RegisterLeaveDocumentVisitor(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *removeMergedTypeExtensionsVisitor) LeaveDocument(operation, definition *ast.Document) {
|
||||||
|
operation.RemoveMergedTypeExtensions()
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/operationreport"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newExtendScalarTypeDefinition() *extendScalarTypeDefinitionVisitor {
|
||||||
|
return &extendScalarTypeDefinitionVisitor{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type extendScalarTypeDefinitionVisitor struct {
|
||||||
|
*astvisitor.Walker
|
||||||
|
document *ast.Document
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendScalarTypeDefinitionVisitor) Register(walker *astvisitor.Walker) {
|
||||||
|
e.Walker = walker
|
||||||
|
walker.RegisterEnterDocumentVisitor(e)
|
||||||
|
walker.RegisterEnterScalarTypeExtensionVisitor(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendScalarTypeDefinitionVisitor) EnterDocument(operation, _ *ast.Document) {
|
||||||
|
e.document = operation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendScalarTypeDefinitionVisitor) EnterScalarTypeExtension(ref int) {
|
||||||
|
nodes, exists := e.document.Index.NodesByNameBytes(e.document.ScalarTypeExtensionNameBytes(ref))
|
||||||
|
if !exists {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
hasExtended := false
|
||||||
|
for i := range nodes {
|
||||||
|
if nodes[i].Kind != ast.NodeKindScalarTypeDefinition {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if hasExtended {
|
||||||
|
e.StopWithExternalErr(operationreport.ErrSharedTypesMustNotBeExtended(e.document.ScalarTypeExtensionNameString(ref)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
e.document.ExtendScalarTypeDefinitionByScalarTypeExtension(nodes[i].Ref, ref)
|
||||||
|
hasExtended = true
|
||||||
|
}
|
||||||
|
if !hasExtended {
|
||||||
|
e.StopWithExternalErr(operationreport.ErrExtensionOrphansMustResolveInSupergraph(e.document.ScalarTypeExtensionNameBytes(ref)))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/asttransform"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvalidation"
|
||||||
|
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astnormalization"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astparser"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astprinter"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/operationreport"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
rootOperationTypeDefinitions = `
|
||||||
|
type Query {}
|
||||||
|
type Mutation {}
|
||||||
|
type Subscription {}
|
||||||
|
`
|
||||||
|
|
||||||
|
parseDocumentError = "parse graphql document string: %w"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Visitor interface {
|
||||||
|
Register(walker *astvisitor.Walker)
|
||||||
|
}
|
||||||
|
|
||||||
|
func MergeAST(ast *ast.Document) error {
|
||||||
|
normalizer := normalizer{}
|
||||||
|
normalizer.setupWalkers()
|
||||||
|
|
||||||
|
return normalizer.normalize(ast)
|
||||||
|
}
|
||||||
|
|
||||||
|
func MergeSDLs(SDLs ...string) (string, error) {
|
||||||
|
rawDocs := make([]string, 0, len(SDLs)+1)
|
||||||
|
rawDocs = append(rawDocs, rootOperationTypeDefinitions)
|
||||||
|
rawDocs = append(rawDocs, SDLs...)
|
||||||
|
if validationError := validateSubgraphs(rawDocs[1:]); validationError != nil {
|
||||||
|
return "", validationError
|
||||||
|
}
|
||||||
|
if normalizationError := normalizeSubgraphs(rawDocs[1:]); normalizationError != nil {
|
||||||
|
return "", normalizationError
|
||||||
|
}
|
||||||
|
|
||||||
|
doc, report := astparser.ParseGraphqlDocumentString(strings.Join(rawDocs, "\n"))
|
||||||
|
if report.HasErrors() {
|
||||||
|
return "", fmt.Errorf("parse graphql document string: %w", report)
|
||||||
|
}
|
||||||
|
|
||||||
|
astnormalization.NormalizeSubgraphSDL(&doc, &report)
|
||||||
|
if report.HasErrors() {
|
||||||
|
return "", fmt.Errorf("merge ast: %w", report)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := MergeAST(&doc); err != nil {
|
||||||
|
return "", fmt.Errorf("merge ast: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
out, err := astprinter.PrintString(&doc)
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("stringify schema: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateSubgraphs(subgraphs []string) error {
|
||||||
|
validator := astvalidation.NewDefinitionValidator(
|
||||||
|
astvalidation.PopulatedTypeBodies(), astvalidation.KnownTypeNames(),
|
||||||
|
)
|
||||||
|
for _, subgraph := range subgraphs {
|
||||||
|
doc, report := astparser.ParseGraphqlDocumentString(subgraph)
|
||||||
|
if err := asttransform.MergeDefinitionWithBaseSchema(&doc); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if report.HasErrors() {
|
||||||
|
return fmt.Errorf(parseDocumentError, report)
|
||||||
|
}
|
||||||
|
validator.Validate(&doc, &report)
|
||||||
|
if report.HasErrors() {
|
||||||
|
return fmt.Errorf("validate schema: %w", report)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func normalizeSubgraphs(subgraphs []string) error {
|
||||||
|
subgraphNormalizer := astnormalization.NewSubgraphDefinitionNormalizer()
|
||||||
|
for i, subgraph := range subgraphs {
|
||||||
|
doc, report := astparser.ParseGraphqlDocumentString(subgraph)
|
||||||
|
if report.HasErrors() {
|
||||||
|
return fmt.Errorf(parseDocumentError, report)
|
||||||
|
}
|
||||||
|
subgraphNormalizer.NormalizeDefinition(&doc, &report)
|
||||||
|
if report.HasErrors() {
|
||||||
|
return fmt.Errorf("normalize schema: %w", report)
|
||||||
|
}
|
||||||
|
out, err := astprinter.PrintString(&doc)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("stringify schema: %w", err)
|
||||||
|
}
|
||||||
|
subgraphs[i] = out
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type normalizer struct {
|
||||||
|
walkers []*astvisitor.Walker
|
||||||
|
}
|
||||||
|
|
||||||
|
type entitySet map[string]struct{}
|
||||||
|
|
||||||
|
func (m *normalizer) setupWalkers() {
|
||||||
|
collectedEntities := make(entitySet)
|
||||||
|
visitorGroups := [][]Visitor{
|
||||||
|
{
|
||||||
|
newCollectEntitiesVisitor(collectedEntities),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
newExtendEnumTypeDefinition(),
|
||||||
|
newExtendInputObjectTypeDefinition(),
|
||||||
|
newExtendInterfaceTypeDefinition(collectedEntities),
|
||||||
|
newExtendScalarTypeDefinition(),
|
||||||
|
newExtendUnionTypeDefinition(),
|
||||||
|
newExtendObjectTypeDefinition(collectedEntities),
|
||||||
|
newRemoveEmptyObjectTypeDefinition(),
|
||||||
|
newRemoveMergedTypeExtensions(),
|
||||||
|
},
|
||||||
|
// visitors for cleaning up federated duplicated fields and directives
|
||||||
|
{
|
||||||
|
newRemoveFieldDefinitions("external"),
|
||||||
|
newRemoveDuplicateFieldedSharedTypesVisitor(),
|
||||||
|
newRemoveDuplicateFieldlessSharedTypesVisitor(),
|
||||||
|
newMergeDuplicatedFieldsVisitor(),
|
||||||
|
newRemoveInterfaceDefinitionDirective("key"),
|
||||||
|
newRemoveObjectTypeDefinitionDirective("key"),
|
||||||
|
newRemoveFieldDefinitionDirective("provides", "requires"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, visitorGroup := range visitorGroups {
|
||||||
|
walker := astvisitor.NewWalker(48)
|
||||||
|
for _, visitor := range visitorGroup {
|
||||||
|
visitor.Register(&walker)
|
||||||
|
m.walkers = append(m.walkers, &walker)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *normalizer) normalize(operation *ast.Document) error {
|
||||||
|
report := operationreport.Report{}
|
||||||
|
|
||||||
|
for _, walker := range m.walkers {
|
||||||
|
walker.Walk(operation, nil, &report)
|
||||||
|
if report.HasErrors() {
|
||||||
|
return fmt.Errorf("walk: %w", report)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e entitySet) isExtensionForEntity(nameBytes []byte, directiveRefs []int, document *ast.Document) (bool, *operationreport.ExternalError) {
|
||||||
|
name := string(nameBytes)
|
||||||
|
hasDirectives := len(directiveRefs) > 0
|
||||||
|
if _, exists := e[name]; !exists {
|
||||||
|
if !hasDirectives || !isEntityExtension(directiveRefs, document) {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
err := operationreport.ErrExtensionWithKeyDirectiveMustExtendEntity(name)
|
||||||
|
return false, &err
|
||||||
|
}
|
||||||
|
if !hasDirectives {
|
||||||
|
err := operationreport.ErrEntityExtensionMustHaveKeyDirective(name)
|
||||||
|
return false, &err
|
||||||
|
}
|
||||||
|
if isEntityExtension(directiveRefs, document) {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
err := operationreport.ErrEntityExtensionMustHaveKeyDirective(name)
|
||||||
|
return false, &err
|
||||||
|
}
|
||||||
|
|
||||||
|
func isEntityExtension(directiveRefs []int, document *ast.Document) bool {
|
||||||
|
for _, directiveRef := range directiveRefs {
|
||||||
|
if document.DirectiveNameString(directiveRef) == "key" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func multipleExtensionError(isEntity bool, nameBytes []byte) *operationreport.ExternalError {
|
||||||
|
if isEntity {
|
||||||
|
err := operationreport.ErrEntitiesMustNotBeDuplicated(string(nameBytes))
|
||||||
|
return &err
|
||||||
|
}
|
||||||
|
err := operationreport.ErrSharedTypesMustNotBeExtended(string(nameBytes))
|
||||||
|
return &err
|
||||||
|
}
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import "github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
|
||||||
|
type fieldlessSharedType interface {
|
||||||
|
areValuesIdentical(valueRefsToCompare []int) bool
|
||||||
|
valueRefs() []int
|
||||||
|
valueName(ref int) string
|
||||||
|
}
|
||||||
|
|
||||||
|
func createValueSet(f fieldlessSharedType) map[string]bool {
|
||||||
|
valueSet := make(map[string]bool)
|
||||||
|
for _, valueRef := range f.valueRefs() {
|
||||||
|
valueSet[f.valueName(valueRef)] = true
|
||||||
|
}
|
||||||
|
return valueSet
|
||||||
|
}
|
||||||
|
|
||||||
|
type fieldedSharedType struct {
|
||||||
|
document *ast.Document
|
||||||
|
fieldKind ast.NodeKind
|
||||||
|
fieldRefs []int
|
||||||
|
fieldSet map[string]int
|
||||||
|
}
|
||||||
|
|
||||||
|
func newFieldedSharedType(document *ast.Document, fieldKind ast.NodeKind, fieldRefs []int) fieldedSharedType {
|
||||||
|
f := fieldedSharedType{
|
||||||
|
document,
|
||||||
|
fieldKind,
|
||||||
|
fieldRefs,
|
||||||
|
nil,
|
||||||
|
}
|
||||||
|
f.createFieldSet()
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f fieldedSharedType) areFieldsIdentical(fieldRefsToCompare []int) bool {
|
||||||
|
if len(f.fieldRefs) != len(fieldRefsToCompare) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for _, fieldRef := range fieldRefsToCompare {
|
||||||
|
actualFieldName := f.fieldName(fieldRef)
|
||||||
|
expectedTypeRef, exists := f.fieldSet[actualFieldName]
|
||||||
|
if !exists {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
actualTypeRef := f.fieldTypeRef(fieldRef)
|
||||||
|
if !f.document.TypesAreCompatibleDeep(expectedTypeRef, actualTypeRef) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *fieldedSharedType) createFieldSet() {
|
||||||
|
fieldSet := make(map[string]int)
|
||||||
|
for _, fieldRef := range f.fieldRefs {
|
||||||
|
fieldSet[f.fieldName(fieldRef)] = f.fieldTypeRef(fieldRef)
|
||||||
|
}
|
||||||
|
f.fieldSet = fieldSet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f fieldedSharedType) fieldName(ref int) string {
|
||||||
|
switch f.fieldKind {
|
||||||
|
case ast.NodeKindInputValueDefinition:
|
||||||
|
return f.document.InputValueDefinitionNameString(ref)
|
||||||
|
default:
|
||||||
|
return f.document.FieldDefinitionNameString(ref)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f fieldedSharedType) fieldTypeRef(ref int) int {
|
||||||
|
switch f.fieldKind {
|
||||||
|
case ast.NodeKindInputValueDefinition:
|
||||||
|
return f.document.InputValueDefinitions[ref].Type
|
||||||
|
default:
|
||||||
|
return f.document.FieldDefinitions[ref].Type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type enumSharedType struct {
|
||||||
|
*ast.EnumTypeDefinition
|
||||||
|
document *ast.Document
|
||||||
|
valueSet map[string]bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func newEnumSharedType(document *ast.Document, ref int) enumSharedType {
|
||||||
|
e := enumSharedType{
|
||||||
|
&document.EnumTypeDefinitions[ref],
|
||||||
|
document,
|
||||||
|
nil,
|
||||||
|
}
|
||||||
|
e.valueSet = createValueSet(e)
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e enumSharedType) areValuesIdentical(valueRefsToCompare []int) bool {
|
||||||
|
if len(e.valueRefs()) != len(valueRefsToCompare) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for _, valueRefToCompare := range valueRefsToCompare {
|
||||||
|
name := e.valueName(valueRefToCompare)
|
||||||
|
if !e.valueSet[name] {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e enumSharedType) valueRefs() []int {
|
||||||
|
return e.EnumValuesDefinition.Refs
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e enumSharedType) valueName(ref int) string {
|
||||||
|
return e.document.EnumValueDefinitionNameString(ref)
|
||||||
|
}
|
||||||
|
|
||||||
|
type unionSharedType struct {
|
||||||
|
*ast.UnionTypeDefinition
|
||||||
|
document *ast.Document
|
||||||
|
valueSet map[string]bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func newUnionSharedType(document *ast.Document, ref int) unionSharedType {
|
||||||
|
u := unionSharedType{
|
||||||
|
&document.UnionTypeDefinitions[ref],
|
||||||
|
document,
|
||||||
|
nil,
|
||||||
|
}
|
||||||
|
u.valueSet = createValueSet(u)
|
||||||
|
return u
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u unionSharedType) areValuesIdentical(valueRefsToCompare []int) bool {
|
||||||
|
if len(u.valueRefs()) != len(valueRefsToCompare) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for _, refToCompare := range valueRefsToCompare {
|
||||||
|
name := u.valueName(refToCompare)
|
||||||
|
if !u.valueSet[name] {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u unionSharedType) valueRefs() []int {
|
||||||
|
return u.UnionMemberTypes.Refs
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u unionSharedType) valueName(ref int) string {
|
||||||
|
return u.document.TypeNameString(ref)
|
||||||
|
}
|
||||||
|
|
||||||
|
type scalarSharedType struct{}
|
||||||
|
|
||||||
|
func (scalarSharedType) areValuesIdentical(_ []int) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scalarSharedType) valueRefs() []int {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scalarSharedType) valueName(_ int) string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package sdlmerge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/astvisitor"
|
||||||
|
"github.com/wundergraph/graphql-go-tools/v2/pkg/operationreport"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newExtendUnionTypeDefinition() *extendUnionTypeDefinitionVisitor {
|
||||||
|
return &extendUnionTypeDefinitionVisitor{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type extendUnionTypeDefinitionVisitor struct {
|
||||||
|
*astvisitor.Walker
|
||||||
|
document *ast.Document
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendUnionTypeDefinitionVisitor) Register(walker *astvisitor.Walker) {
|
||||||
|
e.Walker = walker
|
||||||
|
walker.RegisterEnterDocumentVisitor(e)
|
||||||
|
walker.RegisterEnterUnionTypeExtensionVisitor(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendUnionTypeDefinitionVisitor) EnterDocument(operation, _ *ast.Document) {
|
||||||
|
e.document = operation
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *extendUnionTypeDefinitionVisitor) EnterUnionTypeExtension(ref int) {
|
||||||
|
nodes, exists := e.document.Index.NodesByNameBytes(e.document.UnionTypeExtensionNameBytes(ref))
|
||||||
|
if !exists {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
hasExtended := false
|
||||||
|
for i := range nodes {
|
||||||
|
if nodes[i].Kind != ast.NodeKindUnionTypeDefinition {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if hasExtended {
|
||||||
|
e.StopWithExternalErr(operationreport.ErrSharedTypesMustNotBeExtended(e.document.UnionTypeExtensionNameString(ref)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
e.document.ExtendUnionTypeDefinitionByUnionTypeExtension(nodes[i].Ref, ref)
|
||||||
|
hasExtended = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if !hasExtended {
|
||||||
|
e.StopWithExternalErr(operationreport.ErrExtensionOrphansMustResolveInSupergraph(e.document.UnionTypeExtensionNameBytes(ref)))
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user