Compare commits

..

20 Commits

Author SHA1 Message Date
Nikhil Mantri
c77b5b80fd Merge branch 'main' into fix/remove_decoding_url 2026-02-24 20:51:10 +05:30
Vinicius Lourenço
cb1a2a8a13 perf(bundle-size): lazy load pages to reduce main bundle size (#10230)
Some checks failed
build-staging / prepare (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
build-staging / staging (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
2026-02-24 10:41:40 +00:00
Nikhil Soni
1a5d37b25a fix: add missing filtering for ip address for scalar data (#10264)
* fix: add missing filtering for ip address for scalar data

In domain listing api for external api monitoring,
we have option to filter out the IP address but
it only handles timeseries and raw type data while
domain list handler returns scalar data.

* fix: switch to new derived attributes for ip filtering

---------

Co-authored-by: Nityananda Gohain <nityanandagohain@gmail.com>
2026-02-24 10:26:10 +00:00
Piyush Singariya
bc4273f2f8 chore: test clickhouse version 25.12.5 (#10402) 2026-02-24 14:55:51 +05:30
Abhi kumar
77fdd28e93 Chore/yaxis cleanup (#10397)
Some checks failed
build-staging / staging (push) Has been cancelled
build-staging / prepare (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
* fix: fixed unit converstion support across thresholds and yaxisunit

* fix: fixed tsc

* fix: fixed failing tests

* chore: cleaned up old yaxisselector

* chore: minor change
2026-02-24 08:57:14 +00:00
Karan Balani
8e08a42617 feat: control visibility of root user in list user api using flagger (#10381) 2026-02-24 08:29:36 +00:00
Abhi kumar
2c3042304a fix: fixed unit converstion support across thresholds and yaxisunit (#10393)
* fix: fixed unit converstion support across thresholds and yaxisunit

* fix: fixed tsc

* fix: fixed failing tests

* chore: minor change
2026-02-24 13:47:28 +05:30
Ishan
c9da09256e feat: 3729 Add to alert flow from Logs Explorer doesn't work (#10241)
* feat: add to alert bug

* feat: moved logic to util

* feat: updated null checks

* feat: reverting to first commit

* feat: list panel check

* feat: list panel try/catch

* feat: added testcases
2026-02-24 12:38:29 +05:30
primus-bot[bot]
e8ed22cafb chore(release): bump to v0.112.1 (#10400)
Some checks failed
build-staging / prepare (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
build-staging / staging (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
#### Summary
 - Release SigNoz v0.112.1
 - Bump SigNoz OTel Collector to v0.142.1
2026-02-23 17:53:02 +00:00
Nageshbansal
4658232025 feat: address deprecation of signoz-schema-migrator (#10334) 2026-02-23 17:05:16 +00:00
Vikrant Gupta
e8add5942e feat(authz): update authz response to prevent pre-compute (#10385)
Some checks failed
build-staging / prepare (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
build-staging / staging (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
* feat(authz): update get/patch objects request response

* feat(authz): improve handling for openapi spec

* fix(authz): js tests

* fix(authz): js tests

* feat(authz): fix name and selectors
2026-02-23 22:19:28 +05:30
Karan Balani
ddecf05d9f fix: omit unset limit values in gateway update api payload (#10388)
* fix: limit value size and count to pointers with omitempty

* fix: openapi specs backend

* fix: openapi specs frontend

* chore: add go tests for limits validations

* fix: liniting issues

* test: remove go test and add gateway integration tests with mocked gateway for all gateway apis

* feat: add gateway in integration ci src matrix

* chore: divide tests into multiple files for keys and limits and utilities

* fix: creation ingestion key returns 201, check for actual values in tests

* fix: creation ingestion key returns 201, check for actual values in tests

* fix: create ingestion key gateway api mock status code as 201
2026-02-23 16:08:40 +00:00
Nikhil Mantri
bf13b26a37 chore(metrics-explorer): return 404 for non-existent metrics (#10386) 2026-02-23 15:26:48 +00:00
SagarRajput-7
0796e7b388 fix: fixed the invite member validation error with empty detail rows (#10375)
* fix: fixed the invite member validation error with empty detail rows

* fix: updated test cases

* fix: updated test cases

* fix: removed comments

* fix: changed complete button text to Send Invites

* fix: added disabled for sent invites button
2026-02-23 13:33:23 +00:00
Ashwin Bhatkal
25ff140324 fix: response types (#10396) 2026-02-23 18:37:02 +05:30
Vikrant Gupta
465e07de83 fix(openapi): make the error and status as mandatory (#10391)
* fix(openapi): make the error and status as mandatory

* fix(openapi): fix the frontend types
2026-02-23 16:47:24 +05:30
Vikrant Gupta
c04f664e2f fix(openapi): make the data and status required in success responses (#10390) 2026-02-23 16:15:36 +05:30
nikhilmantri0902
43509681fa chore: remove comments 2026-02-22 17:35:49 +05:30
nikhilmantri0902
ff5fcc0e98 chore: remove explicit URL decoding that causes crashes on K8s parameters 2026-02-21 11:21:37 +05:30
nikhilmantri0902
122d88c4d2 chore: fixed all failing sites where double decoding is happening in infra monitoring 2026-02-21 11:07:50 +05:30
129 changed files with 4434 additions and 3460 deletions

View File

@@ -41,31 +41,23 @@ services:
interval: 30s interval: 30s
timeout: 5s timeout: 5s
retries: 3 retries: 3
schema-migrator-sync: telemetrystore-migrator:
image: signoz/signoz-schema-migrator:v0.142.0 image: signoz/signoz-otel-collector:v0.142.0
container_name: schema-migrator-sync container_name: telemetrystore-migrator
environment:
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_DSN=tcp://clickhouse:9000
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_CLUSTER=cluster
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_REPLICATION=true
- SIGNOZ_OTEL_COLLECTOR_TIMEOUT=10m
entrypoint:
- /bin/sh
command: command:
- sync - -c
- --cluster-name=cluster - |
- --dsn=tcp://clickhouse:9000 /signoz-otel-collector migrate bootstrap &&
- --replication=true /signoz-otel-collector migrate sync up &&
- --up= /signoz-otel-collector migrate async up
depends_on: depends_on:
clickhouse: clickhouse:
condition: service_healthy condition: service_healthy
restart: on-failure restart: on-failure
schema-migrator-async:
image: signoz/signoz-schema-migrator:v0.142.0
container_name: schema-migrator-async
command:
- async
- --cluster-name=cluster
- --dsn=tcp://clickhouse:9000
- --replication=true
- --up=
depends_on:
clickhouse:
condition: service_healthy
schema-migrator-sync:
condition: service_completed_successfully
restart: on-failure

View File

@@ -1,14 +1,23 @@
services: services:
signoz-otel-collector: signoz-otel-collector:
image: signoz/signoz-otel-collector:v0.129.6 image: signoz/signoz-otel-collector:v0.142.0
container_name: signoz-otel-collector-dev container_name: signoz-otel-collector-dev
entrypoint:
- /bin/sh
command: command:
- --config=/etc/otel-collector-config.yaml - -c
- |
/signoz-otel-collector migrate sync check &&
/signoz-otel-collector --config=/etc/otel-collector-config.yaml
volumes: volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
environment: environment:
- OTEL_RESOURCE_ATTRIBUTES=host.name=signoz-host,os.type=linux - OTEL_RESOURCE_ATTRIBUTES=host.name=signoz-host,os.type=linux
- LOW_CARDINAL_EXCEPTION_GROUPING=false - LOW_CARDINAL_EXCEPTION_GROUPING=false
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_DSN=tcp://clickhouse:9000
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_CLUSTER=cluster
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_REPLICATION=true
- SIGNOZ_OTEL_COLLECTOR_TIMEOUT=10m
ports: ports:
- "4317:4317" # OTLP gRPC receiver - "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver - "4318:4318" # OTLP HTTP receiver

View File

@@ -48,12 +48,13 @@ jobs:
- role - role
- ttl - ttl
- alerts - alerts
- ingestionkeys
sqlstore-provider: sqlstore-provider:
- postgres - postgres
- sqlite - sqlite
clickhouse-version: clickhouse-version:
- 25.5.6 - 25.5.6
- 25.10.5 - 25.12.5
schema-migrator-version: schema-migrator-version:
- v0.142.0 - v0.142.0
postgres-version: postgres-version:

View File

@@ -318,4 +318,5 @@ user:
# The password of the root user. Must meet password requirements. # The password of the root user. Must meet password requirements.
password: "" password: ""
# The name of the organization to create or look up for the root user. # The name of the organization to create or look up for the root user.
org_name: default org:
name: default

View File

@@ -61,7 +61,6 @@ x-db-depend: &db-depend
- clickhouse - clickhouse
- clickhouse-2 - clickhouse-2
- clickhouse-3 - clickhouse-3
- schema-migrator
services: services:
init-clickhouse: init-clickhouse:
!!merge <<: *common !!merge <<: *common
@@ -136,12 +135,17 @@ services:
# - "9000:9000" # - "9000:9000"
# - "8123:8123" # - "8123:8123"
# - "9181:9181" # - "9181:9181"
configs:
- source: clickhouse-config
target: /etc/clickhouse-server/config.xml
- source: clickhouse-users
target: /etc/clickhouse-server/users.xml
- source: clickhouse-custom-function
target: /etc/clickhouse-server/custom-function.xml
- source: clickhouse-cluster
target: /etc/clickhouse-server/config.d/cluster.ha.xml
volumes: volumes:
- ../common/clickhouse/config.xml:/etc/clickhouse-server/config.xml
- ../common/clickhouse/users.xml:/etc/clickhouse-server/users.xml
- ../common/clickhouse/custom-function.xml:/etc/clickhouse-server/custom-function.xml
- ../common/clickhouse/user_scripts:/var/lib/clickhouse/user_scripts/ - ../common/clickhouse/user_scripts:/var/lib/clickhouse/user_scripts/
- ../common/clickhouse/cluster.ha.xml:/etc/clickhouse-server/config.d/cluster.xml
- ./clickhouse-setup/data/clickhouse/:/var/lib/clickhouse/ - ./clickhouse-setup/data/clickhouse/:/var/lib/clickhouse/
# - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml # - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml
clickhouse-2: clickhouse-2:
@@ -151,12 +155,17 @@ services:
# - "9001:9000" # - "9001:9000"
# - "8124:8123" # - "8124:8123"
# - "9182:9181" # - "9182:9181"
configs:
- source: clickhouse-config
target: /etc/clickhouse-server/config.xml
- source: clickhouse-users
target: /etc/clickhouse-server/users.xml
- source: clickhouse-custom-function
target: /etc/clickhouse-server/custom-function.xml
- source: clickhouse-cluster
target: /etc/clickhouse-server/config.d/cluster.ha.xml
volumes: volumes:
- ../common/clickhouse/config.xml:/etc/clickhouse-server/config.xml
- ../common/clickhouse/users.xml:/etc/clickhouse-server/users.xml
- ../common/clickhouse/custom-function.xml:/etc/clickhouse-server/custom-function.xml
- ../common/clickhouse/user_scripts:/var/lib/clickhouse/user_scripts/ - ../common/clickhouse/user_scripts:/var/lib/clickhouse/user_scripts/
- ../common/clickhouse/cluster.ha.xml:/etc/clickhouse-server/config.d/cluster.xml
- ./clickhouse-setup/data/clickhouse-2/:/var/lib/clickhouse/ - ./clickhouse-setup/data/clickhouse-2/:/var/lib/clickhouse/
# - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml # - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml
clickhouse-3: clickhouse-3:
@@ -166,37 +175,32 @@ services:
# - "9002:9000" # - "9002:9000"
# - "8125:8123" # - "8125:8123"
# - "9183:9181" # - "9183:9181"
configs:
- source: clickhouse-config
target: /etc/clickhouse-server/config.xml
- source: clickhouse-users
target: /etc/clickhouse-server/users.xml
- source: clickhouse-custom-function
target: /etc/clickhouse-server/custom-function.xml
- source: clickhouse-cluster
target: /etc/clickhouse-server/config.d/cluster.ha.xml
volumes: volumes:
- ../common/clickhouse/config.xml:/etc/clickhouse-server/config.xml
- ../common/clickhouse/users.xml:/etc/clickhouse-server/users.xml
- ../common/clickhouse/custom-function.xml:/etc/clickhouse-server/custom-function.xml
- ../common/clickhouse/user_scripts:/var/lib/clickhouse/user_scripts/ - ../common/clickhouse/user_scripts:/var/lib/clickhouse/user_scripts/
- ../common/clickhouse/cluster.ha.xml:/etc/clickhouse-server/config.d/cluster.xml
- ./clickhouse-setup/data/clickhouse-3/:/var/lib/clickhouse/ - ./clickhouse-setup/data/clickhouse-3/:/var/lib/clickhouse/
# - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml # - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml
signoz: signoz:
!!merge <<: *db-depend !!merge <<: *db-depend
image: signoz/signoz:v0.112.0 image: signoz/signoz:v0.112.1
command:
- --config=/root/config/prometheus.yml
ports: ports:
- "8080:8080" # signoz port - "8080:8080" # signoz port
# - "6060:6060" # pprof port # - "6060:6060" # pprof port
volumes: volumes:
- ../common/signoz/prometheus.yml:/root/config/prometheus.yml
- ../common/dashboards:/root/config/dashboards
- ./clickhouse-setup/data/signoz/:/var/lib/signoz/ - ./clickhouse-setup/data/signoz/:/var/lib/signoz/
environment: environment:
- SIGNOZ_ALERTMANAGER_PROVIDER=signoz - SIGNOZ_ALERTMANAGER_PROVIDER=signoz
- SIGNOZ_TELEMETRYSTORE_CLICKHOUSE_DSN=tcp://clickhouse:9000 - SIGNOZ_TELEMETRYSTORE_CLICKHOUSE_DSN=tcp://clickhouse:9000
- SIGNOZ_SQLSTORE_SQLITE_PATH=/var/lib/signoz/signoz.db - SIGNOZ_SQLSTORE_SQLITE_PATH=/var/lib/signoz/signoz.db
- DASHBOARDS_PATH=/root/config/dashboards
- STORAGE=clickhouse
- GODEBUG=netdns=go
- TELEMETRY_ENABLED=true
- DEPLOYMENT_TYPE=docker-swarm
- SIGNOZ_TOKENIZER_JWT_SECRET=secret - SIGNOZ_TOKENIZER_JWT_SECRET=secret
- DOT_METRICS_ENABLED=true
healthcheck: healthcheck:
test: test:
- CMD - CMD
@@ -209,40 +213,48 @@ services:
retries: 3 retries: 3
otel-collector: otel-collector:
!!merge <<: *db-depend !!merge <<: *db-depend
image: signoz/signoz-otel-collector:v0.142.0 image: signoz/signoz-otel-collector:v0.142.1
entrypoint:
- /bin/sh
command: command:
- --config=/etc/otel-collector-config.yaml - -c
- --manager-config=/etc/manager-config.yaml - |
- --copy-path=/var/tmp/collector-config.yaml /signoz-otel-collector migrate sync check &&
volumes: /signoz-otel-collector --config=/etc/otel-collector-config.yaml --manager-config=/etc/manager-config.yaml --copy-path=/var/tmp/collector-config.yaml
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml configs:
- ../common/signoz/otel-collector-opamp-config.yaml:/etc/manager-config.yaml - source: otel-collector-config
target: /etc/otel-collector-config.yaml
- source: otel-manager-config
target: /etc/manager-config.yaml
environment: environment:
- OTEL_RESOURCE_ATTRIBUTES=host.name={{.Node.Hostname}},os.type={{.Node.Platform.OS}} - OTEL_RESOURCE_ATTRIBUTES=host.name={{.Node.Hostname}},os.type={{.Node.Platform.OS}}
- LOW_CARDINAL_EXCEPTION_GROUPING=false - LOW_CARDINAL_EXCEPTION_GROUPING=false
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_DSN=tcp://clickhouse:9000
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_CLUSTER=cluster
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_REPLICATION=true
- SIGNOZ_OTEL_COLLECTOR_TIMEOUT=10m
ports: ports:
# - "1777:1777" # pprof extension # - "1777:1777" # pprof extension
- "4317:4317" # OTLP gRPC receiver - "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver - "4318:4318" # OTLP HTTP receiver
deploy: deploy:
replicas: 3 replicas: 3
depends_on: signoz-telemetrystore-migrator:
- clickhouse !!merge <<: *db-depend
- schema-migrator image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.0}
- signoz environment:
schema-migrator: - SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_DSN=tcp://clickhouse:9000
!!merge <<: *common - SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_CLUSTER=cluster
image: signoz/signoz-schema-migrator:v0.142.0 - SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_REPLICATION=true
deploy: - SIGNOZ_OTEL_COLLECTOR_TIMEOUT=10m
restart_policy: entrypoint:
condition: on-failure - /bin/sh
delay: 5s
entrypoint: sh
command: command:
- -c - -c
- "/signoz-schema-migrator sync --dsn=tcp://clickhouse:9000 --up= && /signoz-schema-migrator async --dsn=tcp://clickhouse:9000 --up=" - |
depends_on: /signoz-otel-collector migrate bootstrap &&
- clickhouse /signoz-otel-collector migrate sync up &&
/signoz-otel-collector migrate async up
networks: networks:
signoz-net: signoz-net:
name: signoz-net name: signoz-net
@@ -261,3 +273,16 @@ volumes:
name: signoz-zookeeper-2 name: signoz-zookeeper-2
zookeeper-3: zookeeper-3:
name: signoz-zookeeper-3 name: signoz-zookeeper-3
configs:
clickhouse-config:
file: ../common/clickhouse/config.xml
clickhouse-users:
file: ../common/clickhouse/users.xml
clickhouse-custom-function:
file: ../common/clickhouse/custom-function.xml
clickhouse-cluster:
file: ../common/clickhouse/cluster.ha.xml
otel-collector-config:
file: ./otel-collector-config.yaml
otel-manager-config:
file: ../common/signoz/otel-collector-opamp-config.yaml

View File

@@ -58,7 +58,6 @@ x-db-depend: &db-depend
!!merge <<: *common !!merge <<: *common
depends_on: depends_on:
- clickhouse - clickhouse
- schema-migrator
services: services:
init-clickhouse: init-clickhouse:
!!merge <<: *common !!merge <<: *common
@@ -114,30 +113,20 @@ services:
target: /etc/clickhouse-server/config.d/cluster.xml target: /etc/clickhouse-server/config.d/cluster.xml
volumes: volumes:
- clickhouse:/var/lib/clickhouse/ - clickhouse:/var/lib/clickhouse/
- ../common/clickhouse/user_scripts:/var/lib/clickhouse/user_scripts/
# - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml # - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml
signoz: signoz:
!!merge <<: *db-depend !!merge <<: *db-depend
image: signoz/signoz:v0.112.0 image: signoz/signoz:v0.112.1
command:
- --config=/root/config/prometheus.yml
ports: ports:
- "8080:8080" # signoz port - "8080:8080" # signoz port
# - "6060:6060" # pprof port
volumes: volumes:
- sqlite:/var/lib/signoz/ - sqlite:/var/lib/signoz/
configs:
- source: signoz-prometheus-config
target: /root/config/prometheus.yml
environment: environment:
- SIGNOZ_ALERTMANAGER_PROVIDER=signoz - SIGNOZ_ALERTMANAGER_PROVIDER=signoz
- SIGNOZ_TELEMETRYSTORE_CLICKHOUSE_DSN=tcp://clickhouse:9000 - SIGNOZ_TELEMETRYSTORE_CLICKHOUSE_DSN=tcp://clickhouse:9000
- SIGNOZ_SQLSTORE_SQLITE_PATH=/var/lib/signoz/signoz.db - SIGNOZ_SQLSTORE_SQLITE_PATH=/var/lib/signoz/signoz.db
- DASHBOARDS_PATH=/root/config/dashboards - SIGNOZ_TOKENIZER_JWT_SECRET=secret
- STORAGE=clickhouse
- GODEBUG=netdns=go
- TELEMETRY_ENABLED=true
- DEPLOYMENT_TYPE=docker-swarm
- DOT_METRICS_ENABLED=true
healthcheck: healthcheck:
test: test:
- CMD - CMD
@@ -150,11 +139,14 @@ services:
retries: 3 retries: 3
otel-collector: otel-collector:
!!merge <<: *db-depend !!merge <<: *db-depend
image: signoz/signoz-otel-collector:v0.142.0 image: signoz/signoz-otel-collector:v0.142.1
entrypoint:
- /bin/sh
command: command:
- --config=/etc/otel-collector-config.yaml - -c
- --manager-config=/etc/manager-config.yaml - |
- --copy-path=/var/tmp/collector-config.yaml /signoz-otel-collector migrate sync check &&
/signoz-otel-collector --config=/etc/otel-collector-config.yaml --manager-config=/etc/manager-config.yaml --copy-path=/var/tmp/collector-config.yaml
configs: configs:
- source: otel-collector-config - source: otel-collector-config
target: /etc/otel-collector-config.yaml target: /etc/otel-collector-config.yaml
@@ -163,29 +155,32 @@ services:
environment: environment:
- OTEL_RESOURCE_ATTRIBUTES=host.name={{.Node.Hostname}},os.type={{.Node.Platform.OS}} - OTEL_RESOURCE_ATTRIBUTES=host.name={{.Node.Hostname}},os.type={{.Node.Platform.OS}}
- LOW_CARDINAL_EXCEPTION_GROUPING=false - LOW_CARDINAL_EXCEPTION_GROUPING=false
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_DSN=tcp://clickhouse:9000
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_CLUSTER=cluster
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_REPLICATION=true
- SIGNOZ_OTEL_COLLECTOR_TIMEOUT=10m
ports: ports:
# - "1777:1777" # pprof extension # - "1777:1777" # pprof extension
- "4317:4317" # OTLP gRPC receiver - "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver - "4318:4318" # OTLP HTTP receiver
deploy: deploy:
replicas: 3 replicas: 3
depends_on: signoz-telemetrystore-migrator:
- clickhouse !!merge <<: *db-depend
- schema-migrator image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.0}
- signoz environment:
schema-migrator: - SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_DSN=tcp://clickhouse:9000
!!merge <<: *common - SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_CLUSTER=cluster
image: signoz/signoz-schema-migrator:v0.142.0 - SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_REPLICATION=true
deploy: - SIGNOZ_OTEL_COLLECTOR_TIMEOUT=10m
restart_policy: entrypoint:
condition: on-failure - /bin/sh
delay: 5s
entrypoint: sh
command: command:
- -c - -c
- "/signoz-schema-migrator sync --dsn=tcp://clickhouse:9000 --up= && /signoz-schema-migrator async --dsn=tcp://clickhouse:9000 --up=" - |
depends_on: /signoz-otel-collector migrate bootstrap &&
- clickhouse /signoz-otel-collector migrate sync up &&
/signoz-otel-collector migrate async up
networks: networks:
signoz-net: signoz-net:
name: signoz-net name: signoz-net
@@ -205,14 +200,6 @@ configs:
file: ../common/clickhouse/custom-function.xml file: ../common/clickhouse/custom-function.xml
clickhouse-cluster: clickhouse-cluster:
file: ../common/clickhouse/cluster.xml file: ../common/clickhouse/cluster.xml
signoz-prometheus-config:
file: ../common/signoz/prometheus.yml
# If you have multiple dashboard files, you can list them individually:
# dashboard-foo:
# file: ../common/dashboards/foo.json
# dashboard-bar:
# file: ../common/dashboards/bar.json
otel-collector-config: otel-collector-config:
file: ./otel-collector-config.yaml file: ./otel-collector-config.yaml
otel-manager-config: otel-manager-config:

View File

@@ -62,8 +62,10 @@ x-db-depend: &db-depend
depends_on: depends_on:
clickhouse: clickhouse:
condition: service_healthy condition: service_healthy
schema-migrator-sync: clickhouse-2:
condition: service_completed_successfully condition: service_healthy
clickhouse-3:
condition: service_healthy
services: services:
init-clickhouse: init-clickhouse:
!!merge <<: *common !!merge <<: *common
@@ -179,27 +181,17 @@ services:
# - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml # - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml
signoz: signoz:
!!merge <<: *db-depend !!merge <<: *db-depend
image: signoz/signoz:${VERSION:-v0.112.0} image: signoz/signoz:${VERSION:-v0.112.1}
container_name: signoz container_name: signoz
command:
- --config=/root/config/prometheus.yml
ports: ports:
- "8080:8080" # signoz port - "8080:8080" # signoz port
# - "6060:6060" # pprof port
volumes: volumes:
- ../common/signoz/prometheus.yml:/root/config/prometheus.yml
- ../common/dashboards:/root/config/dashboards
- sqlite:/var/lib/signoz/ - sqlite:/var/lib/signoz/
environment: environment:
- SIGNOZ_ALERTMANAGER_PROVIDER=signoz - SIGNOZ_ALERTMANAGER_PROVIDER=signoz
- SIGNOZ_TELEMETRYSTORE_CLICKHOUSE_DSN=tcp://clickhouse:9000 - SIGNOZ_TELEMETRYSTORE_CLICKHOUSE_DSN=tcp://clickhouse:9000
- SIGNOZ_SQLSTORE_SQLITE_PATH=/var/lib/signoz/signoz.db - SIGNOZ_SQLSTORE_SQLITE_PATH=/var/lib/signoz/signoz.db
- DASHBOARDS_PATH=/root/config/dashboards - SIGNOZ_TOKENIZER_JWT_SECRET=secret
- STORAGE=clickhouse
- GODEBUG=netdns=go
- TELEMETRY_ENABLED=true
- DEPLOYMENT_TYPE=docker-standalone-amd
- DOT_METRICS_ENABLED=true
healthcheck: healthcheck:
test: test:
- CMD - CMD
@@ -210,51 +202,48 @@ services:
interval: 30s interval: 30s
timeout: 5s timeout: 5s
retries: 3 retries: 3
# TODO: support otel-collector multiple replicas. Nginx/Traefik for loadbalancing?
otel-collector: otel-collector:
!!merge <<: *db-depend !!merge <<: *db-depend
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.0} image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.1}
container_name: signoz-otel-collector container_name: signoz-otel-collector
entrypoint:
- /bin/sh
command: command:
- --config=/etc/otel-collector-config.yaml - -c
- --manager-config=/etc/manager-config.yaml - |
- --copy-path=/var/tmp/collector-config.yaml /signoz-otel-collector migrate sync check &&
/signoz-otel-collector --config=/etc/otel-collector-config.yaml --manager-config=/etc/manager-config.yaml --copy-path=/var/tmp/collector-config.yaml
volumes: volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
- ../common/signoz/otel-collector-opamp-config.yaml:/etc/manager-config.yaml - ../common/signoz/otel-collector-opamp-config.yaml:/etc/manager-config.yaml
environment: environment:
- OTEL_RESOURCE_ATTRIBUTES=host.name=signoz-host,os.type=linux - OTEL_RESOURCE_ATTRIBUTES=host.name=signoz-host,os.type=linux
- LOW_CARDINAL_EXCEPTION_GROUPING=false - LOW_CARDINAL_EXCEPTION_GROUPING=false
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_DSN=tcp://clickhouse:9000
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_CLUSTER=cluster
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_REPLICATION=true
- SIGNOZ_OTEL_COLLECTOR_TIMEOUT=10m
ports: ports:
# - "1777:1777" # pprof extension # - "1777:1777" # pprof extension
- "4317:4317" # OTLP gRPC receiver - "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver - "4318:4318" # OTLP HTTP receiver
depends_on: signoz-telemetrystore-migrator:
clickhouse:
condition: service_healthy
schema-migrator-sync:
condition: service_completed_successfully
signoz:
condition: service_healthy
schema-migrator-sync:
!!merge <<: *common
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-v0.142.0}
container_name: schema-migrator-sync
command:
- sync
- --dsn=tcp://clickhouse:9000
- --up=
depends_on:
clickhouse:
condition: service_healthy
schema-migrator-async:
!!merge <<: *db-depend !!merge <<: *db-depend
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-v0.142.0} image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.0}
container_name: schema-migrator-async container_name: signoz-telemetrystore-migrator
environment:
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_DSN=tcp://clickhouse:9000
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_CLUSTER=cluster
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_REPLICATION=true
- SIGNOZ_OTEL_COLLECTOR_TIMEOUT=10m
entrypoint:
- /bin/sh
command: command:
- async - -c
- --dsn=tcp://clickhouse:9000 - |
- --up= /signoz-otel-collector migrate bootstrap &&
/signoz-otel-collector migrate sync up &&
/signoz-otel-collector migrate async up
restart: on-failure restart: on-failure
networks: networks:
signoz-net: signoz-net:

View File

@@ -57,8 +57,6 @@ x-db-depend: &db-depend
depends_on: depends_on:
clickhouse: clickhouse:
condition: service_healthy condition: service_healthy
schema-migrator-sync:
condition: service_completed_successfully
services: services:
init-clickhouse: init-clickhouse:
!!merge <<: *common !!merge <<: *common
@@ -111,27 +109,17 @@ services:
# - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml # - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml
signoz: signoz:
!!merge <<: *db-depend !!merge <<: *db-depend
image: signoz/signoz:${VERSION:-v0.112.0} image: signoz/signoz:${VERSION:-v0.112.1}
container_name: signoz container_name: signoz
command:
- --config=/root/config/prometheus.yml
ports: ports:
- "8080:8080" # signoz port - "8080:8080" # signoz port
# - "6060:6060" # pprof port
volumes: volumes:
- ../common/signoz/prometheus.yml:/root/config/prometheus.yml
- ../common/dashboards:/root/config/dashboards
- sqlite:/var/lib/signoz/ - sqlite:/var/lib/signoz/
environment: environment:
- SIGNOZ_ALERTMANAGER_PROVIDER=signoz - SIGNOZ_ALERTMANAGER_PROVIDER=signoz
- SIGNOZ_TELEMETRYSTORE_CLICKHOUSE_DSN=tcp://clickhouse:9000 - SIGNOZ_TELEMETRYSTORE_CLICKHOUSE_DSN=tcp://clickhouse:9000
- SIGNOZ_SQLSTORE_SQLITE_PATH=/var/lib/signoz/signoz.db - SIGNOZ_SQLSTORE_SQLITE_PATH=/var/lib/signoz/signoz.db
- DASHBOARDS_PATH=/root/config/dashboards - SIGNOZ_TOKENIZER_JWT_SECRET=secret
- STORAGE=clickhouse
- GODEBUG=netdns=go
- TELEMETRY_ENABLED=true
- DEPLOYMENT_TYPE=docker-standalone-amd
- DOT_METRICS_ENABLED=true
healthcheck: healthcheck:
test: test:
- CMD - CMD
@@ -144,45 +132,46 @@ services:
retries: 3 retries: 3
otel-collector: otel-collector:
!!merge <<: *db-depend !!merge <<: *db-depend
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.0} image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.1}
container_name: signoz-otel-collector container_name: signoz-otel-collector
entrypoint:
- /bin/sh
command: command:
- --config=/etc/otel-collector-config.yaml - -c
- --manager-config=/etc/manager-config.yaml - |
- --copy-path=/var/tmp/collector-config.yaml /signoz-otel-collector migrate sync check &&
/signoz-otel-collector --config=/etc/otel-collector-config.yaml --manager-config=/etc/manager-config.yaml --copy-path=/var/tmp/collector-config.yaml
volumes: volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
- ../common/signoz/otel-collector-opamp-config.yaml:/etc/manager-config.yaml - ../common/signoz/otel-collector-opamp-config.yaml:/etc/manager-config.yaml
environment: environment:
- OTEL_RESOURCE_ATTRIBUTES=host.name=signoz-host,os.type=linux - OTEL_RESOURCE_ATTRIBUTES=host.name=signoz-host,os.type=linux
- LOW_CARDINAL_EXCEPTION_GROUPING=false - LOW_CARDINAL_EXCEPTION_GROUPING=false
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_DSN=tcp://clickhouse:9000
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_CLUSTER=cluster
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_REPLICATION=true
- SIGNOZ_OTEL_COLLECTOR_TIMEOUT=10m
ports: ports:
# - "1777:1777" # pprof extension # - "1777:1777" # pprof extension
- "4317:4317" # OTLP gRPC receiver - "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver - "4318:4318" # OTLP HTTP receiver
depends_on: signoz-telemetrystore-migrator:
signoz:
condition: service_healthy
schema-migrator-sync:
!!merge <<: *common
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-v0.142.0}
container_name: schema-migrator-sync
command:
- sync
- --dsn=tcp://clickhouse:9000
- --up=
depends_on:
clickhouse:
condition: service_healthy
restart: on-failure
schema-migrator-async:
!!merge <<: *db-depend !!merge <<: *db-depend
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-v0.142.0} image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.0}
container_name: schema-migrator-async container_name: signoz-telemetrystore-migrator
environment:
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_DSN=tcp://clickhouse:9000
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_CLUSTER=cluster
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_REPLICATION=true
- SIGNOZ_OTEL_COLLECTOR_TIMEOUT=10m
entrypoint:
- /bin/sh
command: command:
- async - -c
- --dsn=tcp://clickhouse:9000 - |
- --up= /signoz-otel-collector migrate bootstrap &&
/signoz-otel-collector migrate sync up &&
/signoz-otel-collector migrate async up
restart: on-failure restart: on-failure
networks: networks:
signoz-net: signoz-net:

View File

@@ -80,6 +80,37 @@ components:
updatedAt: updatedAt:
format: date-time format: date-time
type: string type: string
required:
- id
type: object
AuthtypesGettableObjects:
properties:
resource:
$ref: '#/components/schemas/AuthtypesResource'
selectors:
items:
type: string
type: array
required:
- resource
- selectors
type: object
AuthtypesGettableResources:
properties:
relations:
additionalProperties:
items:
type: string
type: array
nullable: true
type: object
resources:
items:
$ref: '#/components/schemas/AuthtypesResource'
type: array
required:
- resources
- relations
type: object type: object
AuthtypesGettableToken: AuthtypesGettableToken:
properties: properties:
@@ -130,8 +161,6 @@ components:
serviceAccountJson: serviceAccountJson:
type: string type: string
type: object type: object
AuthtypesName:
type: object
AuthtypesOIDCConfig: AuthtypesOIDCConfig:
properties: properties:
claimMapping: claimMapping:
@@ -154,7 +183,7 @@ components:
resource: resource:
$ref: '#/components/schemas/AuthtypesResource' $ref: '#/components/schemas/AuthtypesResource'
selector: selector:
$ref: '#/components/schemas/AuthtypesSelector' type: string
required: required:
- resource - resource
- selector - selector
@@ -175,6 +204,22 @@ components:
provider: provider:
type: string type: string
type: object type: object
AuthtypesPatchableObjects:
properties:
additions:
items:
$ref: '#/components/schemas/AuthtypesGettableObjects'
nullable: true
type: array
deletions:
items:
$ref: '#/components/schemas/AuthtypesGettableObjects'
nullable: true
type: array
required:
- additions
- deletions
type: object
AuthtypesPostableAuthDomain: AuthtypesPostableAuthDomain:
properties: properties:
config: config:
@@ -199,7 +244,7 @@ components:
AuthtypesResource: AuthtypesResource:
properties: properties:
name: name:
$ref: '#/components/schemas/AuthtypesName' type: string
type: type:
type: string type: string
required: required:
@@ -231,8 +276,6 @@ components:
samlIdp: samlIdp:
type: string type: string
type: object type: object
AuthtypesSelector:
type: object
AuthtypesSessionContext: AuthtypesSessionContext:
properties: properties:
exists: exists:
@@ -245,8 +288,6 @@ components:
type: object type: object
AuthtypesTransaction: AuthtypesTransaction:
properties: properties:
id:
type: string
object: object:
$ref: '#/components/schemas/AuthtypesObject' $ref: '#/components/schemas/AuthtypesObject'
relation: relation:
@@ -326,6 +367,9 @@ components:
type: string type: string
url: url:
type: string type: string
required:
- code
- message
type: object type: object
ErrorsResponseerroradditional: ErrorsResponseerroradditional:
properties: properties:
@@ -457,10 +501,10 @@ components:
GatewaytypesLimitValue: GatewaytypesLimitValue:
properties: properties:
count: count:
format: int64 nullable: true
type: integer type: integer
size: size:
format: int64 nullable: true
type: integer type: integer
type: object type: object
GatewaytypesPagination: GatewaytypesPagination:
@@ -1661,40 +1705,9 @@ components:
$ref: '#/components/schemas/ErrorsJSON' $ref: '#/components/schemas/ErrorsJSON'
status: status:
type: string type: string
type: object
RoletypesGettableResources:
properties:
relations:
additionalProperties:
items:
type: string
type: array
nullable: true
type: object
resources:
items:
$ref: '#/components/schemas/AuthtypesResource'
nullable: true
type: array
required: required:
- resources - status
- relations - error
type: object
RoletypesPatchableObjects:
properties:
additions:
items:
$ref: '#/components/schemas/AuthtypesObject'
nullable: true
type: array
deletions:
items:
$ref: '#/components/schemas/AuthtypesObject'
nullable: true
type: array
required:
- additions
- deletions
type: object type: object
RoletypesPatchableRole: RoletypesPatchableRole:
properties: properties:
@@ -1731,6 +1744,7 @@ components:
format: date-time format: date-time
type: string type: string
required: required:
- id
- name - name
- description - description
- type - type
@@ -1868,6 +1882,8 @@ components:
$ref: '#/components/schemas/TypesUser' $ref: '#/components/schemas/TypesUser'
userId: userId:
type: string type: string
required:
- id
type: object type: object
TypesGettableGlobalConfig: TypesGettableGlobalConfig:
properties: properties:
@@ -1880,6 +1896,8 @@ components:
properties: properties:
id: id:
type: string type: string
required:
- id
type: object type: object
TypesInvite: TypesInvite:
properties: properties:
@@ -1903,6 +1921,8 @@ components:
updatedAt: updatedAt:
format: date-time format: date-time
type: string type: string
required:
- id
type: object type: object
TypesOrganization: TypesOrganization:
properties: properties:
@@ -1923,6 +1943,8 @@ components:
updatedAt: updatedAt:
format: date-time format: date-time
type: string type: string
required:
- id
type: object type: object
TypesPostableAPIKey: TypesPostableAPIKey:
properties: properties:
@@ -1986,6 +2008,8 @@ components:
type: string type: string
token: token:
type: string type: string
required:
- id
type: object type: object
TypesStorableAPIKey: TypesStorableAPIKey:
properties: properties:
@@ -2011,6 +2035,8 @@ components:
type: string type: string
userId: userId:
type: string type: string
required:
- id
type: object type: object
TypesUser: TypesUser:
properties: properties:
@@ -2032,6 +2058,8 @@ components:
updatedAt: updatedAt:
format: date-time format: date-time
type: string type: string
required:
- id
type: object type: object
ZeustypesGettableHost: ZeustypesGettableHost:
properties: properties:
@@ -2150,6 +2178,9 @@ paths:
type: array type: array
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"500": "500":
@@ -2161,6 +2192,35 @@ paths:
summary: Check permissions summary: Check permissions
tags: tags:
- authz - authz
/api/v1/authz/resources:
get:
deprecated: false
description: Gets all the available resources
operationId: AuthzResources
responses:
"200":
content:
application/json:
schema:
properties:
data:
$ref: '#/components/schemas/AuthtypesGettableResources'
status:
type: string
required:
- status
- data
type: object
description: OK
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/RenderErrorResponse'
description: Internal Server Error
summary: Get resources
tags:
- authz
/api/v1/changePassword/{id}: /api/v1/changePassword/{id}:
post: post:
deprecated: false deprecated: false
@@ -2233,6 +2293,9 @@ paths:
$ref: '#/components/schemas/AuthtypesGettableToken' $ref: '#/components/schemas/AuthtypesGettableToken'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: See Other description: See Other
"400": "400":
@@ -2271,6 +2334,9 @@ paths:
$ref: '#/components/schemas/AuthtypesGettableToken' $ref: '#/components/schemas/AuthtypesGettableToken'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: See Other description: See Other
"400": "400":
@@ -2334,6 +2400,9 @@ paths:
$ref: '#/components/schemas/AuthtypesGettableToken' $ref: '#/components/schemas/AuthtypesGettableToken'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: See Other description: See Other
"400": "400":
@@ -2428,6 +2497,9 @@ paths:
$ref: '#/components/schemas/DashboardtypesGettablePublicDasbhboard' $ref: '#/components/schemas/DashboardtypesGettablePublicDasbhboard'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -2482,6 +2554,9 @@ paths:
$ref: '#/components/schemas/TypesIdentifiable' $ref: '#/components/schemas/TypesIdentifiable'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: Created description: Created
"401": "401":
@@ -2575,6 +2650,9 @@ paths:
type: array type: array
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -2622,6 +2700,9 @@ paths:
$ref: '#/components/schemas/AuthtypesGettableAuthDomain' $ref: '#/components/schemas/AuthtypesGettableAuthDomain'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -2818,6 +2899,9 @@ paths:
$ref: '#/components/schemas/TelemetrytypesGettableFieldKeys' $ref: '#/components/schemas/TelemetrytypesGettableFieldKeys'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -2908,6 +2992,9 @@ paths:
$ref: '#/components/schemas/TelemetrytypesGettableFieldValues' $ref: '#/components/schemas/TelemetrytypesGettableFieldValues'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -2957,6 +3044,9 @@ paths:
$ref: '#/components/schemas/TypesResetPasswordToken' $ref: '#/components/schemas/TypesResetPasswordToken'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -3012,6 +3102,9 @@ paths:
$ref: '#/components/schemas/TypesGettableGlobalConfig' $ref: '#/components/schemas/TypesGettableGlobalConfig'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -3057,6 +3150,9 @@ paths:
type: array type: array
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -3104,6 +3200,9 @@ paths:
$ref: '#/components/schemas/TypesInvite' $ref: '#/components/schemas/TypesInvite'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: Created description: Created
"400": "400":
@@ -3217,6 +3316,9 @@ paths:
$ref: '#/components/schemas/TypesInvite' $ref: '#/components/schemas/TypesInvite'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -3260,6 +3362,9 @@ paths:
$ref: '#/components/schemas/TypesUser' $ref: '#/components/schemas/TypesUser'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: Created description: Created
"400": "400":
@@ -3354,6 +3459,9 @@ paths:
type: array type: array
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -3452,6 +3560,9 @@ paths:
type: array type: array
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -3501,6 +3612,9 @@ paths:
$ref: '#/components/schemas/PreferencetypesPreference' $ref: '#/components/schemas/PreferencetypesPreference'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -3614,6 +3728,9 @@ paths:
type: array type: array
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -3661,6 +3778,9 @@ paths:
$ref: '#/components/schemas/TypesGettableAPIKey' $ref: '#/components/schemas/TypesGettableAPIKey'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: Created description: Created
"400": "400":
@@ -3828,6 +3948,9 @@ paths:
$ref: '#/components/schemas/DashboardtypesGettablePublicDashboardData' $ref: '#/components/schemas/DashboardtypesGettablePublicDashboardData'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -3881,6 +4004,9 @@ paths:
$ref: '#/components/schemas/Querybuildertypesv5QueryRangeResponse' $ref: '#/components/schemas/Querybuildertypesv5QueryRangeResponse'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -3958,6 +4084,9 @@ paths:
type: array type: array
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -4005,6 +4134,9 @@ paths:
$ref: '#/components/schemas/TypesIdentifiable' $ref: '#/components/schemas/TypesIdentifiable'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: Created description: Created
"400": "400":
@@ -4139,6 +4271,9 @@ paths:
$ref: '#/components/schemas/RoletypesRole' $ref: '#/components/schemas/RoletypesRole'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -4258,10 +4393,13 @@ paths:
properties: properties:
data: data:
items: items:
$ref: '#/components/schemas/AuthtypesObject' $ref: '#/components/schemas/AuthtypesGettableObjects'
type: array type: array
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -4328,7 +4466,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/RoletypesPatchableObjects' $ref: '#/components/schemas/AuthtypesPatchableObjects'
responses: responses:
"204": "204":
content: content:
@@ -4386,49 +4524,6 @@ paths:
summary: Patch objects for a role by relation summary: Patch objects for a role by relation
tags: tags:
- role - role
/api/v1/roles/resources:
get:
deprecated: false
description: Gets all the available resources for role assignment
operationId: GetResources
responses:
"200":
content:
application/json:
schema:
properties:
data:
$ref: '#/components/schemas/RoletypesGettableResources'
status:
type: string
type: object
description: OK
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/RenderErrorResponse'
description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/RenderErrorResponse'
description: Forbidden
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/RenderErrorResponse'
description: Internal Server Error
security:
- api_key:
- ADMIN
- tokenizer:
- ADMIN
summary: Get resources
tags:
- role
/api/v1/user: /api/v1/user:
get: get:
deprecated: false deprecated: false
@@ -4446,6 +4541,9 @@ paths:
type: array type: array
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -4540,6 +4638,9 @@ paths:
$ref: '#/components/schemas/TypesUser' $ref: '#/components/schemas/TypesUser'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -4599,6 +4700,9 @@ paths:
$ref: '#/components/schemas/TypesUser' $ref: '#/components/schemas/TypesUser'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -4654,6 +4758,9 @@ paths:
$ref: '#/components/schemas/TypesUser' $ref: '#/components/schemas/TypesUser'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -4696,6 +4803,9 @@ paths:
type: array type: array
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -4745,6 +4855,9 @@ paths:
$ref: '#/components/schemas/PreferencetypesPreference' $ref: '#/components/schemas/PreferencetypesPreference'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -4887,6 +5000,9 @@ paths:
type: array type: array
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -4939,6 +5055,9 @@ paths:
$ref: '#/components/schemas/GatewaytypesGettableIngestionKeys' $ref: '#/components/schemas/GatewaytypesGettableIngestionKeys'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -4977,7 +5096,7 @@ paths:
schema: schema:
$ref: '#/components/schemas/GatewaytypesPostableIngestionKey' $ref: '#/components/schemas/GatewaytypesPostableIngestionKey'
responses: responses:
"200": "201":
content: content:
application/json: application/json:
schema: schema:
@@ -4986,8 +5105,11 @@ paths:
$ref: '#/components/schemas/GatewaytypesGettableCreatedIngestionKey' $ref: '#/components/schemas/GatewaytypesGettableCreatedIngestionKey'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: Created
"401": "401":
content: content:
application/json: application/json:
@@ -5124,6 +5246,9 @@ paths:
$ref: '#/components/schemas/GatewaytypesGettableCreatedIngestionKeyLimit' $ref: '#/components/schemas/GatewaytypesGettableCreatedIngestionKeyLimit'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: Created description: Created
"401": "401":
@@ -5265,6 +5390,9 @@ paths:
$ref: '#/components/schemas/GatewaytypesGettableIngestionKeys' $ref: '#/components/schemas/GatewaytypesGettableIngestionKeys'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -5328,6 +5456,9 @@ paths:
$ref: '#/components/schemas/MetricsexplorertypesListMetricsResponse' $ref: '#/components/schemas/MetricsexplorertypesListMetricsResponse'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -5383,6 +5514,9 @@ paths:
$ref: '#/components/schemas/MetricsexplorertypesMetricAlertsResponse' $ref: '#/components/schemas/MetricsexplorertypesMetricAlertsResponse'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -5403,6 +5537,12 @@ paths:
schema: schema:
$ref: '#/components/schemas/RenderErrorResponse' $ref: '#/components/schemas/RenderErrorResponse'
description: Forbidden description: Forbidden
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/RenderErrorResponse'
description: Not Found
"500": "500":
content: content:
application/json: application/json:
@@ -5449,6 +5589,9 @@ paths:
$ref: '#/components/schemas/MetricsexplorertypesMetricAttributesResponse' $ref: '#/components/schemas/MetricsexplorertypesMetricAttributesResponse'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -5469,6 +5612,12 @@ paths:
schema: schema:
$ref: '#/components/schemas/RenderErrorResponse' $ref: '#/components/schemas/RenderErrorResponse'
description: Forbidden description: Forbidden
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/RenderErrorResponse'
description: Not Found
"500": "500":
content: content:
application/json: application/json:
@@ -5504,6 +5653,9 @@ paths:
$ref: '#/components/schemas/MetricsexplorertypesMetricDashboardsResponse' $ref: '#/components/schemas/MetricsexplorertypesMetricDashboardsResponse'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -5524,6 +5676,12 @@ paths:
schema: schema:
$ref: '#/components/schemas/RenderErrorResponse' $ref: '#/components/schemas/RenderErrorResponse'
description: Forbidden description: Forbidden
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/RenderErrorResponse'
description: Not Found
"500": "500":
content: content:
application/json: application/json:
@@ -5560,6 +5718,9 @@ paths:
$ref: '#/components/schemas/MetricsexplorertypesMetricHighlightsResponse' $ref: '#/components/schemas/MetricsexplorertypesMetricHighlightsResponse'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -5580,6 +5741,12 @@ paths:
schema: schema:
$ref: '#/components/schemas/RenderErrorResponse' $ref: '#/components/schemas/RenderErrorResponse'
description: Forbidden description: Forbidden
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/RenderErrorResponse'
description: Not Found
"500": "500":
content: content:
application/json: application/json:
@@ -5616,6 +5783,9 @@ paths:
$ref: '#/components/schemas/MetricsexplorertypesMetricMetadata' $ref: '#/components/schemas/MetricsexplorertypesMetricMetadata'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -5732,6 +5902,9 @@ paths:
$ref: '#/components/schemas/MetricsexplorertypesStatsResponse' $ref: '#/components/schemas/MetricsexplorertypesStatsResponse'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -5787,6 +5960,9 @@ paths:
$ref: '#/components/schemas/MetricsexplorertypesTreemapResponse' $ref: '#/components/schemas/MetricsexplorertypesTreemapResponse'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -5836,6 +6012,9 @@ paths:
$ref: '#/components/schemas/TypesOrganization' $ref: '#/components/schemas/TypesOrganization'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"401": "401":
@@ -5966,6 +6145,9 @@ paths:
$ref: '#/components/schemas/AuthtypesSessionContext' $ref: '#/components/schemas/AuthtypesSessionContext'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -6003,6 +6185,9 @@ paths:
$ref: '#/components/schemas/AuthtypesGettableToken' $ref: '#/components/schemas/AuthtypesGettableToken'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -6046,6 +6231,9 @@ paths:
$ref: '#/components/schemas/AuthtypesGettableToken' $ref: '#/components/schemas/AuthtypesGettableToken'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -6078,6 +6266,9 @@ paths:
$ref: '#/components/schemas/ZeustypesGettableHost' $ref: '#/components/schemas/ZeustypesGettableHost'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -6592,6 +6783,9 @@ paths:
$ref: '#/components/schemas/Querybuildertypesv5QueryRangeResponse' $ref: '#/components/schemas/Querybuildertypesv5QueryRangeResponse'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":
@@ -6646,6 +6840,9 @@ paths:
$ref: '#/components/schemas/Querybuildertypesv5QueryRangeRequest' $ref: '#/components/schemas/Querybuildertypesv5QueryRangeRequest'
status: status:
type: string type: string
required:
- status
- data
type: object type: object
description: OK description: OK
"400": "400":

View File

@@ -171,8 +171,6 @@ func (provider *provider) GetResources(_ context.Context) []*authtypes.Resource
for _, register := range provider.registry { for _, register := range provider.registry {
typeables = append(typeables, register.MustGetTypeables()...) typeables = append(typeables, register.MustGetTypeables()...)
} }
// role module cannot self register itself!
typeables = append(typeables, provider.MustGetTypeables()...)
resources := make([]*authtypes.Resource, 0) resources := make([]*authtypes.Resource, 0)
for _, typeable := range typeables { for _, typeable := range typeables {
@@ -259,7 +257,7 @@ func (provider *provider) Delete(ctx context.Context, orgID valuer.UUID, id valu
} }
role := roletypes.NewRoleFromStorableRole(storableRole) role := roletypes.NewRoleFromStorableRole(storableRole)
err = role.CanEditDelete() err = role.ErrIfManaged()
if err != nil { if err != nil {
return err return err
} }

View File

@@ -25,13 +25,13 @@ export default defineConfig({
useMutation: true, useMutation: true,
useInvalidate: true, useInvalidate: true,
signal: true, signal: true,
useOperationIdAsQueryKey: true, useOperationIdAsQueryKey: false,
}, },
useDates: true, useDates: true,
useNamedParameters: true, useNamedParameters: true,
enumGenerationType: 'enum', enumGenerationType: 'enum',
mutator: { mutator: {
path: './src/api/index.ts', path: './src/api/generatedAPIInstance.ts',
name: 'GeneratedAPIInstance', name: 'GeneratedAPIInstance',
}, },

View File

@@ -308,3 +308,15 @@ export const PublicDashboardPage = Loadable(
/* webpackChunkName: "Public Dashboard Page" */ 'pages/PublicDashboard' /* webpackChunkName: "Public Dashboard Page" */ 'pages/PublicDashboard'
), ),
); );
export const AlertTypeSelectionPage = Loadable(
() =>
import(
/* webpackChunkName: "Alert Type Selection Page" */ 'pages/AlertTypeSelection'
),
);
export const MeterExplorerPage = Loadable(
() =>
import(/* webpackChunkName: "Meter Explorer Page" */ 'pages/MeterExplorer'),
);

View File

@@ -1,12 +1,10 @@
import { RouteProps } from 'react-router-dom'; import { RouteProps } from 'react-router-dom';
import ROUTES from 'constants/routes'; import ROUTES from 'constants/routes';
import AlertTypeSelectionPage from 'pages/AlertTypeSelection';
import MessagingQueues from 'pages/MessagingQueues';
import MeterExplorer from 'pages/MeterExplorer';
import { import {
AlertHistory, AlertHistory,
AlertOverview, AlertOverview,
AlertTypeSelectionPage,
AllAlertChannels, AllAlertChannels,
AllErrors, AllErrors,
ApiMonitoring, ApiMonitoring,
@@ -29,6 +27,8 @@ import {
LogsExplorer, LogsExplorer,
LogsIndexToFields, LogsIndexToFields,
LogsSaveViews, LogsSaveViews,
MessagingQueuesMainPage,
MeterExplorerPage,
MetricsExplorer, MetricsExplorer,
OldLogsExplorer, OldLogsExplorer,
Onboarding, Onboarding,
@@ -399,28 +399,28 @@ const routes: AppRoutes[] = [
{ {
path: ROUTES.MESSAGING_QUEUES_KAFKA, path: ROUTES.MESSAGING_QUEUES_KAFKA,
exact: true, exact: true,
component: MessagingQueues, component: MessagingQueuesMainPage,
key: 'MESSAGING_QUEUES_KAFKA', key: 'MESSAGING_QUEUES_KAFKA',
isPrivate: true, isPrivate: true,
}, },
{ {
path: ROUTES.MESSAGING_QUEUES_CELERY_TASK, path: ROUTES.MESSAGING_QUEUES_CELERY_TASK,
exact: true, exact: true,
component: MessagingQueues, component: MessagingQueuesMainPage,
key: 'MESSAGING_QUEUES_CELERY_TASK', key: 'MESSAGING_QUEUES_CELERY_TASK',
isPrivate: true, isPrivate: true,
}, },
{ {
path: ROUTES.MESSAGING_QUEUES_OVERVIEW, path: ROUTES.MESSAGING_QUEUES_OVERVIEW,
exact: true, exact: true,
component: MessagingQueues, component: MessagingQueuesMainPage,
key: 'MESSAGING_QUEUES_OVERVIEW', key: 'MESSAGING_QUEUES_OVERVIEW',
isPrivate: true, isPrivate: true,
}, },
{ {
path: ROUTES.MESSAGING_QUEUES_KAFKA_DETAIL, path: ROUTES.MESSAGING_QUEUES_KAFKA_DETAIL,
exact: true, exact: true,
component: MessagingQueues, component: MessagingQueuesMainPage,
key: 'MESSAGING_QUEUES_KAFKA_DETAIL', key: 'MESSAGING_QUEUES_KAFKA_DETAIL',
isPrivate: true, isPrivate: true,
}, },
@@ -463,21 +463,21 @@ const routes: AppRoutes[] = [
{ {
path: ROUTES.METER, path: ROUTES.METER,
exact: true, exact: true,
component: MeterExplorer, component: MeterExplorerPage,
key: 'METER', key: 'METER',
isPrivate: true, isPrivate: true,
}, },
{ {
path: ROUTES.METER_EXPLORER, path: ROUTES.METER_EXPLORER,
exact: true, exact: true,
component: MeterExplorer, component: MeterExplorerPage,
key: 'METER_EXPLORER', key: 'METER_EXPLORER',
isPrivate: true, isPrivate: true,
}, },
{ {
path: ROUTES.METER_EXPLORER_VIEWS, path: ROUTES.METER_EXPLORER_VIEWS,
exact: true, exact: true,
component: MeterExplorer, component: MeterExplorerPage,
key: 'METER_EXPLORER_VIEWS', key: 'METER_EXPLORER_VIEWS',
isPrivate: true, isPrivate: true,
}, },

View File

@@ -0,0 +1,48 @@
import { RenderErrorResponseDTO } from 'api/generated/services/sigNoz.schemas';
import { AxiosError } from 'axios';
import APIError from 'types/api/error';
// Handles errors from generated API hooks (which use RenderErrorResponseDTO)
export function ErrorResponseHandlerForGeneratedAPIs(
error: AxiosError<RenderErrorResponseDTO>,
): never {
const { response, request } = error;
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
if (response) {
throw new APIError({
httpStatusCode: response.status || 500,
error: {
code: response.data.error.code,
message: response.data.error.message,
url: response.data.error.url ?? '',
errors: (response.data.error.errors ?? []).map((e) => ({
message: e.message ?? '',
})),
},
});
}
// The request was made but no response was received
if (request) {
throw new APIError({
httpStatusCode: error.status || 500,
error: {
code: error.code || error.name,
message: error.message,
url: '',
errors: [],
},
});
}
// Something happened in setting up the request that triggered an Error
throw new APIError({
httpStatusCode: error.status || 500,
error: {
code: error.name,
message: error.message,
url: '',
errors: [],
},
});
}

View File

@@ -17,7 +17,8 @@ import type {
} from 'react-query'; } from 'react-query';
import { useMutation, useQuery } from 'react-query'; import { useMutation, useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
AuthtypesPostableAuthDomainDTO, AuthtypesPostableAuthDomainDTO,
AuthtypesUpdateableAuthDomainDTO, AuthtypesUpdateableAuthDomainDTO,
@@ -45,12 +46,12 @@ export const listAuthDomains = (signal?: AbortSignal) => {
}; };
export const getListAuthDomainsQueryKey = () => { export const getListAuthDomainsQueryKey = () => {
return ['listAuthDomains'] as const; return [`/api/v1/domains`] as const;
}; };
export const getListAuthDomainsQueryOptions = < export const getListAuthDomainsQueryOptions = <
TData = Awaited<ReturnType<typeof listAuthDomains>>, TData = Awaited<ReturnType<typeof listAuthDomains>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof listAuthDomains>>, Awaited<ReturnType<typeof listAuthDomains>>,
@@ -76,7 +77,7 @@ export const getListAuthDomainsQueryOptions = <
export type ListAuthDomainsQueryResult = NonNullable< export type ListAuthDomainsQueryResult = NonNullable<
Awaited<ReturnType<typeof listAuthDomains>> Awaited<ReturnType<typeof listAuthDomains>>
>; >;
export type ListAuthDomainsQueryError = RenderErrorResponseDTO; export type ListAuthDomainsQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary List all auth domains * @summary List all auth domains
@@ -84,7 +85,7 @@ export type ListAuthDomainsQueryError = RenderErrorResponseDTO;
export function useListAuthDomains< export function useListAuthDomains<
TData = Awaited<ReturnType<typeof listAuthDomains>>, TData = Awaited<ReturnType<typeof listAuthDomains>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof listAuthDomains>>, Awaited<ReturnType<typeof listAuthDomains>>,
@@ -123,7 +124,7 @@ export const invalidateListAuthDomains = async (
* @summary Create auth domain * @summary Create auth domain
*/ */
export const createAuthDomain = ( export const createAuthDomain = (
authtypesPostableAuthDomainDTO: AuthtypesPostableAuthDomainDTO, authtypesPostableAuthDomainDTO: BodyType<AuthtypesPostableAuthDomainDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<CreateAuthDomain200>({ return GeneratedAPIInstance<CreateAuthDomain200>({
@@ -136,19 +137,19 @@ export const createAuthDomain = (
}; };
export const getCreateAuthDomainMutationOptions = < export const getCreateAuthDomainMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createAuthDomain>>, Awaited<ReturnType<typeof createAuthDomain>>,
TError, TError,
{ data: AuthtypesPostableAuthDomainDTO }, { data: BodyType<AuthtypesPostableAuthDomainDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof createAuthDomain>>, Awaited<ReturnType<typeof createAuthDomain>>,
TError, TError,
{ data: AuthtypesPostableAuthDomainDTO }, { data: BodyType<AuthtypesPostableAuthDomainDTO> },
TContext TContext
> => { > => {
const mutationKey = ['createAuthDomain']; const mutationKey = ['createAuthDomain'];
@@ -162,7 +163,7 @@ export const getCreateAuthDomainMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof createAuthDomain>>, Awaited<ReturnType<typeof createAuthDomain>>,
{ data: AuthtypesPostableAuthDomainDTO } { data: BodyType<AuthtypesPostableAuthDomainDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -175,26 +176,26 @@ export const getCreateAuthDomainMutationOptions = <
export type CreateAuthDomainMutationResult = NonNullable< export type CreateAuthDomainMutationResult = NonNullable<
Awaited<ReturnType<typeof createAuthDomain>> Awaited<ReturnType<typeof createAuthDomain>>
>; >;
export type CreateAuthDomainMutationBody = AuthtypesPostableAuthDomainDTO; export type CreateAuthDomainMutationBody = BodyType<AuthtypesPostableAuthDomainDTO>;
export type CreateAuthDomainMutationError = RenderErrorResponseDTO; export type CreateAuthDomainMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Create auth domain * @summary Create auth domain
*/ */
export const useCreateAuthDomain = < export const useCreateAuthDomain = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createAuthDomain>>, Awaited<ReturnType<typeof createAuthDomain>>,
TError, TError,
{ data: AuthtypesPostableAuthDomainDTO }, { data: BodyType<AuthtypesPostableAuthDomainDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof createAuthDomain>>, Awaited<ReturnType<typeof createAuthDomain>>,
TError, TError,
{ data: AuthtypesPostableAuthDomainDTO }, { data: BodyType<AuthtypesPostableAuthDomainDTO> },
TContext TContext
> => { > => {
const mutationOptions = getCreateAuthDomainMutationOptions(options); const mutationOptions = getCreateAuthDomainMutationOptions(options);
@@ -213,7 +214,7 @@ export const deleteAuthDomain = ({ id }: DeleteAuthDomainPathParameters) => {
}; };
export const getDeleteAuthDomainMutationOptions = < export const getDeleteAuthDomainMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -253,13 +254,13 @@ export type DeleteAuthDomainMutationResult = NonNullable<
Awaited<ReturnType<typeof deleteAuthDomain>> Awaited<ReturnType<typeof deleteAuthDomain>>
>; >;
export type DeleteAuthDomainMutationError = RenderErrorResponseDTO; export type DeleteAuthDomainMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Delete auth domain * @summary Delete auth domain
*/ */
export const useDeleteAuthDomain = < export const useDeleteAuthDomain = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -284,7 +285,7 @@ export const useDeleteAuthDomain = <
*/ */
export const updateAuthDomain = ( export const updateAuthDomain = (
{ id }: UpdateAuthDomainPathParameters, { id }: UpdateAuthDomainPathParameters,
authtypesUpdateableAuthDomainDTO: AuthtypesUpdateableAuthDomainDTO, authtypesUpdateableAuthDomainDTO: BodyType<AuthtypesUpdateableAuthDomainDTO>,
) => { ) => {
return GeneratedAPIInstance<void>({ return GeneratedAPIInstance<void>({
url: `/api/v1/domains/${id}`, url: `/api/v1/domains/${id}`,
@@ -295,7 +296,7 @@ export const updateAuthDomain = (
}; };
export const getUpdateAuthDomainMutationOptions = < export const getUpdateAuthDomainMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -303,7 +304,7 @@ export const getUpdateAuthDomainMutationOptions = <
TError, TError,
{ {
pathParams: UpdateAuthDomainPathParameters; pathParams: UpdateAuthDomainPathParameters;
data: AuthtypesUpdateableAuthDomainDTO; data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
}, },
TContext TContext
>; >;
@@ -312,7 +313,7 @@ export const getUpdateAuthDomainMutationOptions = <
TError, TError,
{ {
pathParams: UpdateAuthDomainPathParameters; pathParams: UpdateAuthDomainPathParameters;
data: AuthtypesUpdateableAuthDomainDTO; data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
}, },
TContext TContext
> => { > => {
@@ -329,7 +330,7 @@ export const getUpdateAuthDomainMutationOptions = <
Awaited<ReturnType<typeof updateAuthDomain>>, Awaited<ReturnType<typeof updateAuthDomain>>,
{ {
pathParams: UpdateAuthDomainPathParameters; pathParams: UpdateAuthDomainPathParameters;
data: AuthtypesUpdateableAuthDomainDTO; data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
} }
> = (props) => { > = (props) => {
const { pathParams, data } = props ?? {}; const { pathParams, data } = props ?? {};
@@ -343,14 +344,14 @@ export const getUpdateAuthDomainMutationOptions = <
export type UpdateAuthDomainMutationResult = NonNullable< export type UpdateAuthDomainMutationResult = NonNullable<
Awaited<ReturnType<typeof updateAuthDomain>> Awaited<ReturnType<typeof updateAuthDomain>>
>; >;
export type UpdateAuthDomainMutationBody = AuthtypesUpdateableAuthDomainDTO; export type UpdateAuthDomainMutationBody = BodyType<AuthtypesUpdateableAuthDomainDTO>;
export type UpdateAuthDomainMutationError = RenderErrorResponseDTO; export type UpdateAuthDomainMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Update auth domain * @summary Update auth domain
*/ */
export const useUpdateAuthDomain = < export const useUpdateAuthDomain = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -358,7 +359,7 @@ export const useUpdateAuthDomain = <
TError, TError,
{ {
pathParams: UpdateAuthDomainPathParameters; pathParams: UpdateAuthDomainPathParameters;
data: AuthtypesUpdateableAuthDomainDTO; data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
}, },
TContext TContext
>; >;
@@ -367,7 +368,7 @@ export const useUpdateAuthDomain = <
TError, TError,
{ {
pathParams: UpdateAuthDomainPathParameters; pathParams: UpdateAuthDomainPathParameters;
data: AuthtypesUpdateableAuthDomainDTO; data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
}, },
TContext TContext
> => { > => {

View File

@@ -5,16 +5,24 @@
* SigNoz * SigNoz
*/ */
import type { import type {
InvalidateOptions,
MutationFunction, MutationFunction,
QueryClient,
QueryFunction,
QueryKey,
UseMutationOptions, UseMutationOptions,
UseMutationResult, UseMutationResult,
UseQueryOptions,
UseQueryResult,
} from 'react-query'; } from 'react-query';
import { useMutation } from 'react-query'; import { useMutation, useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
AuthtypesTransactionDTO, AuthtypesTransactionDTO,
AuthzCheck200, AuthzCheck200,
AuthzResources200,
RenderErrorResponseDTO, RenderErrorResponseDTO,
} from '../sigNoz.schemas'; } from '../sigNoz.schemas';
@@ -27,7 +35,7 @@ type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
* @summary Check permissions * @summary Check permissions
*/ */
export const authzCheck = ( export const authzCheck = (
authtypesTransactionDTO: AuthtypesTransactionDTO[], authtypesTransactionDTO: BodyType<AuthtypesTransactionDTO[]>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<AuthzCheck200>({ return GeneratedAPIInstance<AuthzCheck200>({
@@ -40,19 +48,19 @@ export const authzCheck = (
}; };
export const getAuthzCheckMutationOptions = < export const getAuthzCheckMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof authzCheck>>, Awaited<ReturnType<typeof authzCheck>>,
TError, TError,
{ data: AuthtypesTransactionDTO[] }, { data: BodyType<AuthtypesTransactionDTO[]> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof authzCheck>>, Awaited<ReturnType<typeof authzCheck>>,
TError, TError,
{ data: AuthtypesTransactionDTO[] }, { data: BodyType<AuthtypesTransactionDTO[]> },
TContext TContext
> => { > => {
const mutationKey = ['authzCheck']; const mutationKey = ['authzCheck'];
@@ -66,7 +74,7 @@ export const getAuthzCheckMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof authzCheck>>, Awaited<ReturnType<typeof authzCheck>>,
{ data: AuthtypesTransactionDTO[] } { data: BodyType<AuthtypesTransactionDTO[]> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -79,29 +87,114 @@ export const getAuthzCheckMutationOptions = <
export type AuthzCheckMutationResult = NonNullable< export type AuthzCheckMutationResult = NonNullable<
Awaited<ReturnType<typeof authzCheck>> Awaited<ReturnType<typeof authzCheck>>
>; >;
export type AuthzCheckMutationBody = AuthtypesTransactionDTO[]; export type AuthzCheckMutationBody = BodyType<AuthtypesTransactionDTO[]>;
export type AuthzCheckMutationError = RenderErrorResponseDTO; export type AuthzCheckMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Check permissions * @summary Check permissions
*/ */
export const useAuthzCheck = < export const useAuthzCheck = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof authzCheck>>, Awaited<ReturnType<typeof authzCheck>>,
TError, TError,
{ data: AuthtypesTransactionDTO[] }, { data: BodyType<AuthtypesTransactionDTO[]> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof authzCheck>>, Awaited<ReturnType<typeof authzCheck>>,
TError, TError,
{ data: AuthtypesTransactionDTO[] }, { data: BodyType<AuthtypesTransactionDTO[]> },
TContext TContext
> => { > => {
const mutationOptions = getAuthzCheckMutationOptions(options); const mutationOptions = getAuthzCheckMutationOptions(options);
return useMutation(mutationOptions); return useMutation(mutationOptions);
}; };
/**
* Gets all the available resources
* @summary Get resources
*/
export const authzResources = (signal?: AbortSignal) => {
return GeneratedAPIInstance<AuthzResources200>({
url: `/api/v1/authz/resources`,
method: 'GET',
signal,
});
};
export const getAuthzResourcesQueryKey = () => {
return [`/api/v1/authz/resources`] as const;
};
export const getAuthzResourcesQueryOptions = <
TData = Awaited<ReturnType<typeof authzResources>>,
TError = ErrorType<RenderErrorResponseDTO>
>(options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof authzResources>>,
TError,
TData
>;
}) => {
const { query: queryOptions } = options ?? {};
const queryKey = queryOptions?.queryKey ?? getAuthzResourcesQueryKey();
const queryFn: QueryFunction<Awaited<ReturnType<typeof authzResources>>> = ({
signal,
}) => authzResources(signal);
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
Awaited<ReturnType<typeof authzResources>>,
TError,
TData
> & { queryKey: QueryKey };
};
export type AuthzResourcesQueryResult = NonNullable<
Awaited<ReturnType<typeof authzResources>>
>;
export type AuthzResourcesQueryError = ErrorType<RenderErrorResponseDTO>;
/**
* @summary Get resources
*/
export function useAuthzResources<
TData = Awaited<ReturnType<typeof authzResources>>,
TError = ErrorType<RenderErrorResponseDTO>
>(options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof authzResources>>,
TError,
TData
>;
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
const queryOptions = getAuthzResourcesQueryOptions(options);
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
queryKey: QueryKey;
};
query.queryKey = queryOptions.queryKey;
return query;
}
/**
* @summary Get resources
*/
export const invalidateAuthzResources = async (
queryClient: QueryClient,
options?: InvalidateOptions,
): Promise<QueryClient> => {
await queryClient.invalidateQueries(
{ queryKey: getAuthzResourcesQueryKey() },
options,
);
return queryClient;
};

View File

@@ -17,7 +17,8 @@ import type {
} from 'react-query'; } from 'react-query';
import { useMutation, useQuery } from 'react-query'; import { useMutation, useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
CreatePublicDashboard201, CreatePublicDashboard201,
CreatePublicDashboardPathParameters, CreatePublicDashboardPathParameters,
@@ -52,7 +53,7 @@ export const deletePublicDashboard = ({
}; };
export const getDeletePublicDashboardMutationOptions = < export const getDeletePublicDashboardMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -92,13 +93,13 @@ export type DeletePublicDashboardMutationResult = NonNullable<
Awaited<ReturnType<typeof deletePublicDashboard>> Awaited<ReturnType<typeof deletePublicDashboard>>
>; >;
export type DeletePublicDashboardMutationError = RenderErrorResponseDTO; export type DeletePublicDashboardMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Delete public dashboard * @summary Delete public dashboard
*/ */
export const useDeletePublicDashboard = < export const useDeletePublicDashboard = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -135,12 +136,12 @@ export const getPublicDashboard = (
export const getGetPublicDashboardQueryKey = ({ export const getGetPublicDashboardQueryKey = ({
id, id,
}: GetPublicDashboardPathParameters) => { }: GetPublicDashboardPathParameters) => {
return ['getPublicDashboard'] as const; return [`/api/v1/dashboards/${id}/public`] as const;
}; };
export const getGetPublicDashboardQueryOptions = < export const getGetPublicDashboardQueryOptions = <
TData = Awaited<ReturnType<typeof getPublicDashboard>>, TData = Awaited<ReturnType<typeof getPublicDashboard>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ id }: GetPublicDashboardPathParameters, { id }: GetPublicDashboardPathParameters,
options?: { options?: {
@@ -175,7 +176,7 @@ export const getGetPublicDashboardQueryOptions = <
export type GetPublicDashboardQueryResult = NonNullable< export type GetPublicDashboardQueryResult = NonNullable<
Awaited<ReturnType<typeof getPublicDashboard>> Awaited<ReturnType<typeof getPublicDashboard>>
>; >;
export type GetPublicDashboardQueryError = RenderErrorResponseDTO; export type GetPublicDashboardQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get public dashboard * @summary Get public dashboard
@@ -183,7 +184,7 @@ export type GetPublicDashboardQueryError = RenderErrorResponseDTO;
export function useGetPublicDashboard< export function useGetPublicDashboard<
TData = Awaited<ReturnType<typeof getPublicDashboard>>, TData = Awaited<ReturnType<typeof getPublicDashboard>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ id }: GetPublicDashboardPathParameters, { id }: GetPublicDashboardPathParameters,
options?: { options?: {
@@ -227,7 +228,7 @@ export const invalidateGetPublicDashboard = async (
*/ */
export const createPublicDashboard = ( export const createPublicDashboard = (
{ id }: CreatePublicDashboardPathParameters, { id }: CreatePublicDashboardPathParameters,
dashboardtypesPostablePublicDashboardDTO: DashboardtypesPostablePublicDashboardDTO, dashboardtypesPostablePublicDashboardDTO: BodyType<DashboardtypesPostablePublicDashboardDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<CreatePublicDashboard201>({ return GeneratedAPIInstance<CreatePublicDashboard201>({
@@ -240,7 +241,7 @@ export const createPublicDashboard = (
}; };
export const getCreatePublicDashboardMutationOptions = < export const getCreatePublicDashboardMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -248,7 +249,7 @@ export const getCreatePublicDashboardMutationOptions = <
TError, TError,
{ {
pathParams: CreatePublicDashboardPathParameters; pathParams: CreatePublicDashboardPathParameters;
data: DashboardtypesPostablePublicDashboardDTO; data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
}, },
TContext TContext
>; >;
@@ -257,7 +258,7 @@ export const getCreatePublicDashboardMutationOptions = <
TError, TError,
{ {
pathParams: CreatePublicDashboardPathParameters; pathParams: CreatePublicDashboardPathParameters;
data: DashboardtypesPostablePublicDashboardDTO; data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
}, },
TContext TContext
> => { > => {
@@ -274,7 +275,7 @@ export const getCreatePublicDashboardMutationOptions = <
Awaited<ReturnType<typeof createPublicDashboard>>, Awaited<ReturnType<typeof createPublicDashboard>>,
{ {
pathParams: CreatePublicDashboardPathParameters; pathParams: CreatePublicDashboardPathParameters;
data: DashboardtypesPostablePublicDashboardDTO; data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
} }
> = (props) => { > = (props) => {
const { pathParams, data } = props ?? {}; const { pathParams, data } = props ?? {};
@@ -288,14 +289,14 @@ export const getCreatePublicDashboardMutationOptions = <
export type CreatePublicDashboardMutationResult = NonNullable< export type CreatePublicDashboardMutationResult = NonNullable<
Awaited<ReturnType<typeof createPublicDashboard>> Awaited<ReturnType<typeof createPublicDashboard>>
>; >;
export type CreatePublicDashboardMutationBody = DashboardtypesPostablePublicDashboardDTO; export type CreatePublicDashboardMutationBody = BodyType<DashboardtypesPostablePublicDashboardDTO>;
export type CreatePublicDashboardMutationError = RenderErrorResponseDTO; export type CreatePublicDashboardMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Create public dashboard * @summary Create public dashboard
*/ */
export const useCreatePublicDashboard = < export const useCreatePublicDashboard = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -303,7 +304,7 @@ export const useCreatePublicDashboard = <
TError, TError,
{ {
pathParams: CreatePublicDashboardPathParameters; pathParams: CreatePublicDashboardPathParameters;
data: DashboardtypesPostablePublicDashboardDTO; data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
}, },
TContext TContext
>; >;
@@ -312,7 +313,7 @@ export const useCreatePublicDashboard = <
TError, TError,
{ {
pathParams: CreatePublicDashboardPathParameters; pathParams: CreatePublicDashboardPathParameters;
data: DashboardtypesPostablePublicDashboardDTO; data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
}, },
TContext TContext
> => { > => {
@@ -326,7 +327,7 @@ export const useCreatePublicDashboard = <
*/ */
export const updatePublicDashboard = ( export const updatePublicDashboard = (
{ id }: UpdatePublicDashboardPathParameters, { id }: UpdatePublicDashboardPathParameters,
dashboardtypesUpdatablePublicDashboardDTO: DashboardtypesUpdatablePublicDashboardDTO, dashboardtypesUpdatablePublicDashboardDTO: BodyType<DashboardtypesUpdatablePublicDashboardDTO>,
) => { ) => {
return GeneratedAPIInstance<string>({ return GeneratedAPIInstance<string>({
url: `/api/v1/dashboards/${id}/public`, url: `/api/v1/dashboards/${id}/public`,
@@ -337,7 +338,7 @@ export const updatePublicDashboard = (
}; };
export const getUpdatePublicDashboardMutationOptions = < export const getUpdatePublicDashboardMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -345,7 +346,7 @@ export const getUpdatePublicDashboardMutationOptions = <
TError, TError,
{ {
pathParams: UpdatePublicDashboardPathParameters; pathParams: UpdatePublicDashboardPathParameters;
data: DashboardtypesUpdatablePublicDashboardDTO; data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
}, },
TContext TContext
>; >;
@@ -354,7 +355,7 @@ export const getUpdatePublicDashboardMutationOptions = <
TError, TError,
{ {
pathParams: UpdatePublicDashboardPathParameters; pathParams: UpdatePublicDashboardPathParameters;
data: DashboardtypesUpdatablePublicDashboardDTO; data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
}, },
TContext TContext
> => { > => {
@@ -371,7 +372,7 @@ export const getUpdatePublicDashboardMutationOptions = <
Awaited<ReturnType<typeof updatePublicDashboard>>, Awaited<ReturnType<typeof updatePublicDashboard>>,
{ {
pathParams: UpdatePublicDashboardPathParameters; pathParams: UpdatePublicDashboardPathParameters;
data: DashboardtypesUpdatablePublicDashboardDTO; data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
} }
> = (props) => { > = (props) => {
const { pathParams, data } = props ?? {}; const { pathParams, data } = props ?? {};
@@ -385,14 +386,14 @@ export const getUpdatePublicDashboardMutationOptions = <
export type UpdatePublicDashboardMutationResult = NonNullable< export type UpdatePublicDashboardMutationResult = NonNullable<
Awaited<ReturnType<typeof updatePublicDashboard>> Awaited<ReturnType<typeof updatePublicDashboard>>
>; >;
export type UpdatePublicDashboardMutationBody = DashboardtypesUpdatablePublicDashboardDTO; export type UpdatePublicDashboardMutationBody = BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
export type UpdatePublicDashboardMutationError = RenderErrorResponseDTO; export type UpdatePublicDashboardMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Update public dashboard * @summary Update public dashboard
*/ */
export const useUpdatePublicDashboard = < export const useUpdatePublicDashboard = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -400,7 +401,7 @@ export const useUpdatePublicDashboard = <
TError, TError,
{ {
pathParams: UpdatePublicDashboardPathParameters; pathParams: UpdatePublicDashboardPathParameters;
data: DashboardtypesUpdatablePublicDashboardDTO; data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
}, },
TContext TContext
>; >;
@@ -409,7 +410,7 @@ export const useUpdatePublicDashboard = <
TError, TError,
{ {
pathParams: UpdatePublicDashboardPathParameters; pathParams: UpdatePublicDashboardPathParameters;
data: DashboardtypesUpdatablePublicDashboardDTO; data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
}, },
TContext TContext
> => { > => {
@@ -435,12 +436,12 @@ export const getPublicDashboardData = (
export const getGetPublicDashboardDataQueryKey = ({ export const getGetPublicDashboardDataQueryKey = ({
id, id,
}: GetPublicDashboardDataPathParameters) => { }: GetPublicDashboardDataPathParameters) => {
return ['getPublicDashboardData'] as const; return [`/api/v1/public/dashboards/${id}`] as const;
}; };
export const getGetPublicDashboardDataQueryOptions = < export const getGetPublicDashboardDataQueryOptions = <
TData = Awaited<ReturnType<typeof getPublicDashboardData>>, TData = Awaited<ReturnType<typeof getPublicDashboardData>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ id }: GetPublicDashboardDataPathParameters, { id }: GetPublicDashboardDataPathParameters,
options?: { options?: {
@@ -475,7 +476,7 @@ export const getGetPublicDashboardDataQueryOptions = <
export type GetPublicDashboardDataQueryResult = NonNullable< export type GetPublicDashboardDataQueryResult = NonNullable<
Awaited<ReturnType<typeof getPublicDashboardData>> Awaited<ReturnType<typeof getPublicDashboardData>>
>; >;
export type GetPublicDashboardDataQueryError = RenderErrorResponseDTO; export type GetPublicDashboardDataQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get public dashboard data * @summary Get public dashboard data
@@ -483,7 +484,7 @@ export type GetPublicDashboardDataQueryError = RenderErrorResponseDTO;
export function useGetPublicDashboardData< export function useGetPublicDashboardData<
TData = Awaited<ReturnType<typeof getPublicDashboardData>>, TData = Awaited<ReturnType<typeof getPublicDashboardData>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ id }: GetPublicDashboardDataPathParameters, { id }: GetPublicDashboardDataPathParameters,
options?: { options?: {
@@ -540,12 +541,12 @@ export const getGetPublicDashboardWidgetQueryRangeQueryKey = ({
id, id,
idx, idx,
}: GetPublicDashboardWidgetQueryRangePathParameters) => { }: GetPublicDashboardWidgetQueryRangePathParameters) => {
return ['getPublicDashboardWidgetQueryRange'] as const; return [`/api/v1/public/dashboards/${id}/widgets/${idx}/query_range`] as const;
}; };
export const getGetPublicDashboardWidgetQueryRangeQueryOptions = < export const getGetPublicDashboardWidgetQueryRangeQueryOptions = <
TData = Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>, TData = Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ id, idx }: GetPublicDashboardWidgetQueryRangePathParameters, { id, idx }: GetPublicDashboardWidgetQueryRangePathParameters,
options?: { options?: {
@@ -581,7 +582,7 @@ export const getGetPublicDashboardWidgetQueryRangeQueryOptions = <
export type GetPublicDashboardWidgetQueryRangeQueryResult = NonNullable< export type GetPublicDashboardWidgetQueryRangeQueryResult = NonNullable<
Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>> Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>
>; >;
export type GetPublicDashboardWidgetQueryRangeQueryError = RenderErrorResponseDTO; export type GetPublicDashboardWidgetQueryRangeQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get query range result * @summary Get query range result
@@ -589,7 +590,7 @@ export type GetPublicDashboardWidgetQueryRangeQueryError = RenderErrorResponseDT
export function useGetPublicDashboardWidgetQueryRange< export function useGetPublicDashboardWidgetQueryRange<
TData = Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>, TData = Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ id, idx }: GetPublicDashboardWidgetQueryRangePathParameters, { id, idx }: GetPublicDashboardWidgetQueryRangePathParameters,
options?: { options?: {

View File

@@ -14,7 +14,8 @@ import type {
} from 'react-query'; } from 'react-query';
import { useQuery } from 'react-query'; import { useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { GetFeatures200, RenderErrorResponseDTO } from '../sigNoz.schemas'; import type { GetFeatures200, RenderErrorResponseDTO } from '../sigNoz.schemas';
type AwaitedInput<T> = PromiseLike<T> | T; type AwaitedInput<T> = PromiseLike<T> | T;
@@ -34,12 +35,12 @@ export const getFeatures = (signal?: AbortSignal) => {
}; };
export const getGetFeaturesQueryKey = () => { export const getGetFeaturesQueryKey = () => {
return ['getFeatures'] as const; return [`/api/v2/features`] as const;
}; };
export const getGetFeaturesQueryOptions = < export const getGetFeaturesQueryOptions = <
TData = Awaited<ReturnType<typeof getFeatures>>, TData = Awaited<ReturnType<typeof getFeatures>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof getFeatures>>, Awaited<ReturnType<typeof getFeatures>>,
@@ -65,7 +66,7 @@ export const getGetFeaturesQueryOptions = <
export type GetFeaturesQueryResult = NonNullable< export type GetFeaturesQueryResult = NonNullable<
Awaited<ReturnType<typeof getFeatures>> Awaited<ReturnType<typeof getFeatures>>
>; >;
export type GetFeaturesQueryError = RenderErrorResponseDTO; export type GetFeaturesQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get features * @summary Get features
@@ -73,7 +74,7 @@ export type GetFeaturesQueryError = RenderErrorResponseDTO;
export function useGetFeatures< export function useGetFeatures<
TData = Awaited<ReturnType<typeof getFeatures>>, TData = Awaited<ReturnType<typeof getFeatures>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof getFeatures>>, Awaited<ReturnType<typeof getFeatures>>,

View File

@@ -14,7 +14,8 @@ import type {
} from 'react-query'; } from 'react-query';
import { useQuery } from 'react-query'; import { useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
GetFieldsKeys200, GetFieldsKeys200,
GetFieldsKeysParams, GetFieldsKeysParams,
@@ -44,12 +45,12 @@ export const getFieldsKeys = (
}; };
export const getGetFieldsKeysQueryKey = (params?: GetFieldsKeysParams) => { export const getGetFieldsKeysQueryKey = (params?: GetFieldsKeysParams) => {
return ['getFieldsKeys', ...(params ? [params] : [])] as const; return [`/api/v1/fields/keys`, ...(params ? [params] : [])] as const;
}; };
export const getGetFieldsKeysQueryOptions = < export const getGetFieldsKeysQueryOptions = <
TData = Awaited<ReturnType<typeof getFieldsKeys>>, TData = Awaited<ReturnType<typeof getFieldsKeys>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
params?: GetFieldsKeysParams, params?: GetFieldsKeysParams,
options?: { options?: {
@@ -78,7 +79,7 @@ export const getGetFieldsKeysQueryOptions = <
export type GetFieldsKeysQueryResult = NonNullable< export type GetFieldsKeysQueryResult = NonNullable<
Awaited<ReturnType<typeof getFieldsKeys>> Awaited<ReturnType<typeof getFieldsKeys>>
>; >;
export type GetFieldsKeysQueryError = RenderErrorResponseDTO; export type GetFieldsKeysQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get field keys * @summary Get field keys
@@ -86,7 +87,7 @@ export type GetFieldsKeysQueryError = RenderErrorResponseDTO;
export function useGetFieldsKeys< export function useGetFieldsKeys<
TData = Awaited<ReturnType<typeof getFieldsKeys>>, TData = Awaited<ReturnType<typeof getFieldsKeys>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
params?: GetFieldsKeysParams, params?: GetFieldsKeysParams,
options?: { options?: {
@@ -141,12 +142,12 @@ export const getFieldsValues = (
}; };
export const getGetFieldsValuesQueryKey = (params?: GetFieldsValuesParams) => { export const getGetFieldsValuesQueryKey = (params?: GetFieldsValuesParams) => {
return ['getFieldsValues', ...(params ? [params] : [])] as const; return [`/api/v1/fields/values`, ...(params ? [params] : [])] as const;
}; };
export const getGetFieldsValuesQueryOptions = < export const getGetFieldsValuesQueryOptions = <
TData = Awaited<ReturnType<typeof getFieldsValues>>, TData = Awaited<ReturnType<typeof getFieldsValues>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
params?: GetFieldsValuesParams, params?: GetFieldsValuesParams,
options?: { options?: {
@@ -175,7 +176,7 @@ export const getGetFieldsValuesQueryOptions = <
export type GetFieldsValuesQueryResult = NonNullable< export type GetFieldsValuesQueryResult = NonNullable<
Awaited<ReturnType<typeof getFieldsValues>> Awaited<ReturnType<typeof getFieldsValues>>
>; >;
export type GetFieldsValuesQueryError = RenderErrorResponseDTO; export type GetFieldsValuesQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get field values * @summary Get field values
@@ -183,7 +184,7 @@ export type GetFieldsValuesQueryError = RenderErrorResponseDTO;
export function useGetFieldsValues< export function useGetFieldsValues<
TData = Awaited<ReturnType<typeof getFieldsValues>>, TData = Awaited<ReturnType<typeof getFieldsValues>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
params?: GetFieldsValuesParams, params?: GetFieldsValuesParams,
options?: { options?: {

View File

@@ -17,9 +17,10 @@ import type {
} from 'react-query'; } from 'react-query';
import { useMutation, useQuery } from 'react-query'; import { useMutation, useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
CreateIngestionKey200, CreateIngestionKey201,
CreateIngestionKeyLimit201, CreateIngestionKeyLimit201,
CreateIngestionKeyLimitPathParameters, CreateIngestionKeyLimitPathParameters,
DeleteIngestionKeyLimitPathParameters, DeleteIngestionKeyLimitPathParameters,
@@ -59,12 +60,15 @@ export const getIngestionKeys = (
export const getGetIngestionKeysQueryKey = ( export const getGetIngestionKeysQueryKey = (
params?: GetIngestionKeysParams, params?: GetIngestionKeysParams,
) => { ) => {
return ['getIngestionKeys', ...(params ? [params] : [])] as const; return [
`/api/v2/gateway/ingestion_keys`,
...(params ? [params] : []),
] as const;
}; };
export const getGetIngestionKeysQueryOptions = < export const getGetIngestionKeysQueryOptions = <
TData = Awaited<ReturnType<typeof getIngestionKeys>>, TData = Awaited<ReturnType<typeof getIngestionKeys>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
params?: GetIngestionKeysParams, params?: GetIngestionKeysParams,
options?: { options?: {
@@ -93,7 +97,7 @@ export const getGetIngestionKeysQueryOptions = <
export type GetIngestionKeysQueryResult = NonNullable< export type GetIngestionKeysQueryResult = NonNullable<
Awaited<ReturnType<typeof getIngestionKeys>> Awaited<ReturnType<typeof getIngestionKeys>>
>; >;
export type GetIngestionKeysQueryError = RenderErrorResponseDTO; export type GetIngestionKeysQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get ingestion keys for workspace * @summary Get ingestion keys for workspace
@@ -101,7 +105,7 @@ export type GetIngestionKeysQueryError = RenderErrorResponseDTO;
export function useGetIngestionKeys< export function useGetIngestionKeys<
TData = Awaited<ReturnType<typeof getIngestionKeys>>, TData = Awaited<ReturnType<typeof getIngestionKeys>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
params?: GetIngestionKeysParams, params?: GetIngestionKeysParams,
options?: { options?: {
@@ -144,10 +148,10 @@ export const invalidateGetIngestionKeys = async (
* @summary Create ingestion key for workspace * @summary Create ingestion key for workspace
*/ */
export const createIngestionKey = ( export const createIngestionKey = (
gatewaytypesPostableIngestionKeyDTO: GatewaytypesPostableIngestionKeyDTO, gatewaytypesPostableIngestionKeyDTO: BodyType<GatewaytypesPostableIngestionKeyDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<CreateIngestionKey200>({ return GeneratedAPIInstance<CreateIngestionKey201>({
url: `/api/v2/gateway/ingestion_keys`, url: `/api/v2/gateway/ingestion_keys`,
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
@@ -157,19 +161,19 @@ export const createIngestionKey = (
}; };
export const getCreateIngestionKeyMutationOptions = < export const getCreateIngestionKeyMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createIngestionKey>>, Awaited<ReturnType<typeof createIngestionKey>>,
TError, TError,
{ data: GatewaytypesPostableIngestionKeyDTO }, { data: BodyType<GatewaytypesPostableIngestionKeyDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof createIngestionKey>>, Awaited<ReturnType<typeof createIngestionKey>>,
TError, TError,
{ data: GatewaytypesPostableIngestionKeyDTO }, { data: BodyType<GatewaytypesPostableIngestionKeyDTO> },
TContext TContext
> => { > => {
const mutationKey = ['createIngestionKey']; const mutationKey = ['createIngestionKey'];
@@ -183,7 +187,7 @@ export const getCreateIngestionKeyMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof createIngestionKey>>, Awaited<ReturnType<typeof createIngestionKey>>,
{ data: GatewaytypesPostableIngestionKeyDTO } { data: BodyType<GatewaytypesPostableIngestionKeyDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -196,26 +200,26 @@ export const getCreateIngestionKeyMutationOptions = <
export type CreateIngestionKeyMutationResult = NonNullable< export type CreateIngestionKeyMutationResult = NonNullable<
Awaited<ReturnType<typeof createIngestionKey>> Awaited<ReturnType<typeof createIngestionKey>>
>; >;
export type CreateIngestionKeyMutationBody = GatewaytypesPostableIngestionKeyDTO; export type CreateIngestionKeyMutationBody = BodyType<GatewaytypesPostableIngestionKeyDTO>;
export type CreateIngestionKeyMutationError = RenderErrorResponseDTO; export type CreateIngestionKeyMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Create ingestion key for workspace * @summary Create ingestion key for workspace
*/ */
export const useCreateIngestionKey = < export const useCreateIngestionKey = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createIngestionKey>>, Awaited<ReturnType<typeof createIngestionKey>>,
TError, TError,
{ data: GatewaytypesPostableIngestionKeyDTO }, { data: BodyType<GatewaytypesPostableIngestionKeyDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof createIngestionKey>>, Awaited<ReturnType<typeof createIngestionKey>>,
TError, TError,
{ data: GatewaytypesPostableIngestionKeyDTO }, { data: BodyType<GatewaytypesPostableIngestionKeyDTO> },
TContext TContext
> => { > => {
const mutationOptions = getCreateIngestionKeyMutationOptions(options); const mutationOptions = getCreateIngestionKeyMutationOptions(options);
@@ -236,7 +240,7 @@ export const deleteIngestionKey = ({
}; };
export const getDeleteIngestionKeyMutationOptions = < export const getDeleteIngestionKeyMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -276,13 +280,13 @@ export type DeleteIngestionKeyMutationResult = NonNullable<
Awaited<ReturnType<typeof deleteIngestionKey>> Awaited<ReturnType<typeof deleteIngestionKey>>
>; >;
export type DeleteIngestionKeyMutationError = RenderErrorResponseDTO; export type DeleteIngestionKeyMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Delete ingestion key for workspace * @summary Delete ingestion key for workspace
*/ */
export const useDeleteIngestionKey = < export const useDeleteIngestionKey = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -307,7 +311,7 @@ export const useDeleteIngestionKey = <
*/ */
export const updateIngestionKey = ( export const updateIngestionKey = (
{ keyId }: UpdateIngestionKeyPathParameters, { keyId }: UpdateIngestionKeyPathParameters,
gatewaytypesPostableIngestionKeyDTO: GatewaytypesPostableIngestionKeyDTO, gatewaytypesPostableIngestionKeyDTO: BodyType<GatewaytypesPostableIngestionKeyDTO>,
) => { ) => {
return GeneratedAPIInstance<void>({ return GeneratedAPIInstance<void>({
url: `/api/v2/gateway/ingestion_keys/${keyId}`, url: `/api/v2/gateway/ingestion_keys/${keyId}`,
@@ -318,7 +322,7 @@ export const updateIngestionKey = (
}; };
export const getUpdateIngestionKeyMutationOptions = < export const getUpdateIngestionKeyMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -326,7 +330,7 @@ export const getUpdateIngestionKeyMutationOptions = <
TError, TError,
{ {
pathParams: UpdateIngestionKeyPathParameters; pathParams: UpdateIngestionKeyPathParameters;
data: GatewaytypesPostableIngestionKeyDTO; data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
}, },
TContext TContext
>; >;
@@ -335,7 +339,7 @@ export const getUpdateIngestionKeyMutationOptions = <
TError, TError,
{ {
pathParams: UpdateIngestionKeyPathParameters; pathParams: UpdateIngestionKeyPathParameters;
data: GatewaytypesPostableIngestionKeyDTO; data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
}, },
TContext TContext
> => { > => {
@@ -352,7 +356,7 @@ export const getUpdateIngestionKeyMutationOptions = <
Awaited<ReturnType<typeof updateIngestionKey>>, Awaited<ReturnType<typeof updateIngestionKey>>,
{ {
pathParams: UpdateIngestionKeyPathParameters; pathParams: UpdateIngestionKeyPathParameters;
data: GatewaytypesPostableIngestionKeyDTO; data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
} }
> = (props) => { > = (props) => {
const { pathParams, data } = props ?? {}; const { pathParams, data } = props ?? {};
@@ -366,14 +370,14 @@ export const getUpdateIngestionKeyMutationOptions = <
export type UpdateIngestionKeyMutationResult = NonNullable< export type UpdateIngestionKeyMutationResult = NonNullable<
Awaited<ReturnType<typeof updateIngestionKey>> Awaited<ReturnType<typeof updateIngestionKey>>
>; >;
export type UpdateIngestionKeyMutationBody = GatewaytypesPostableIngestionKeyDTO; export type UpdateIngestionKeyMutationBody = BodyType<GatewaytypesPostableIngestionKeyDTO>;
export type UpdateIngestionKeyMutationError = RenderErrorResponseDTO; export type UpdateIngestionKeyMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Update ingestion key for workspace * @summary Update ingestion key for workspace
*/ */
export const useUpdateIngestionKey = < export const useUpdateIngestionKey = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -381,7 +385,7 @@ export const useUpdateIngestionKey = <
TError, TError,
{ {
pathParams: UpdateIngestionKeyPathParameters; pathParams: UpdateIngestionKeyPathParameters;
data: GatewaytypesPostableIngestionKeyDTO; data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
}, },
TContext TContext
>; >;
@@ -390,7 +394,7 @@ export const useUpdateIngestionKey = <
TError, TError,
{ {
pathParams: UpdateIngestionKeyPathParameters; pathParams: UpdateIngestionKeyPathParameters;
data: GatewaytypesPostableIngestionKeyDTO; data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
}, },
TContext TContext
> => { > => {
@@ -404,7 +408,7 @@ export const useUpdateIngestionKey = <
*/ */
export const createIngestionKeyLimit = ( export const createIngestionKeyLimit = (
{ keyId }: CreateIngestionKeyLimitPathParameters, { keyId }: CreateIngestionKeyLimitPathParameters,
gatewaytypesPostableIngestionKeyLimitDTO: GatewaytypesPostableIngestionKeyLimitDTO, gatewaytypesPostableIngestionKeyLimitDTO: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<CreateIngestionKeyLimit201>({ return GeneratedAPIInstance<CreateIngestionKeyLimit201>({
@@ -417,7 +421,7 @@ export const createIngestionKeyLimit = (
}; };
export const getCreateIngestionKeyLimitMutationOptions = < export const getCreateIngestionKeyLimitMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -425,7 +429,7 @@ export const getCreateIngestionKeyLimitMutationOptions = <
TError, TError,
{ {
pathParams: CreateIngestionKeyLimitPathParameters; pathParams: CreateIngestionKeyLimitPathParameters;
data: GatewaytypesPostableIngestionKeyLimitDTO; data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
}, },
TContext TContext
>; >;
@@ -434,7 +438,7 @@ export const getCreateIngestionKeyLimitMutationOptions = <
TError, TError,
{ {
pathParams: CreateIngestionKeyLimitPathParameters; pathParams: CreateIngestionKeyLimitPathParameters;
data: GatewaytypesPostableIngestionKeyLimitDTO; data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
}, },
TContext TContext
> => { > => {
@@ -451,7 +455,7 @@ export const getCreateIngestionKeyLimitMutationOptions = <
Awaited<ReturnType<typeof createIngestionKeyLimit>>, Awaited<ReturnType<typeof createIngestionKeyLimit>>,
{ {
pathParams: CreateIngestionKeyLimitPathParameters; pathParams: CreateIngestionKeyLimitPathParameters;
data: GatewaytypesPostableIngestionKeyLimitDTO; data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
} }
> = (props) => { > = (props) => {
const { pathParams, data } = props ?? {}; const { pathParams, data } = props ?? {};
@@ -465,14 +469,14 @@ export const getCreateIngestionKeyLimitMutationOptions = <
export type CreateIngestionKeyLimitMutationResult = NonNullable< export type CreateIngestionKeyLimitMutationResult = NonNullable<
Awaited<ReturnType<typeof createIngestionKeyLimit>> Awaited<ReturnType<typeof createIngestionKeyLimit>>
>; >;
export type CreateIngestionKeyLimitMutationBody = GatewaytypesPostableIngestionKeyLimitDTO; export type CreateIngestionKeyLimitMutationBody = BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
export type CreateIngestionKeyLimitMutationError = RenderErrorResponseDTO; export type CreateIngestionKeyLimitMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Create limit for the ingestion key * @summary Create limit for the ingestion key
*/ */
export const useCreateIngestionKeyLimit = < export const useCreateIngestionKeyLimit = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -480,7 +484,7 @@ export const useCreateIngestionKeyLimit = <
TError, TError,
{ {
pathParams: CreateIngestionKeyLimitPathParameters; pathParams: CreateIngestionKeyLimitPathParameters;
data: GatewaytypesPostableIngestionKeyLimitDTO; data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
}, },
TContext TContext
>; >;
@@ -489,7 +493,7 @@ export const useCreateIngestionKeyLimit = <
TError, TError,
{ {
pathParams: CreateIngestionKeyLimitPathParameters; pathParams: CreateIngestionKeyLimitPathParameters;
data: GatewaytypesPostableIngestionKeyLimitDTO; data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
}, },
TContext TContext
> => { > => {
@@ -511,7 +515,7 @@ export const deleteIngestionKeyLimit = ({
}; };
export const getDeleteIngestionKeyLimitMutationOptions = < export const getDeleteIngestionKeyLimitMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -551,13 +555,13 @@ export type DeleteIngestionKeyLimitMutationResult = NonNullable<
Awaited<ReturnType<typeof deleteIngestionKeyLimit>> Awaited<ReturnType<typeof deleteIngestionKeyLimit>>
>; >;
export type DeleteIngestionKeyLimitMutationError = RenderErrorResponseDTO; export type DeleteIngestionKeyLimitMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Delete limit for the ingestion key * @summary Delete limit for the ingestion key
*/ */
export const useDeleteIngestionKeyLimit = < export const useDeleteIngestionKeyLimit = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -582,7 +586,7 @@ export const useDeleteIngestionKeyLimit = <
*/ */
export const updateIngestionKeyLimit = ( export const updateIngestionKeyLimit = (
{ limitId }: UpdateIngestionKeyLimitPathParameters, { limitId }: UpdateIngestionKeyLimitPathParameters,
gatewaytypesUpdatableIngestionKeyLimitDTO: GatewaytypesUpdatableIngestionKeyLimitDTO, gatewaytypesUpdatableIngestionKeyLimitDTO: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>,
) => { ) => {
return GeneratedAPIInstance<void>({ return GeneratedAPIInstance<void>({
url: `/api/v2/gateway/ingestion_keys/limits/${limitId}`, url: `/api/v2/gateway/ingestion_keys/limits/${limitId}`,
@@ -593,7 +597,7 @@ export const updateIngestionKeyLimit = (
}; };
export const getUpdateIngestionKeyLimitMutationOptions = < export const getUpdateIngestionKeyLimitMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -601,7 +605,7 @@ export const getUpdateIngestionKeyLimitMutationOptions = <
TError, TError,
{ {
pathParams: UpdateIngestionKeyLimitPathParameters; pathParams: UpdateIngestionKeyLimitPathParameters;
data: GatewaytypesUpdatableIngestionKeyLimitDTO; data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
}, },
TContext TContext
>; >;
@@ -610,7 +614,7 @@ export const getUpdateIngestionKeyLimitMutationOptions = <
TError, TError,
{ {
pathParams: UpdateIngestionKeyLimitPathParameters; pathParams: UpdateIngestionKeyLimitPathParameters;
data: GatewaytypesUpdatableIngestionKeyLimitDTO; data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
}, },
TContext TContext
> => { > => {
@@ -627,7 +631,7 @@ export const getUpdateIngestionKeyLimitMutationOptions = <
Awaited<ReturnType<typeof updateIngestionKeyLimit>>, Awaited<ReturnType<typeof updateIngestionKeyLimit>>,
{ {
pathParams: UpdateIngestionKeyLimitPathParameters; pathParams: UpdateIngestionKeyLimitPathParameters;
data: GatewaytypesUpdatableIngestionKeyLimitDTO; data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
} }
> = (props) => { > = (props) => {
const { pathParams, data } = props ?? {}; const { pathParams, data } = props ?? {};
@@ -641,14 +645,14 @@ export const getUpdateIngestionKeyLimitMutationOptions = <
export type UpdateIngestionKeyLimitMutationResult = NonNullable< export type UpdateIngestionKeyLimitMutationResult = NonNullable<
Awaited<ReturnType<typeof updateIngestionKeyLimit>> Awaited<ReturnType<typeof updateIngestionKeyLimit>>
>; >;
export type UpdateIngestionKeyLimitMutationBody = GatewaytypesUpdatableIngestionKeyLimitDTO; export type UpdateIngestionKeyLimitMutationBody = BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
export type UpdateIngestionKeyLimitMutationError = RenderErrorResponseDTO; export type UpdateIngestionKeyLimitMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Update limit for the ingestion key * @summary Update limit for the ingestion key
*/ */
export const useUpdateIngestionKeyLimit = < export const useUpdateIngestionKeyLimit = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -656,7 +660,7 @@ export const useUpdateIngestionKeyLimit = <
TError, TError,
{ {
pathParams: UpdateIngestionKeyLimitPathParameters; pathParams: UpdateIngestionKeyLimitPathParameters;
data: GatewaytypesUpdatableIngestionKeyLimitDTO; data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
}, },
TContext TContext
>; >;
@@ -665,7 +669,7 @@ export const useUpdateIngestionKeyLimit = <
TError, TError,
{ {
pathParams: UpdateIngestionKeyLimitPathParameters; pathParams: UpdateIngestionKeyLimitPathParameters;
data: GatewaytypesUpdatableIngestionKeyLimitDTO; data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
}, },
TContext TContext
> => { > => {
@@ -692,12 +696,15 @@ export const searchIngestionKeys = (
export const getSearchIngestionKeysQueryKey = ( export const getSearchIngestionKeysQueryKey = (
params?: SearchIngestionKeysParams, params?: SearchIngestionKeysParams,
) => { ) => {
return ['searchIngestionKeys', ...(params ? [params] : [])] as const; return [
`/api/v2/gateway/ingestion_keys/search`,
...(params ? [params] : []),
] as const;
}; };
export const getSearchIngestionKeysQueryOptions = < export const getSearchIngestionKeysQueryOptions = <
TData = Awaited<ReturnType<typeof searchIngestionKeys>>, TData = Awaited<ReturnType<typeof searchIngestionKeys>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
params: SearchIngestionKeysParams, params: SearchIngestionKeysParams,
options?: { options?: {
@@ -727,7 +734,7 @@ export const getSearchIngestionKeysQueryOptions = <
export type SearchIngestionKeysQueryResult = NonNullable< export type SearchIngestionKeysQueryResult = NonNullable<
Awaited<ReturnType<typeof searchIngestionKeys>> Awaited<ReturnType<typeof searchIngestionKeys>>
>; >;
export type SearchIngestionKeysQueryError = RenderErrorResponseDTO; export type SearchIngestionKeysQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Search ingestion keys for workspace * @summary Search ingestion keys for workspace
@@ -735,7 +742,7 @@ export type SearchIngestionKeysQueryError = RenderErrorResponseDTO;
export function useSearchIngestionKeys< export function useSearchIngestionKeys<
TData = Awaited<ReturnType<typeof searchIngestionKeys>>, TData = Awaited<ReturnType<typeof searchIngestionKeys>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
params: SearchIngestionKeysParams, params: SearchIngestionKeysParams,
options?: { options?: {

View File

@@ -14,7 +14,8 @@ import type {
} from 'react-query'; } from 'react-query';
import { useQuery } from 'react-query'; import { useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
GetGlobalConfig200, GetGlobalConfig200,
RenderErrorResponseDTO, RenderErrorResponseDTO,
@@ -37,12 +38,12 @@ export const getGlobalConfig = (signal?: AbortSignal) => {
}; };
export const getGetGlobalConfigQueryKey = () => { export const getGetGlobalConfigQueryKey = () => {
return ['getGlobalConfig'] as const; return [`/api/v1/global/config`] as const;
}; };
export const getGetGlobalConfigQueryOptions = < export const getGetGlobalConfigQueryOptions = <
TData = Awaited<ReturnType<typeof getGlobalConfig>>, TData = Awaited<ReturnType<typeof getGlobalConfig>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof getGlobalConfig>>, Awaited<ReturnType<typeof getGlobalConfig>>,
@@ -68,7 +69,7 @@ export const getGetGlobalConfigQueryOptions = <
export type GetGlobalConfigQueryResult = NonNullable< export type GetGlobalConfigQueryResult = NonNullable<
Awaited<ReturnType<typeof getGlobalConfig>> Awaited<ReturnType<typeof getGlobalConfig>>
>; >;
export type GetGlobalConfigQueryError = RenderErrorResponseDTO; export type GetGlobalConfigQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get global config * @summary Get global config
@@ -76,7 +77,7 @@ export type GetGlobalConfigQueryError = RenderErrorResponseDTO;
export function useGetGlobalConfig< export function useGetGlobalConfig<
TData = Awaited<ReturnType<typeof getGlobalConfig>>, TData = Awaited<ReturnType<typeof getGlobalConfig>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof getGlobalConfig>>, Awaited<ReturnType<typeof getGlobalConfig>>,

View File

@@ -17,7 +17,8 @@ import type {
} from 'react-query'; } from 'react-query';
import { useMutation, useQuery } from 'react-query'; import { useMutation, useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
ListPromotedAndIndexedPaths200, ListPromotedAndIndexedPaths200,
PromotetypesPromotePathDTO, PromotetypesPromotePathDTO,
@@ -41,12 +42,12 @@ export const listPromotedAndIndexedPaths = (signal?: AbortSignal) => {
}; };
export const getListPromotedAndIndexedPathsQueryKey = () => { export const getListPromotedAndIndexedPathsQueryKey = () => {
return ['listPromotedAndIndexedPaths'] as const; return [`/api/v1/logs/promote_paths`] as const;
}; };
export const getListPromotedAndIndexedPathsQueryOptions = < export const getListPromotedAndIndexedPathsQueryOptions = <
TData = Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>, TData = Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>, Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
@@ -73,7 +74,7 @@ export const getListPromotedAndIndexedPathsQueryOptions = <
export type ListPromotedAndIndexedPathsQueryResult = NonNullable< export type ListPromotedAndIndexedPathsQueryResult = NonNullable<
Awaited<ReturnType<typeof listPromotedAndIndexedPaths>> Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>
>; >;
export type ListPromotedAndIndexedPathsQueryError = RenderErrorResponseDTO; export type ListPromotedAndIndexedPathsQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Promote and index paths * @summary Promote and index paths
@@ -81,7 +82,7 @@ export type ListPromotedAndIndexedPathsQueryError = RenderErrorResponseDTO;
export function useListPromotedAndIndexedPaths< export function useListPromotedAndIndexedPaths<
TData = Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>, TData = Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>, Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
@@ -120,7 +121,9 @@ export const invalidateListPromotedAndIndexedPaths = async (
* @summary Promote and index paths * @summary Promote and index paths
*/ */
export const handlePromoteAndIndexPaths = ( export const handlePromoteAndIndexPaths = (
promotetypesPromotePathDTONull: PromotetypesPromotePathDTO[] | null, promotetypesPromotePathDTONull: BodyType<
PromotetypesPromotePathDTO[] | null
> | null,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<void>({ return GeneratedAPIInstance<void>({
@@ -133,19 +136,19 @@ export const handlePromoteAndIndexPaths = (
}; };
export const getHandlePromoteAndIndexPathsMutationOptions = < export const getHandlePromoteAndIndexPathsMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>, Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
TError, TError,
{ data: PromotetypesPromotePathDTO[] | null }, { data: BodyType<PromotetypesPromotePathDTO[] | null> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>, Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
TError, TError,
{ data: PromotetypesPromotePathDTO[] | null }, { data: BodyType<PromotetypesPromotePathDTO[] | null> },
TContext TContext
> => { > => {
const mutationKey = ['handlePromoteAndIndexPaths']; const mutationKey = ['handlePromoteAndIndexPaths'];
@@ -159,7 +162,7 @@ export const getHandlePromoteAndIndexPathsMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>, Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
{ data: PromotetypesPromotePathDTO[] | null } { data: BodyType<PromotetypesPromotePathDTO[] | null> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -172,28 +175,28 @@ export const getHandlePromoteAndIndexPathsMutationOptions = <
export type HandlePromoteAndIndexPathsMutationResult = NonNullable< export type HandlePromoteAndIndexPathsMutationResult = NonNullable<
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>> Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>
>; >;
export type HandlePromoteAndIndexPathsMutationBody = export type HandlePromoteAndIndexPathsMutationBody = BodyType<
| PromotetypesPromotePathDTO[] PromotetypesPromotePathDTO[] | null
| null; >;
export type HandlePromoteAndIndexPathsMutationError = RenderErrorResponseDTO; export type HandlePromoteAndIndexPathsMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Promote and index paths * @summary Promote and index paths
*/ */
export const useHandlePromoteAndIndexPaths = < export const useHandlePromoteAndIndexPaths = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>, Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
TError, TError,
{ data: PromotetypesPromotePathDTO[] | null }, { data: BodyType<PromotetypesPromotePathDTO[] | null> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>, Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
TError, TError,
{ data: PromotetypesPromotePathDTO[] | null }, { data: BodyType<PromotetypesPromotePathDTO[] | null> },
TContext TContext
> => { > => {
const mutationOptions = getHandlePromoteAndIndexPathsMutationOptions(options); const mutationOptions = getHandlePromoteAndIndexPathsMutationOptions(options);

View File

@@ -17,7 +17,8 @@ import type {
} from 'react-query'; } from 'react-query';
import { useMutation, useQuery } from 'react-query'; import { useMutation, useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
GetMetricAlerts200, GetMetricAlerts200,
GetMetricAlertsPathParameters, GetMetricAlertsPathParameters,
@@ -62,12 +63,12 @@ export const listMetrics = (
}; };
export const getListMetricsQueryKey = (params?: ListMetricsParams) => { export const getListMetricsQueryKey = (params?: ListMetricsParams) => {
return ['listMetrics', ...(params ? [params] : [])] as const; return [`/api/v2/metrics`, ...(params ? [params] : [])] as const;
}; };
export const getListMetricsQueryOptions = < export const getListMetricsQueryOptions = <
TData = Awaited<ReturnType<typeof listMetrics>>, TData = Awaited<ReturnType<typeof listMetrics>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
params?: ListMetricsParams, params?: ListMetricsParams,
options?: { options?: {
@@ -96,7 +97,7 @@ export const getListMetricsQueryOptions = <
export type ListMetricsQueryResult = NonNullable< export type ListMetricsQueryResult = NonNullable<
Awaited<ReturnType<typeof listMetrics>> Awaited<ReturnType<typeof listMetrics>>
>; >;
export type ListMetricsQueryError = RenderErrorResponseDTO; export type ListMetricsQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary List metric names * @summary List metric names
@@ -104,7 +105,7 @@ export type ListMetricsQueryError = RenderErrorResponseDTO;
export function useListMetrics< export function useListMetrics<
TData = Awaited<ReturnType<typeof listMetrics>>, TData = Awaited<ReturnType<typeof listMetrics>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
params?: ListMetricsParams, params?: ListMetricsParams,
options?: { options?: {
@@ -160,12 +161,12 @@ export const getMetricAlerts = (
export const getGetMetricAlertsQueryKey = ({ export const getGetMetricAlertsQueryKey = ({
metricName, metricName,
}: GetMetricAlertsPathParameters) => { }: GetMetricAlertsPathParameters) => {
return ['getMetricAlerts'] as const; return [`/api/v2/metrics/${metricName}/alerts`] as const;
}; };
export const getGetMetricAlertsQueryOptions = < export const getGetMetricAlertsQueryOptions = <
TData = Awaited<ReturnType<typeof getMetricAlerts>>, TData = Awaited<ReturnType<typeof getMetricAlerts>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ metricName }: GetMetricAlertsPathParameters, { metricName }: GetMetricAlertsPathParameters,
options?: { options?: {
@@ -200,7 +201,7 @@ export const getGetMetricAlertsQueryOptions = <
export type GetMetricAlertsQueryResult = NonNullable< export type GetMetricAlertsQueryResult = NonNullable<
Awaited<ReturnType<typeof getMetricAlerts>> Awaited<ReturnType<typeof getMetricAlerts>>
>; >;
export type GetMetricAlertsQueryError = RenderErrorResponseDTO; export type GetMetricAlertsQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get metric alerts * @summary Get metric alerts
@@ -208,7 +209,7 @@ export type GetMetricAlertsQueryError = RenderErrorResponseDTO;
export function useGetMetricAlerts< export function useGetMetricAlerts<
TData = Awaited<ReturnType<typeof getMetricAlerts>>, TData = Awaited<ReturnType<typeof getMetricAlerts>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ metricName }: GetMetricAlertsPathParameters, { metricName }: GetMetricAlertsPathParameters,
options?: { options?: {
@@ -267,12 +268,15 @@ export const getGetMetricAttributesQueryKey = (
{ metricName }: GetMetricAttributesPathParameters, { metricName }: GetMetricAttributesPathParameters,
params?: GetMetricAttributesParams, params?: GetMetricAttributesParams,
) => { ) => {
return ['getMetricAttributes', ...(params ? [params] : [])] as const; return [
`/api/v2/metrics/${metricName}/attributes`,
...(params ? [params] : []),
] as const;
}; };
export const getGetMetricAttributesQueryOptions = < export const getGetMetricAttributesQueryOptions = <
TData = Awaited<ReturnType<typeof getMetricAttributes>>, TData = Awaited<ReturnType<typeof getMetricAttributes>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ metricName }: GetMetricAttributesPathParameters, { metricName }: GetMetricAttributesPathParameters,
params?: GetMetricAttributesParams, params?: GetMetricAttributesParams,
@@ -309,7 +313,7 @@ export const getGetMetricAttributesQueryOptions = <
export type GetMetricAttributesQueryResult = NonNullable< export type GetMetricAttributesQueryResult = NonNullable<
Awaited<ReturnType<typeof getMetricAttributes>> Awaited<ReturnType<typeof getMetricAttributes>>
>; >;
export type GetMetricAttributesQueryError = RenderErrorResponseDTO; export type GetMetricAttributesQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get metric attributes * @summary Get metric attributes
@@ -317,7 +321,7 @@ export type GetMetricAttributesQueryError = RenderErrorResponseDTO;
export function useGetMetricAttributes< export function useGetMetricAttributes<
TData = Awaited<ReturnType<typeof getMetricAttributes>>, TData = Awaited<ReturnType<typeof getMetricAttributes>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ metricName }: GetMetricAttributesPathParameters, { metricName }: GetMetricAttributesPathParameters,
params?: GetMetricAttributesParams, params?: GetMetricAttributesParams,
@@ -379,12 +383,12 @@ export const getMetricDashboards = (
export const getGetMetricDashboardsQueryKey = ({ export const getGetMetricDashboardsQueryKey = ({
metricName, metricName,
}: GetMetricDashboardsPathParameters) => { }: GetMetricDashboardsPathParameters) => {
return ['getMetricDashboards'] as const; return [`/api/v2/metrics/${metricName}/dashboards`] as const;
}; };
export const getGetMetricDashboardsQueryOptions = < export const getGetMetricDashboardsQueryOptions = <
TData = Awaited<ReturnType<typeof getMetricDashboards>>, TData = Awaited<ReturnType<typeof getMetricDashboards>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ metricName }: GetMetricDashboardsPathParameters, { metricName }: GetMetricDashboardsPathParameters,
options?: { options?: {
@@ -419,7 +423,7 @@ export const getGetMetricDashboardsQueryOptions = <
export type GetMetricDashboardsQueryResult = NonNullable< export type GetMetricDashboardsQueryResult = NonNullable<
Awaited<ReturnType<typeof getMetricDashboards>> Awaited<ReturnType<typeof getMetricDashboards>>
>; >;
export type GetMetricDashboardsQueryError = RenderErrorResponseDTO; export type GetMetricDashboardsQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get metric dashboards * @summary Get metric dashboards
@@ -427,7 +431,7 @@ export type GetMetricDashboardsQueryError = RenderErrorResponseDTO;
export function useGetMetricDashboards< export function useGetMetricDashboards<
TData = Awaited<ReturnType<typeof getMetricDashboards>>, TData = Awaited<ReturnType<typeof getMetricDashboards>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ metricName }: GetMetricDashboardsPathParameters, { metricName }: GetMetricDashboardsPathParameters,
options?: { options?: {
@@ -486,12 +490,12 @@ export const getMetricHighlights = (
export const getGetMetricHighlightsQueryKey = ({ export const getGetMetricHighlightsQueryKey = ({
metricName, metricName,
}: GetMetricHighlightsPathParameters) => { }: GetMetricHighlightsPathParameters) => {
return ['getMetricHighlights'] as const; return [`/api/v2/metrics/${metricName}/highlights`] as const;
}; };
export const getGetMetricHighlightsQueryOptions = < export const getGetMetricHighlightsQueryOptions = <
TData = Awaited<ReturnType<typeof getMetricHighlights>>, TData = Awaited<ReturnType<typeof getMetricHighlights>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ metricName }: GetMetricHighlightsPathParameters, { metricName }: GetMetricHighlightsPathParameters,
options?: { options?: {
@@ -526,7 +530,7 @@ export const getGetMetricHighlightsQueryOptions = <
export type GetMetricHighlightsQueryResult = NonNullable< export type GetMetricHighlightsQueryResult = NonNullable<
Awaited<ReturnType<typeof getMetricHighlights>> Awaited<ReturnType<typeof getMetricHighlights>>
>; >;
export type GetMetricHighlightsQueryError = RenderErrorResponseDTO; export type GetMetricHighlightsQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get metric highlights * @summary Get metric highlights
@@ -534,7 +538,7 @@ export type GetMetricHighlightsQueryError = RenderErrorResponseDTO;
export function useGetMetricHighlights< export function useGetMetricHighlights<
TData = Awaited<ReturnType<typeof getMetricHighlights>>, TData = Awaited<ReturnType<typeof getMetricHighlights>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ metricName }: GetMetricHighlightsPathParameters, { metricName }: GetMetricHighlightsPathParameters,
options?: { options?: {
@@ -593,12 +597,12 @@ export const getMetricMetadata = (
export const getGetMetricMetadataQueryKey = ({ export const getGetMetricMetadataQueryKey = ({
metricName, metricName,
}: GetMetricMetadataPathParameters) => { }: GetMetricMetadataPathParameters) => {
return ['getMetricMetadata'] as const; return [`/api/v2/metrics/${metricName}/metadata`] as const;
}; };
export const getGetMetricMetadataQueryOptions = < export const getGetMetricMetadataQueryOptions = <
TData = Awaited<ReturnType<typeof getMetricMetadata>>, TData = Awaited<ReturnType<typeof getMetricMetadata>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ metricName }: GetMetricMetadataPathParameters, { metricName }: GetMetricMetadataPathParameters,
options?: { options?: {
@@ -633,7 +637,7 @@ export const getGetMetricMetadataQueryOptions = <
export type GetMetricMetadataQueryResult = NonNullable< export type GetMetricMetadataQueryResult = NonNullable<
Awaited<ReturnType<typeof getMetricMetadata>> Awaited<ReturnType<typeof getMetricMetadata>>
>; >;
export type GetMetricMetadataQueryError = RenderErrorResponseDTO; export type GetMetricMetadataQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get metric metadata * @summary Get metric metadata
@@ -641,7 +645,7 @@ export type GetMetricMetadataQueryError = RenderErrorResponseDTO;
export function useGetMetricMetadata< export function useGetMetricMetadata<
TData = Awaited<ReturnType<typeof getMetricMetadata>>, TData = Awaited<ReturnType<typeof getMetricMetadata>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ metricName }: GetMetricMetadataPathParameters, { metricName }: GetMetricMetadataPathParameters,
options?: { options?: {
@@ -685,7 +689,7 @@ export const invalidateGetMetricMetadata = async (
*/ */
export const updateMetricMetadata = ( export const updateMetricMetadata = (
{ metricName }: UpdateMetricMetadataPathParameters, { metricName }: UpdateMetricMetadataPathParameters,
metricsexplorertypesUpdateMetricMetadataRequestDTO: MetricsexplorertypesUpdateMetricMetadataRequestDTO, metricsexplorertypesUpdateMetricMetadataRequestDTO: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<string>({ return GeneratedAPIInstance<string>({
@@ -698,7 +702,7 @@ export const updateMetricMetadata = (
}; };
export const getUpdateMetricMetadataMutationOptions = < export const getUpdateMetricMetadataMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -706,7 +710,7 @@ export const getUpdateMetricMetadataMutationOptions = <
TError, TError,
{ {
pathParams: UpdateMetricMetadataPathParameters; pathParams: UpdateMetricMetadataPathParameters;
data: MetricsexplorertypesUpdateMetricMetadataRequestDTO; data: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
}, },
TContext TContext
>; >;
@@ -715,7 +719,7 @@ export const getUpdateMetricMetadataMutationOptions = <
TError, TError,
{ {
pathParams: UpdateMetricMetadataPathParameters; pathParams: UpdateMetricMetadataPathParameters;
data: MetricsexplorertypesUpdateMetricMetadataRequestDTO; data: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
}, },
TContext TContext
> => { > => {
@@ -732,7 +736,7 @@ export const getUpdateMetricMetadataMutationOptions = <
Awaited<ReturnType<typeof updateMetricMetadata>>, Awaited<ReturnType<typeof updateMetricMetadata>>,
{ {
pathParams: UpdateMetricMetadataPathParameters; pathParams: UpdateMetricMetadataPathParameters;
data: MetricsexplorertypesUpdateMetricMetadataRequestDTO; data: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
} }
> = (props) => { > = (props) => {
const { pathParams, data } = props ?? {}; const { pathParams, data } = props ?? {};
@@ -746,14 +750,14 @@ export const getUpdateMetricMetadataMutationOptions = <
export type UpdateMetricMetadataMutationResult = NonNullable< export type UpdateMetricMetadataMutationResult = NonNullable<
Awaited<ReturnType<typeof updateMetricMetadata>> Awaited<ReturnType<typeof updateMetricMetadata>>
>; >;
export type UpdateMetricMetadataMutationBody = MetricsexplorertypesUpdateMetricMetadataRequestDTO; export type UpdateMetricMetadataMutationBody = BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
export type UpdateMetricMetadataMutationError = RenderErrorResponseDTO; export type UpdateMetricMetadataMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Update metric metadata * @summary Update metric metadata
*/ */
export const useUpdateMetricMetadata = < export const useUpdateMetricMetadata = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -761,7 +765,7 @@ export const useUpdateMetricMetadata = <
TError, TError,
{ {
pathParams: UpdateMetricMetadataPathParameters; pathParams: UpdateMetricMetadataPathParameters;
data: MetricsexplorertypesUpdateMetricMetadataRequestDTO; data: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
}, },
TContext TContext
>; >;
@@ -770,7 +774,7 @@ export const useUpdateMetricMetadata = <
TError, TError,
{ {
pathParams: UpdateMetricMetadataPathParameters; pathParams: UpdateMetricMetadataPathParameters;
data: MetricsexplorertypesUpdateMetricMetadataRequestDTO; data: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
}, },
TContext TContext
> => { > => {
@@ -783,7 +787,7 @@ export const useUpdateMetricMetadata = <
* @summary Get metrics statistics * @summary Get metrics statistics
*/ */
export const getMetricsStats = ( export const getMetricsStats = (
metricsexplorertypesStatsRequestDTO: MetricsexplorertypesStatsRequestDTO, metricsexplorertypesStatsRequestDTO: BodyType<MetricsexplorertypesStatsRequestDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<GetMetricsStats200>({ return GeneratedAPIInstance<GetMetricsStats200>({
@@ -796,19 +800,19 @@ export const getMetricsStats = (
}; };
export const getGetMetricsStatsMutationOptions = < export const getGetMetricsStatsMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof getMetricsStats>>, Awaited<ReturnType<typeof getMetricsStats>>,
TError, TError,
{ data: MetricsexplorertypesStatsRequestDTO }, { data: BodyType<MetricsexplorertypesStatsRequestDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof getMetricsStats>>, Awaited<ReturnType<typeof getMetricsStats>>,
TError, TError,
{ data: MetricsexplorertypesStatsRequestDTO }, { data: BodyType<MetricsexplorertypesStatsRequestDTO> },
TContext TContext
> => { > => {
const mutationKey = ['getMetricsStats']; const mutationKey = ['getMetricsStats'];
@@ -822,7 +826,7 @@ export const getGetMetricsStatsMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof getMetricsStats>>, Awaited<ReturnType<typeof getMetricsStats>>,
{ data: MetricsexplorertypesStatsRequestDTO } { data: BodyType<MetricsexplorertypesStatsRequestDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -835,26 +839,26 @@ export const getGetMetricsStatsMutationOptions = <
export type GetMetricsStatsMutationResult = NonNullable< export type GetMetricsStatsMutationResult = NonNullable<
Awaited<ReturnType<typeof getMetricsStats>> Awaited<ReturnType<typeof getMetricsStats>>
>; >;
export type GetMetricsStatsMutationBody = MetricsexplorertypesStatsRequestDTO; export type GetMetricsStatsMutationBody = BodyType<MetricsexplorertypesStatsRequestDTO>;
export type GetMetricsStatsMutationError = RenderErrorResponseDTO; export type GetMetricsStatsMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get metrics statistics * @summary Get metrics statistics
*/ */
export const useGetMetricsStats = < export const useGetMetricsStats = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof getMetricsStats>>, Awaited<ReturnType<typeof getMetricsStats>>,
TError, TError,
{ data: MetricsexplorertypesStatsRequestDTO }, { data: BodyType<MetricsexplorertypesStatsRequestDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof getMetricsStats>>, Awaited<ReturnType<typeof getMetricsStats>>,
TError, TError,
{ data: MetricsexplorertypesStatsRequestDTO }, { data: BodyType<MetricsexplorertypesStatsRequestDTO> },
TContext TContext
> => { > => {
const mutationOptions = getGetMetricsStatsMutationOptions(options); const mutationOptions = getGetMetricsStatsMutationOptions(options);
@@ -866,7 +870,7 @@ export const useGetMetricsStats = <
* @summary Get metrics treemap * @summary Get metrics treemap
*/ */
export const getMetricsTreemap = ( export const getMetricsTreemap = (
metricsexplorertypesTreemapRequestDTO: MetricsexplorertypesTreemapRequestDTO, metricsexplorertypesTreemapRequestDTO: BodyType<MetricsexplorertypesTreemapRequestDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<GetMetricsTreemap200>({ return GeneratedAPIInstance<GetMetricsTreemap200>({
@@ -879,19 +883,19 @@ export const getMetricsTreemap = (
}; };
export const getGetMetricsTreemapMutationOptions = < export const getGetMetricsTreemapMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof getMetricsTreemap>>, Awaited<ReturnType<typeof getMetricsTreemap>>,
TError, TError,
{ data: MetricsexplorertypesTreemapRequestDTO }, { data: BodyType<MetricsexplorertypesTreemapRequestDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof getMetricsTreemap>>, Awaited<ReturnType<typeof getMetricsTreemap>>,
TError, TError,
{ data: MetricsexplorertypesTreemapRequestDTO }, { data: BodyType<MetricsexplorertypesTreemapRequestDTO> },
TContext TContext
> => { > => {
const mutationKey = ['getMetricsTreemap']; const mutationKey = ['getMetricsTreemap'];
@@ -905,7 +909,7 @@ export const getGetMetricsTreemapMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof getMetricsTreemap>>, Awaited<ReturnType<typeof getMetricsTreemap>>,
{ data: MetricsexplorertypesTreemapRequestDTO } { data: BodyType<MetricsexplorertypesTreemapRequestDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -918,26 +922,26 @@ export const getGetMetricsTreemapMutationOptions = <
export type GetMetricsTreemapMutationResult = NonNullable< export type GetMetricsTreemapMutationResult = NonNullable<
Awaited<ReturnType<typeof getMetricsTreemap>> Awaited<ReturnType<typeof getMetricsTreemap>>
>; >;
export type GetMetricsTreemapMutationBody = MetricsexplorertypesTreemapRequestDTO; export type GetMetricsTreemapMutationBody = BodyType<MetricsexplorertypesTreemapRequestDTO>;
export type GetMetricsTreemapMutationError = RenderErrorResponseDTO; export type GetMetricsTreemapMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get metrics treemap * @summary Get metrics treemap
*/ */
export const useGetMetricsTreemap = < export const useGetMetricsTreemap = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof getMetricsTreemap>>, Awaited<ReturnType<typeof getMetricsTreemap>>,
TError, TError,
{ data: MetricsexplorertypesTreemapRequestDTO }, { data: BodyType<MetricsexplorertypesTreemapRequestDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof getMetricsTreemap>>, Awaited<ReturnType<typeof getMetricsTreemap>>,
TError, TError,
{ data: MetricsexplorertypesTreemapRequestDTO }, { data: BodyType<MetricsexplorertypesTreemapRequestDTO> },
TContext TContext
> => { > => {
const mutationOptions = getGetMetricsTreemapMutationOptions(options); const mutationOptions = getGetMetricsTreemapMutationOptions(options);

View File

@@ -17,7 +17,8 @@ import type {
} from 'react-query'; } from 'react-query';
import { useMutation, useQuery } from 'react-query'; import { useMutation, useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
GetMyOrganization200, GetMyOrganization200,
RenderErrorResponseDTO, RenderErrorResponseDTO,
@@ -41,12 +42,12 @@ export const getMyOrganization = (signal?: AbortSignal) => {
}; };
export const getGetMyOrganizationQueryKey = () => { export const getGetMyOrganizationQueryKey = () => {
return ['getMyOrganization'] as const; return [`/api/v2/orgs/me`] as const;
}; };
export const getGetMyOrganizationQueryOptions = < export const getGetMyOrganizationQueryOptions = <
TData = Awaited<ReturnType<typeof getMyOrganization>>, TData = Awaited<ReturnType<typeof getMyOrganization>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof getMyOrganization>>, Awaited<ReturnType<typeof getMyOrganization>>,
@@ -72,7 +73,7 @@ export const getGetMyOrganizationQueryOptions = <
export type GetMyOrganizationQueryResult = NonNullable< export type GetMyOrganizationQueryResult = NonNullable<
Awaited<ReturnType<typeof getMyOrganization>> Awaited<ReturnType<typeof getMyOrganization>>
>; >;
export type GetMyOrganizationQueryError = RenderErrorResponseDTO; export type GetMyOrganizationQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get my organization * @summary Get my organization
@@ -80,7 +81,7 @@ export type GetMyOrganizationQueryError = RenderErrorResponseDTO;
export function useGetMyOrganization< export function useGetMyOrganization<
TData = Awaited<ReturnType<typeof getMyOrganization>>, TData = Awaited<ReturnType<typeof getMyOrganization>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof getMyOrganization>>, Awaited<ReturnType<typeof getMyOrganization>>,
@@ -119,7 +120,7 @@ export const invalidateGetMyOrganization = async (
* @summary Update my organization * @summary Update my organization
*/ */
export const updateMyOrganization = ( export const updateMyOrganization = (
typesOrganizationDTO: TypesOrganizationDTO, typesOrganizationDTO: BodyType<TypesOrganizationDTO>,
) => { ) => {
return GeneratedAPIInstance<void>({ return GeneratedAPIInstance<void>({
url: `/api/v2/orgs/me`, url: `/api/v2/orgs/me`,
@@ -130,19 +131,19 @@ export const updateMyOrganization = (
}; };
export const getUpdateMyOrganizationMutationOptions = < export const getUpdateMyOrganizationMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof updateMyOrganization>>, Awaited<ReturnType<typeof updateMyOrganization>>,
TError, TError,
{ data: TypesOrganizationDTO }, { data: BodyType<TypesOrganizationDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof updateMyOrganization>>, Awaited<ReturnType<typeof updateMyOrganization>>,
TError, TError,
{ data: TypesOrganizationDTO }, { data: BodyType<TypesOrganizationDTO> },
TContext TContext
> => { > => {
const mutationKey = ['updateMyOrganization']; const mutationKey = ['updateMyOrganization'];
@@ -156,7 +157,7 @@ export const getUpdateMyOrganizationMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof updateMyOrganization>>, Awaited<ReturnType<typeof updateMyOrganization>>,
{ data: TypesOrganizationDTO } { data: BodyType<TypesOrganizationDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -169,26 +170,26 @@ export const getUpdateMyOrganizationMutationOptions = <
export type UpdateMyOrganizationMutationResult = NonNullable< export type UpdateMyOrganizationMutationResult = NonNullable<
Awaited<ReturnType<typeof updateMyOrganization>> Awaited<ReturnType<typeof updateMyOrganization>>
>; >;
export type UpdateMyOrganizationMutationBody = TypesOrganizationDTO; export type UpdateMyOrganizationMutationBody = BodyType<TypesOrganizationDTO>;
export type UpdateMyOrganizationMutationError = RenderErrorResponseDTO; export type UpdateMyOrganizationMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Update my organization * @summary Update my organization
*/ */
export const useUpdateMyOrganization = < export const useUpdateMyOrganization = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof updateMyOrganization>>, Awaited<ReturnType<typeof updateMyOrganization>>,
TError, TError,
{ data: TypesOrganizationDTO }, { data: BodyType<TypesOrganizationDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof updateMyOrganization>>, Awaited<ReturnType<typeof updateMyOrganization>>,
TError, TError,
{ data: TypesOrganizationDTO }, { data: BodyType<TypesOrganizationDTO> },
TContext TContext
> => { > => {
const mutationOptions = getUpdateMyOrganizationMutationOptions(options); const mutationOptions = getUpdateMyOrganizationMutationOptions(options);

View File

@@ -17,7 +17,8 @@ import type {
} from 'react-query'; } from 'react-query';
import { useMutation, useQuery } from 'react-query'; import { useMutation, useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
GetOrgPreference200, GetOrgPreference200,
GetOrgPreferencePathParameters, GetOrgPreferencePathParameters,
@@ -48,12 +49,12 @@ export const listOrgPreferences = (signal?: AbortSignal) => {
}; };
export const getListOrgPreferencesQueryKey = () => { export const getListOrgPreferencesQueryKey = () => {
return ['listOrgPreferences'] as const; return [`/api/v1/org/preferences`] as const;
}; };
export const getListOrgPreferencesQueryOptions = < export const getListOrgPreferencesQueryOptions = <
TData = Awaited<ReturnType<typeof listOrgPreferences>>, TData = Awaited<ReturnType<typeof listOrgPreferences>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof listOrgPreferences>>, Awaited<ReturnType<typeof listOrgPreferences>>,
@@ -79,7 +80,7 @@ export const getListOrgPreferencesQueryOptions = <
export type ListOrgPreferencesQueryResult = NonNullable< export type ListOrgPreferencesQueryResult = NonNullable<
Awaited<ReturnType<typeof listOrgPreferences>> Awaited<ReturnType<typeof listOrgPreferences>>
>; >;
export type ListOrgPreferencesQueryError = RenderErrorResponseDTO; export type ListOrgPreferencesQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary List org preferences * @summary List org preferences
@@ -87,7 +88,7 @@ export type ListOrgPreferencesQueryError = RenderErrorResponseDTO;
export function useListOrgPreferences< export function useListOrgPreferences<
TData = Awaited<ReturnType<typeof listOrgPreferences>>, TData = Awaited<ReturnType<typeof listOrgPreferences>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof listOrgPreferences>>, Awaited<ReturnType<typeof listOrgPreferences>>,
@@ -139,12 +140,12 @@ export const getOrgPreference = (
export const getGetOrgPreferenceQueryKey = ({ export const getGetOrgPreferenceQueryKey = ({
name, name,
}: GetOrgPreferencePathParameters) => { }: GetOrgPreferencePathParameters) => {
return ['getOrgPreference'] as const; return [`/api/v1/org/preferences/${name}`] as const;
}; };
export const getGetOrgPreferenceQueryOptions = < export const getGetOrgPreferenceQueryOptions = <
TData = Awaited<ReturnType<typeof getOrgPreference>>, TData = Awaited<ReturnType<typeof getOrgPreference>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ name }: GetOrgPreferencePathParameters, { name }: GetOrgPreferencePathParameters,
options?: { options?: {
@@ -179,7 +180,7 @@ export const getGetOrgPreferenceQueryOptions = <
export type GetOrgPreferenceQueryResult = NonNullable< export type GetOrgPreferenceQueryResult = NonNullable<
Awaited<ReturnType<typeof getOrgPreference>> Awaited<ReturnType<typeof getOrgPreference>>
>; >;
export type GetOrgPreferenceQueryError = RenderErrorResponseDTO; export type GetOrgPreferenceQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get org preference * @summary Get org preference
@@ -187,7 +188,7 @@ export type GetOrgPreferenceQueryError = RenderErrorResponseDTO;
export function useGetOrgPreference< export function useGetOrgPreference<
TData = Awaited<ReturnType<typeof getOrgPreference>>, TData = Awaited<ReturnType<typeof getOrgPreference>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ name }: GetOrgPreferencePathParameters, { name }: GetOrgPreferencePathParameters,
options?: { options?: {
@@ -231,7 +232,7 @@ export const invalidateGetOrgPreference = async (
*/ */
export const updateOrgPreference = ( export const updateOrgPreference = (
{ name }: UpdateOrgPreferencePathParameters, { name }: UpdateOrgPreferencePathParameters,
preferencetypesUpdatablePreferenceDTO: PreferencetypesUpdatablePreferenceDTO, preferencetypesUpdatablePreferenceDTO: BodyType<PreferencetypesUpdatablePreferenceDTO>,
) => { ) => {
return GeneratedAPIInstance<void>({ return GeneratedAPIInstance<void>({
url: `/api/v1/org/preferences/${name}`, url: `/api/v1/org/preferences/${name}`,
@@ -242,7 +243,7 @@ export const updateOrgPreference = (
}; };
export const getUpdateOrgPreferenceMutationOptions = < export const getUpdateOrgPreferenceMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -250,7 +251,7 @@ export const getUpdateOrgPreferenceMutationOptions = <
TError, TError,
{ {
pathParams: UpdateOrgPreferencePathParameters; pathParams: UpdateOrgPreferencePathParameters;
data: PreferencetypesUpdatablePreferenceDTO; data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
}, },
TContext TContext
>; >;
@@ -259,7 +260,7 @@ export const getUpdateOrgPreferenceMutationOptions = <
TError, TError,
{ {
pathParams: UpdateOrgPreferencePathParameters; pathParams: UpdateOrgPreferencePathParameters;
data: PreferencetypesUpdatablePreferenceDTO; data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
}, },
TContext TContext
> => { > => {
@@ -276,7 +277,7 @@ export const getUpdateOrgPreferenceMutationOptions = <
Awaited<ReturnType<typeof updateOrgPreference>>, Awaited<ReturnType<typeof updateOrgPreference>>,
{ {
pathParams: UpdateOrgPreferencePathParameters; pathParams: UpdateOrgPreferencePathParameters;
data: PreferencetypesUpdatablePreferenceDTO; data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
} }
> = (props) => { > = (props) => {
const { pathParams, data } = props ?? {}; const { pathParams, data } = props ?? {};
@@ -290,14 +291,14 @@ export const getUpdateOrgPreferenceMutationOptions = <
export type UpdateOrgPreferenceMutationResult = NonNullable< export type UpdateOrgPreferenceMutationResult = NonNullable<
Awaited<ReturnType<typeof updateOrgPreference>> Awaited<ReturnType<typeof updateOrgPreference>>
>; >;
export type UpdateOrgPreferenceMutationBody = PreferencetypesUpdatablePreferenceDTO; export type UpdateOrgPreferenceMutationBody = BodyType<PreferencetypesUpdatablePreferenceDTO>;
export type UpdateOrgPreferenceMutationError = RenderErrorResponseDTO; export type UpdateOrgPreferenceMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Update org preference * @summary Update org preference
*/ */
export const useUpdateOrgPreference = < export const useUpdateOrgPreference = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -305,7 +306,7 @@ export const useUpdateOrgPreference = <
TError, TError,
{ {
pathParams: UpdateOrgPreferencePathParameters; pathParams: UpdateOrgPreferencePathParameters;
data: PreferencetypesUpdatablePreferenceDTO; data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
}, },
TContext TContext
>; >;
@@ -314,7 +315,7 @@ export const useUpdateOrgPreference = <
TError, TError,
{ {
pathParams: UpdateOrgPreferencePathParameters; pathParams: UpdateOrgPreferencePathParameters;
data: PreferencetypesUpdatablePreferenceDTO; data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
}, },
TContext TContext
> => { > => {
@@ -335,12 +336,12 @@ export const listUserPreferences = (signal?: AbortSignal) => {
}; };
export const getListUserPreferencesQueryKey = () => { export const getListUserPreferencesQueryKey = () => {
return ['listUserPreferences'] as const; return [`/api/v1/user/preferences`] as const;
}; };
export const getListUserPreferencesQueryOptions = < export const getListUserPreferencesQueryOptions = <
TData = Awaited<ReturnType<typeof listUserPreferences>>, TData = Awaited<ReturnType<typeof listUserPreferences>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof listUserPreferences>>, Awaited<ReturnType<typeof listUserPreferences>>,
@@ -366,7 +367,7 @@ export const getListUserPreferencesQueryOptions = <
export type ListUserPreferencesQueryResult = NonNullable< export type ListUserPreferencesQueryResult = NonNullable<
Awaited<ReturnType<typeof listUserPreferences>> Awaited<ReturnType<typeof listUserPreferences>>
>; >;
export type ListUserPreferencesQueryError = RenderErrorResponseDTO; export type ListUserPreferencesQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary List user preferences * @summary List user preferences
@@ -374,7 +375,7 @@ export type ListUserPreferencesQueryError = RenderErrorResponseDTO;
export function useListUserPreferences< export function useListUserPreferences<
TData = Awaited<ReturnType<typeof listUserPreferences>>, TData = Awaited<ReturnType<typeof listUserPreferences>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof listUserPreferences>>, Awaited<ReturnType<typeof listUserPreferences>>,
@@ -426,12 +427,12 @@ export const getUserPreference = (
export const getGetUserPreferenceQueryKey = ({ export const getGetUserPreferenceQueryKey = ({
name, name,
}: GetUserPreferencePathParameters) => { }: GetUserPreferencePathParameters) => {
return ['getUserPreference'] as const; return [`/api/v1/user/preferences/${name}`] as const;
}; };
export const getGetUserPreferenceQueryOptions = < export const getGetUserPreferenceQueryOptions = <
TData = Awaited<ReturnType<typeof getUserPreference>>, TData = Awaited<ReturnType<typeof getUserPreference>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ name }: GetUserPreferencePathParameters, { name }: GetUserPreferencePathParameters,
options?: { options?: {
@@ -466,7 +467,7 @@ export const getGetUserPreferenceQueryOptions = <
export type GetUserPreferenceQueryResult = NonNullable< export type GetUserPreferenceQueryResult = NonNullable<
Awaited<ReturnType<typeof getUserPreference>> Awaited<ReturnType<typeof getUserPreference>>
>; >;
export type GetUserPreferenceQueryError = RenderErrorResponseDTO; export type GetUserPreferenceQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get user preference * @summary Get user preference
@@ -474,7 +475,7 @@ export type GetUserPreferenceQueryError = RenderErrorResponseDTO;
export function useGetUserPreference< export function useGetUserPreference<
TData = Awaited<ReturnType<typeof getUserPreference>>, TData = Awaited<ReturnType<typeof getUserPreference>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ name }: GetUserPreferencePathParameters, { name }: GetUserPreferencePathParameters,
options?: { options?: {
@@ -518,7 +519,7 @@ export const invalidateGetUserPreference = async (
*/ */
export const updateUserPreference = ( export const updateUserPreference = (
{ name }: UpdateUserPreferencePathParameters, { name }: UpdateUserPreferencePathParameters,
preferencetypesUpdatablePreferenceDTO: PreferencetypesUpdatablePreferenceDTO, preferencetypesUpdatablePreferenceDTO: BodyType<PreferencetypesUpdatablePreferenceDTO>,
) => { ) => {
return GeneratedAPIInstance<void>({ return GeneratedAPIInstance<void>({
url: `/api/v1/user/preferences/${name}`, url: `/api/v1/user/preferences/${name}`,
@@ -529,7 +530,7 @@ export const updateUserPreference = (
}; };
export const getUpdateUserPreferenceMutationOptions = < export const getUpdateUserPreferenceMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -537,7 +538,7 @@ export const getUpdateUserPreferenceMutationOptions = <
TError, TError,
{ {
pathParams: UpdateUserPreferencePathParameters; pathParams: UpdateUserPreferencePathParameters;
data: PreferencetypesUpdatablePreferenceDTO; data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
}, },
TContext TContext
>; >;
@@ -546,7 +547,7 @@ export const getUpdateUserPreferenceMutationOptions = <
TError, TError,
{ {
pathParams: UpdateUserPreferencePathParameters; pathParams: UpdateUserPreferencePathParameters;
data: PreferencetypesUpdatablePreferenceDTO; data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
}, },
TContext TContext
> => { > => {
@@ -563,7 +564,7 @@ export const getUpdateUserPreferenceMutationOptions = <
Awaited<ReturnType<typeof updateUserPreference>>, Awaited<ReturnType<typeof updateUserPreference>>,
{ {
pathParams: UpdateUserPreferencePathParameters; pathParams: UpdateUserPreferencePathParameters;
data: PreferencetypesUpdatablePreferenceDTO; data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
} }
> = (props) => { > = (props) => {
const { pathParams, data } = props ?? {}; const { pathParams, data } = props ?? {};
@@ -577,14 +578,14 @@ export const getUpdateUserPreferenceMutationOptions = <
export type UpdateUserPreferenceMutationResult = NonNullable< export type UpdateUserPreferenceMutationResult = NonNullable<
Awaited<ReturnType<typeof updateUserPreference>> Awaited<ReturnType<typeof updateUserPreference>>
>; >;
export type UpdateUserPreferenceMutationBody = PreferencetypesUpdatablePreferenceDTO; export type UpdateUserPreferenceMutationBody = BodyType<PreferencetypesUpdatablePreferenceDTO>;
export type UpdateUserPreferenceMutationError = RenderErrorResponseDTO; export type UpdateUserPreferenceMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Update user preference * @summary Update user preference
*/ */
export const useUpdateUserPreference = < export const useUpdateUserPreference = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -592,7 +593,7 @@ export const useUpdateUserPreference = <
TError, TError,
{ {
pathParams: UpdateUserPreferencePathParameters; pathParams: UpdateUserPreferencePathParameters;
data: PreferencetypesUpdatablePreferenceDTO; data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
}, },
TContext TContext
>; >;
@@ -601,7 +602,7 @@ export const useUpdateUserPreference = <
TError, TError,
{ {
pathParams: UpdateUserPreferencePathParameters; pathParams: UpdateUserPreferencePathParameters;
data: PreferencetypesUpdatablePreferenceDTO; data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
}, },
TContext TContext
> => { > => {

View File

@@ -11,7 +11,8 @@ import type {
} from 'react-query'; } from 'react-query';
import { useMutation } from 'react-query'; import { useMutation } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
Querybuildertypesv5QueryRangeRequestDTO, Querybuildertypesv5QueryRangeRequestDTO,
QueryRangeV5200, QueryRangeV5200,
@@ -28,7 +29,7 @@ type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
* @summary Query range * @summary Query range
*/ */
export const queryRangeV5 = ( export const queryRangeV5 = (
querybuildertypesv5QueryRangeRequestDTO: Querybuildertypesv5QueryRangeRequestDTO, querybuildertypesv5QueryRangeRequestDTO: BodyType<Querybuildertypesv5QueryRangeRequestDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<QueryRangeV5200>({ return GeneratedAPIInstance<QueryRangeV5200>({
@@ -41,19 +42,19 @@ export const queryRangeV5 = (
}; };
export const getQueryRangeV5MutationOptions = < export const getQueryRangeV5MutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof queryRangeV5>>, Awaited<ReturnType<typeof queryRangeV5>>,
TError, TError,
{ data: Querybuildertypesv5QueryRangeRequestDTO }, { data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof queryRangeV5>>, Awaited<ReturnType<typeof queryRangeV5>>,
TError, TError,
{ data: Querybuildertypesv5QueryRangeRequestDTO }, { data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
TContext TContext
> => { > => {
const mutationKey = ['queryRangeV5']; const mutationKey = ['queryRangeV5'];
@@ -67,7 +68,7 @@ export const getQueryRangeV5MutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof queryRangeV5>>, Awaited<ReturnType<typeof queryRangeV5>>,
{ data: Querybuildertypesv5QueryRangeRequestDTO } { data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -80,26 +81,26 @@ export const getQueryRangeV5MutationOptions = <
export type QueryRangeV5MutationResult = NonNullable< export type QueryRangeV5MutationResult = NonNullable<
Awaited<ReturnType<typeof queryRangeV5>> Awaited<ReturnType<typeof queryRangeV5>>
>; >;
export type QueryRangeV5MutationBody = Querybuildertypesv5QueryRangeRequestDTO; export type QueryRangeV5MutationBody = BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
export type QueryRangeV5MutationError = RenderErrorResponseDTO; export type QueryRangeV5MutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Query range * @summary Query range
*/ */
export const useQueryRangeV5 = < export const useQueryRangeV5 = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof queryRangeV5>>, Awaited<ReturnType<typeof queryRangeV5>>,
TError, TError,
{ data: Querybuildertypesv5QueryRangeRequestDTO }, { data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof queryRangeV5>>, Awaited<ReturnType<typeof queryRangeV5>>,
TError, TError,
{ data: Querybuildertypesv5QueryRangeRequestDTO }, { data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
TContext TContext
> => { > => {
const mutationOptions = getQueryRangeV5MutationOptions(options); const mutationOptions = getQueryRangeV5MutationOptions(options);
@@ -111,7 +112,7 @@ export const useQueryRangeV5 = <
* @summary Replace variables * @summary Replace variables
*/ */
export const replaceVariables = ( export const replaceVariables = (
querybuildertypesv5QueryRangeRequestDTO: Querybuildertypesv5QueryRangeRequestDTO, querybuildertypesv5QueryRangeRequestDTO: BodyType<Querybuildertypesv5QueryRangeRequestDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<ReplaceVariables200>({ return GeneratedAPIInstance<ReplaceVariables200>({
@@ -124,19 +125,19 @@ export const replaceVariables = (
}; };
export const getReplaceVariablesMutationOptions = < export const getReplaceVariablesMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof replaceVariables>>, Awaited<ReturnType<typeof replaceVariables>>,
TError, TError,
{ data: Querybuildertypesv5QueryRangeRequestDTO }, { data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof replaceVariables>>, Awaited<ReturnType<typeof replaceVariables>>,
TError, TError,
{ data: Querybuildertypesv5QueryRangeRequestDTO }, { data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
TContext TContext
> => { > => {
const mutationKey = ['replaceVariables']; const mutationKey = ['replaceVariables'];
@@ -150,7 +151,7 @@ export const getReplaceVariablesMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof replaceVariables>>, Awaited<ReturnType<typeof replaceVariables>>,
{ data: Querybuildertypesv5QueryRangeRequestDTO } { data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -163,26 +164,26 @@ export const getReplaceVariablesMutationOptions = <
export type ReplaceVariablesMutationResult = NonNullable< export type ReplaceVariablesMutationResult = NonNullable<
Awaited<ReturnType<typeof replaceVariables>> Awaited<ReturnType<typeof replaceVariables>>
>; >;
export type ReplaceVariablesMutationBody = Querybuildertypesv5QueryRangeRequestDTO; export type ReplaceVariablesMutationBody = BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
export type ReplaceVariablesMutationError = RenderErrorResponseDTO; export type ReplaceVariablesMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Replace variables * @summary Replace variables
*/ */
export const useReplaceVariables = < export const useReplaceVariables = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof replaceVariables>>, Awaited<ReturnType<typeof replaceVariables>>,
TError, TError,
{ data: Querybuildertypesv5QueryRangeRequestDTO }, { data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof replaceVariables>>, Awaited<ReturnType<typeof replaceVariables>>,
TError, TError,
{ data: Querybuildertypesv5QueryRangeRequestDTO }, { data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
TContext TContext
> => { > => {
const mutationOptions = getReplaceVariablesMutationOptions(options); const mutationOptions = getReplaceVariablesMutationOptions(options);

View File

@@ -17,20 +17,20 @@ import type {
} from 'react-query'; } from 'react-query';
import { useMutation, useQuery } from 'react-query'; import { useMutation, useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
AuthtypesPatchableObjectsDTO,
CreateRole201, CreateRole201,
DeleteRolePathParameters, DeleteRolePathParameters,
GetObjects200, GetObjects200,
GetObjectsPathParameters, GetObjectsPathParameters,
GetResources200,
GetRole200, GetRole200,
GetRolePathParameters, GetRolePathParameters,
ListRoles200, ListRoles200,
PatchObjectsPathParameters, PatchObjectsPathParameters,
PatchRolePathParameters, PatchRolePathParameters,
RenderErrorResponseDTO, RenderErrorResponseDTO,
RoletypesPatchableObjectsDTO,
RoletypesPatchableRoleDTO, RoletypesPatchableRoleDTO,
RoletypesPostableRoleDTO, RoletypesPostableRoleDTO,
} from '../sigNoz.schemas'; } from '../sigNoz.schemas';
@@ -52,12 +52,12 @@ export const listRoles = (signal?: AbortSignal) => {
}; };
export const getListRolesQueryKey = () => { export const getListRolesQueryKey = () => {
return ['listRoles'] as const; return [`/api/v1/roles`] as const;
}; };
export const getListRolesQueryOptions = < export const getListRolesQueryOptions = <
TData = Awaited<ReturnType<typeof listRoles>>, TData = Awaited<ReturnType<typeof listRoles>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions<Awaited<ReturnType<typeof listRoles>>, TError, TData>; query?: UseQueryOptions<Awaited<ReturnType<typeof listRoles>>, TError, TData>;
}) => { }) => {
@@ -79,7 +79,7 @@ export const getListRolesQueryOptions = <
export type ListRolesQueryResult = NonNullable< export type ListRolesQueryResult = NonNullable<
Awaited<ReturnType<typeof listRoles>> Awaited<ReturnType<typeof listRoles>>
>; >;
export type ListRolesQueryError = RenderErrorResponseDTO; export type ListRolesQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary List roles * @summary List roles
@@ -87,7 +87,7 @@ export type ListRolesQueryError = RenderErrorResponseDTO;
export function useListRoles< export function useListRoles<
TData = Awaited<ReturnType<typeof listRoles>>, TData = Awaited<ReturnType<typeof listRoles>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions<Awaited<ReturnType<typeof listRoles>>, TError, TData>; query?: UseQueryOptions<Awaited<ReturnType<typeof listRoles>>, TError, TData>;
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } { }): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
@@ -122,7 +122,7 @@ export const invalidateListRoles = async (
* @summary Create role * @summary Create role
*/ */
export const createRole = ( export const createRole = (
roletypesPostableRoleDTO: RoletypesPostableRoleDTO, roletypesPostableRoleDTO: BodyType<RoletypesPostableRoleDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<CreateRole201>({ return GeneratedAPIInstance<CreateRole201>({
@@ -135,19 +135,19 @@ export const createRole = (
}; };
export const getCreateRoleMutationOptions = < export const getCreateRoleMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createRole>>, Awaited<ReturnType<typeof createRole>>,
TError, TError,
{ data: RoletypesPostableRoleDTO }, { data: BodyType<RoletypesPostableRoleDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof createRole>>, Awaited<ReturnType<typeof createRole>>,
TError, TError,
{ data: RoletypesPostableRoleDTO }, { data: BodyType<RoletypesPostableRoleDTO> },
TContext TContext
> => { > => {
const mutationKey = ['createRole']; const mutationKey = ['createRole'];
@@ -161,7 +161,7 @@ export const getCreateRoleMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof createRole>>, Awaited<ReturnType<typeof createRole>>,
{ data: RoletypesPostableRoleDTO } { data: BodyType<RoletypesPostableRoleDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -174,26 +174,26 @@ export const getCreateRoleMutationOptions = <
export type CreateRoleMutationResult = NonNullable< export type CreateRoleMutationResult = NonNullable<
Awaited<ReturnType<typeof createRole>> Awaited<ReturnType<typeof createRole>>
>; >;
export type CreateRoleMutationBody = RoletypesPostableRoleDTO; export type CreateRoleMutationBody = BodyType<RoletypesPostableRoleDTO>;
export type CreateRoleMutationError = RenderErrorResponseDTO; export type CreateRoleMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Create role * @summary Create role
*/ */
export const useCreateRole = < export const useCreateRole = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createRole>>, Awaited<ReturnType<typeof createRole>>,
TError, TError,
{ data: RoletypesPostableRoleDTO }, { data: BodyType<RoletypesPostableRoleDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof createRole>>, Awaited<ReturnType<typeof createRole>>,
TError, TError,
{ data: RoletypesPostableRoleDTO }, { data: BodyType<RoletypesPostableRoleDTO> },
TContext TContext
> => { > => {
const mutationOptions = getCreateRoleMutationOptions(options); const mutationOptions = getCreateRoleMutationOptions(options);
@@ -212,7 +212,7 @@ export const deleteRole = ({ id }: DeleteRolePathParameters) => {
}; };
export const getDeleteRoleMutationOptions = < export const getDeleteRoleMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -252,13 +252,13 @@ export type DeleteRoleMutationResult = NonNullable<
Awaited<ReturnType<typeof deleteRole>> Awaited<ReturnType<typeof deleteRole>>
>; >;
export type DeleteRoleMutationError = RenderErrorResponseDTO; export type DeleteRoleMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Delete role * @summary Delete role
*/ */
export const useDeleteRole = < export const useDeleteRole = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -293,12 +293,12 @@ export const getRole = (
}; };
export const getGetRoleQueryKey = ({ id }: GetRolePathParameters) => { export const getGetRoleQueryKey = ({ id }: GetRolePathParameters) => {
return ['getRole'] as const; return [`/api/v1/roles/${id}`] as const;
}; };
export const getGetRoleQueryOptions = < export const getGetRoleQueryOptions = <
TData = Awaited<ReturnType<typeof getRole>>, TData = Awaited<ReturnType<typeof getRole>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ id }: GetRolePathParameters, { id }: GetRolePathParameters,
options?: { options?: {
@@ -326,7 +326,7 @@ export const getGetRoleQueryOptions = <
export type GetRoleQueryResult = NonNullable< export type GetRoleQueryResult = NonNullable<
Awaited<ReturnType<typeof getRole>> Awaited<ReturnType<typeof getRole>>
>; >;
export type GetRoleQueryError = RenderErrorResponseDTO; export type GetRoleQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get role * @summary Get role
@@ -334,7 +334,7 @@ export type GetRoleQueryError = RenderErrorResponseDTO;
export function useGetRole< export function useGetRole<
TData = Awaited<ReturnType<typeof getRole>>, TData = Awaited<ReturnType<typeof getRole>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ id }: GetRolePathParameters, { id }: GetRolePathParameters,
options?: { options?: {
@@ -374,7 +374,7 @@ export const invalidateGetRole = async (
*/ */
export const patchRole = ( export const patchRole = (
{ id }: PatchRolePathParameters, { id }: PatchRolePathParameters,
roletypesPatchableRoleDTO: RoletypesPatchableRoleDTO, roletypesPatchableRoleDTO: BodyType<RoletypesPatchableRoleDTO>,
) => { ) => {
return GeneratedAPIInstance<string>({ return GeneratedAPIInstance<string>({
url: `/api/v1/roles/${id}`, url: `/api/v1/roles/${id}`,
@@ -385,19 +385,25 @@ export const patchRole = (
}; };
export const getPatchRoleMutationOptions = < export const getPatchRoleMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof patchRole>>, Awaited<ReturnType<typeof patchRole>>,
TError, TError,
{ pathParams: PatchRolePathParameters; data: RoletypesPatchableRoleDTO }, {
pathParams: PatchRolePathParameters;
data: BodyType<RoletypesPatchableRoleDTO>;
},
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof patchRole>>, Awaited<ReturnType<typeof patchRole>>,
TError, TError,
{ pathParams: PatchRolePathParameters; data: RoletypesPatchableRoleDTO }, {
pathParams: PatchRolePathParameters;
data: BodyType<RoletypesPatchableRoleDTO>;
},
TContext TContext
> => { > => {
const mutationKey = ['patchRole']; const mutationKey = ['patchRole'];
@@ -411,7 +417,10 @@ export const getPatchRoleMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof patchRole>>, Awaited<ReturnType<typeof patchRole>>,
{ pathParams: PatchRolePathParameters; data: RoletypesPatchableRoleDTO } {
pathParams: PatchRolePathParameters;
data: BodyType<RoletypesPatchableRoleDTO>;
}
> = (props) => { > = (props) => {
const { pathParams, data } = props ?? {}; const { pathParams, data } = props ?? {};
@@ -424,26 +433,32 @@ export const getPatchRoleMutationOptions = <
export type PatchRoleMutationResult = NonNullable< export type PatchRoleMutationResult = NonNullable<
Awaited<ReturnType<typeof patchRole>> Awaited<ReturnType<typeof patchRole>>
>; >;
export type PatchRoleMutationBody = RoletypesPatchableRoleDTO; export type PatchRoleMutationBody = BodyType<RoletypesPatchableRoleDTO>;
export type PatchRoleMutationError = RenderErrorResponseDTO; export type PatchRoleMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Patch role * @summary Patch role
*/ */
export const usePatchRole = < export const usePatchRole = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof patchRole>>, Awaited<ReturnType<typeof patchRole>>,
TError, TError,
{ pathParams: PatchRolePathParameters; data: RoletypesPatchableRoleDTO }, {
pathParams: PatchRolePathParameters;
data: BodyType<RoletypesPatchableRoleDTO>;
},
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof patchRole>>, Awaited<ReturnType<typeof patchRole>>,
TError, TError,
{ pathParams: PatchRolePathParameters; data: RoletypesPatchableRoleDTO }, {
pathParams: PatchRolePathParameters;
data: BodyType<RoletypesPatchableRoleDTO>;
},
TContext TContext
> => { > => {
const mutationOptions = getPatchRoleMutationOptions(options); const mutationOptions = getPatchRoleMutationOptions(options);
@@ -469,12 +484,12 @@ export const getGetObjectsQueryKey = ({
id, id,
relation, relation,
}: GetObjectsPathParameters) => { }: GetObjectsPathParameters) => {
return ['getObjects'] as const; return [`/api/v1/roles/${id}/relation/${relation}/objects`] as const;
}; };
export const getGetObjectsQueryOptions = < export const getGetObjectsQueryOptions = <
TData = Awaited<ReturnType<typeof getObjects>>, TData = Awaited<ReturnType<typeof getObjects>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ id, relation }: GetObjectsPathParameters, { id, relation }: GetObjectsPathParameters,
options?: { options?: {
@@ -507,7 +522,7 @@ export const getGetObjectsQueryOptions = <
export type GetObjectsQueryResult = NonNullable< export type GetObjectsQueryResult = NonNullable<
Awaited<ReturnType<typeof getObjects>> Awaited<ReturnType<typeof getObjects>>
>; >;
export type GetObjectsQueryError = RenderErrorResponseDTO; export type GetObjectsQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get objects for a role by relation * @summary Get objects for a role by relation
@@ -515,7 +530,7 @@ export type GetObjectsQueryError = RenderErrorResponseDTO;
export function useGetObjects< export function useGetObjects<
TData = Awaited<ReturnType<typeof getObjects>>, TData = Awaited<ReturnType<typeof getObjects>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ id, relation }: GetObjectsPathParameters, { id, relation }: GetObjectsPathParameters,
options?: { options?: {
@@ -559,18 +574,18 @@ export const invalidateGetObjects = async (
*/ */
export const patchObjects = ( export const patchObjects = (
{ id, relation }: PatchObjectsPathParameters, { id, relation }: PatchObjectsPathParameters,
roletypesPatchableObjectsDTO: RoletypesPatchableObjectsDTO, authtypesPatchableObjectsDTO: BodyType<AuthtypesPatchableObjectsDTO>,
) => { ) => {
return GeneratedAPIInstance<string>({ return GeneratedAPIInstance<string>({
url: `/api/v1/roles/${id}/relation/${relation}/objects`, url: `/api/v1/roles/${id}/relation/${relation}/objects`,
method: 'PATCH', method: 'PATCH',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
data: roletypesPatchableObjectsDTO, data: authtypesPatchableObjectsDTO,
}); });
}; };
export const getPatchObjectsMutationOptions = < export const getPatchObjectsMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -578,14 +593,17 @@ export const getPatchObjectsMutationOptions = <
TError, TError,
{ {
pathParams: PatchObjectsPathParameters; pathParams: PatchObjectsPathParameters;
data: RoletypesPatchableObjectsDTO; data: BodyType<AuthtypesPatchableObjectsDTO>;
}, },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof patchObjects>>, Awaited<ReturnType<typeof patchObjects>>,
TError, TError,
{ pathParams: PatchObjectsPathParameters; data: RoletypesPatchableObjectsDTO }, {
pathParams: PatchObjectsPathParameters;
data: BodyType<AuthtypesPatchableObjectsDTO>;
},
TContext TContext
> => { > => {
const mutationKey = ['patchObjects']; const mutationKey = ['patchObjects'];
@@ -599,7 +617,10 @@ export const getPatchObjectsMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof patchObjects>>, Awaited<ReturnType<typeof patchObjects>>,
{ pathParams: PatchObjectsPathParameters; data: RoletypesPatchableObjectsDTO } {
pathParams: PatchObjectsPathParameters;
data: BodyType<AuthtypesPatchableObjectsDTO>;
}
> = (props) => { > = (props) => {
const { pathParams, data } = props ?? {}; const { pathParams, data } = props ?? {};
@@ -612,14 +633,14 @@ export const getPatchObjectsMutationOptions = <
export type PatchObjectsMutationResult = NonNullable< export type PatchObjectsMutationResult = NonNullable<
Awaited<ReturnType<typeof patchObjects>> Awaited<ReturnType<typeof patchObjects>>
>; >;
export type PatchObjectsMutationBody = RoletypesPatchableObjectsDTO; export type PatchObjectsMutationBody = BodyType<AuthtypesPatchableObjectsDTO>;
export type PatchObjectsMutationError = RenderErrorResponseDTO; export type PatchObjectsMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Patch objects for a role by relation * @summary Patch objects for a role by relation
*/ */
export const usePatchObjects = < export const usePatchObjects = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -627,102 +648,20 @@ export const usePatchObjects = <
TError, TError,
{ {
pathParams: PatchObjectsPathParameters; pathParams: PatchObjectsPathParameters;
data: RoletypesPatchableObjectsDTO; data: BodyType<AuthtypesPatchableObjectsDTO>;
}, },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof patchObjects>>, Awaited<ReturnType<typeof patchObjects>>,
TError, TError,
{ pathParams: PatchObjectsPathParameters; data: RoletypesPatchableObjectsDTO }, {
pathParams: PatchObjectsPathParameters;
data: BodyType<AuthtypesPatchableObjectsDTO>;
},
TContext TContext
> => { > => {
const mutationOptions = getPatchObjectsMutationOptions(options); const mutationOptions = getPatchObjectsMutationOptions(options);
return useMutation(mutationOptions); return useMutation(mutationOptions);
}; };
/**
* Gets all the available resources for role assignment
* @summary Get resources
*/
export const getResources = (signal?: AbortSignal) => {
return GeneratedAPIInstance<GetResources200>({
url: `/api/v1/roles/resources`,
method: 'GET',
signal,
});
};
export const getGetResourcesQueryKey = () => {
return ['getResources'] as const;
};
export const getGetResourcesQueryOptions = <
TData = Awaited<ReturnType<typeof getResources>>,
TError = RenderErrorResponseDTO
>(options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof getResources>>,
TError,
TData
>;
}) => {
const { query: queryOptions } = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetResourcesQueryKey();
const queryFn: QueryFunction<Awaited<ReturnType<typeof getResources>>> = ({
signal,
}) => getResources(signal);
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
Awaited<ReturnType<typeof getResources>>,
TError,
TData
> & { queryKey: QueryKey };
};
export type GetResourcesQueryResult = NonNullable<
Awaited<ReturnType<typeof getResources>>
>;
export type GetResourcesQueryError = RenderErrorResponseDTO;
/**
* @summary Get resources
*/
export function useGetResources<
TData = Awaited<ReturnType<typeof getResources>>,
TError = RenderErrorResponseDTO
>(options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof getResources>>,
TError,
TData
>;
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
const queryOptions = getGetResourcesQueryOptions(options);
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
queryKey: QueryKey;
};
query.queryKey = queryOptions.queryKey;
return query;
}
/**
* @summary Get resources
*/
export const invalidateGetResources = async (
queryClient: QueryClient,
options?: InvalidateOptions,
): Promise<QueryClient> => {
await queryClient.invalidateQueries(
{ queryKey: getGetResourcesQueryKey() },
options,
);
return queryClient;
};

View File

@@ -17,7 +17,8 @@ import type {
} from 'react-query'; } from 'react-query';
import { useMutation, useQuery } from 'react-query'; import { useMutation, useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
AuthtypesPostableEmailPasswordSessionDTO, AuthtypesPostableEmailPasswordSessionDTO,
AuthtypesPostableRotateTokenDTO, AuthtypesPostableRotateTokenDTO,
@@ -49,12 +50,12 @@ export const createSessionByGoogleCallback = (signal?: AbortSignal) => {
}; };
export const getCreateSessionByGoogleCallbackQueryKey = () => { export const getCreateSessionByGoogleCallbackQueryKey = () => {
return ['createSessionByGoogleCallback'] as const; return [`/api/v1/complete/google`] as const;
}; };
export const getCreateSessionByGoogleCallbackQueryOptions = < export const getCreateSessionByGoogleCallbackQueryOptions = <
TData = Awaited<ReturnType<typeof createSessionByGoogleCallback>>, TData = Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
TError = CreateSessionByGoogleCallback303 | RenderErrorResponseDTO TError = ErrorType<CreateSessionByGoogleCallback303 | RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof createSessionByGoogleCallback>>, Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
@@ -81,9 +82,9 @@ export const getCreateSessionByGoogleCallbackQueryOptions = <
export type CreateSessionByGoogleCallbackQueryResult = NonNullable< export type CreateSessionByGoogleCallbackQueryResult = NonNullable<
Awaited<ReturnType<typeof createSessionByGoogleCallback>> Awaited<ReturnType<typeof createSessionByGoogleCallback>>
>; >;
export type CreateSessionByGoogleCallbackQueryError = export type CreateSessionByGoogleCallbackQueryError = ErrorType<
| CreateSessionByGoogleCallback303 CreateSessionByGoogleCallback303 | RenderErrorResponseDTO
| RenderErrorResponseDTO; >;
/** /**
* @summary Create session by google callback * @summary Create session by google callback
@@ -91,7 +92,7 @@ export type CreateSessionByGoogleCallbackQueryError =
export function useCreateSessionByGoogleCallback< export function useCreateSessionByGoogleCallback<
TData = Awaited<ReturnType<typeof createSessionByGoogleCallback>>, TData = Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
TError = CreateSessionByGoogleCallback303 | RenderErrorResponseDTO TError = ErrorType<CreateSessionByGoogleCallback303 | RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof createSessionByGoogleCallback>>, Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
@@ -138,12 +139,12 @@ export const createSessionByOIDCCallback = (signal?: AbortSignal) => {
}; };
export const getCreateSessionByOIDCCallbackQueryKey = () => { export const getCreateSessionByOIDCCallbackQueryKey = () => {
return ['createSessionByOIDCCallback'] as const; return [`/api/v1/complete/oidc`] as const;
}; };
export const getCreateSessionByOIDCCallbackQueryOptions = < export const getCreateSessionByOIDCCallbackQueryOptions = <
TData = Awaited<ReturnType<typeof createSessionByOIDCCallback>>, TData = Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
TError = CreateSessionByOIDCCallback303 | RenderErrorResponseDTO TError = ErrorType<CreateSessionByOIDCCallback303 | RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof createSessionByOIDCCallback>>, Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
@@ -170,9 +171,9 @@ export const getCreateSessionByOIDCCallbackQueryOptions = <
export type CreateSessionByOIDCCallbackQueryResult = NonNullable< export type CreateSessionByOIDCCallbackQueryResult = NonNullable<
Awaited<ReturnType<typeof createSessionByOIDCCallback>> Awaited<ReturnType<typeof createSessionByOIDCCallback>>
>; >;
export type CreateSessionByOIDCCallbackQueryError = export type CreateSessionByOIDCCallbackQueryError = ErrorType<
| CreateSessionByOIDCCallback303 CreateSessionByOIDCCallback303 | RenderErrorResponseDTO
| RenderErrorResponseDTO; >;
/** /**
* @summary Create session by oidc callback * @summary Create session by oidc callback
@@ -180,7 +181,7 @@ export type CreateSessionByOIDCCallbackQueryError =
export function useCreateSessionByOIDCCallback< export function useCreateSessionByOIDCCallback<
TData = Awaited<ReturnType<typeof createSessionByOIDCCallback>>, TData = Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
TError = CreateSessionByOIDCCallback303 | RenderErrorResponseDTO TError = ErrorType<CreateSessionByOIDCCallback303 | RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof createSessionByOIDCCallback>>, Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
@@ -219,7 +220,7 @@ export const invalidateCreateSessionByOIDCCallback = async (
* @summary Create session by saml callback * @summary Create session by saml callback
*/ */
export const createSessionBySAMLCallback = ( export const createSessionBySAMLCallback = (
createSessionBySAMLCallbackBody: CreateSessionBySAMLCallbackBody, createSessionBySAMLCallbackBody: BodyType<CreateSessionBySAMLCallbackBody>,
params?: CreateSessionBySAMLCallbackParams, params?: CreateSessionBySAMLCallbackParams,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
@@ -248,14 +249,14 @@ export const createSessionBySAMLCallback = (
}; };
export const getCreateSessionBySAMLCallbackMutationOptions = < export const getCreateSessionBySAMLCallbackMutationOptions = <
TError = CreateSessionBySAMLCallback303 | RenderErrorResponseDTO, TError = ErrorType<CreateSessionBySAMLCallback303 | RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createSessionBySAMLCallback>>, Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
TError, TError,
{ {
data: CreateSessionBySAMLCallbackBody; data: BodyType<CreateSessionBySAMLCallbackBody>;
params?: CreateSessionBySAMLCallbackParams; params?: CreateSessionBySAMLCallbackParams;
}, },
TContext TContext
@@ -264,7 +265,7 @@ export const getCreateSessionBySAMLCallbackMutationOptions = <
Awaited<ReturnType<typeof createSessionBySAMLCallback>>, Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
TError, TError,
{ {
data: CreateSessionBySAMLCallbackBody; data: BodyType<CreateSessionBySAMLCallbackBody>;
params?: CreateSessionBySAMLCallbackParams; params?: CreateSessionBySAMLCallbackParams;
}, },
TContext TContext
@@ -281,7 +282,7 @@ export const getCreateSessionBySAMLCallbackMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof createSessionBySAMLCallback>>, Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
{ {
data: CreateSessionBySAMLCallbackBody; data: BodyType<CreateSessionBySAMLCallbackBody>;
params?: CreateSessionBySAMLCallbackParams; params?: CreateSessionBySAMLCallbackParams;
} }
> = (props) => { > = (props) => {
@@ -296,23 +297,23 @@ export const getCreateSessionBySAMLCallbackMutationOptions = <
export type CreateSessionBySAMLCallbackMutationResult = NonNullable< export type CreateSessionBySAMLCallbackMutationResult = NonNullable<
Awaited<ReturnType<typeof createSessionBySAMLCallback>> Awaited<ReturnType<typeof createSessionBySAMLCallback>>
>; >;
export type CreateSessionBySAMLCallbackMutationBody = CreateSessionBySAMLCallbackBody; export type CreateSessionBySAMLCallbackMutationBody = BodyType<CreateSessionBySAMLCallbackBody>;
export type CreateSessionBySAMLCallbackMutationError = export type CreateSessionBySAMLCallbackMutationError = ErrorType<
| CreateSessionBySAMLCallback303 CreateSessionBySAMLCallback303 | RenderErrorResponseDTO
| RenderErrorResponseDTO; >;
/** /**
* @summary Create session by saml callback * @summary Create session by saml callback
*/ */
export const useCreateSessionBySAMLCallback = < export const useCreateSessionBySAMLCallback = <
TError = CreateSessionBySAMLCallback303 | RenderErrorResponseDTO, TError = ErrorType<CreateSessionBySAMLCallback303 | RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createSessionBySAMLCallback>>, Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
TError, TError,
{ {
data: CreateSessionBySAMLCallbackBody; data: BodyType<CreateSessionBySAMLCallbackBody>;
params?: CreateSessionBySAMLCallbackParams; params?: CreateSessionBySAMLCallbackParams;
}, },
TContext TContext
@@ -321,7 +322,7 @@ export const useCreateSessionBySAMLCallback = <
Awaited<ReturnType<typeof createSessionBySAMLCallback>>, Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
TError, TError,
{ {
data: CreateSessionBySAMLCallbackBody; data: BodyType<CreateSessionBySAMLCallbackBody>;
params?: CreateSessionBySAMLCallbackParams; params?: CreateSessionBySAMLCallbackParams;
}, },
TContext TContext
@@ -342,7 +343,7 @@ export const deleteSession = () => {
}; };
export const getDeleteSessionMutationOptions = < export const getDeleteSessionMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -380,13 +381,13 @@ export type DeleteSessionMutationResult = NonNullable<
Awaited<ReturnType<typeof deleteSession>> Awaited<ReturnType<typeof deleteSession>>
>; >;
export type DeleteSessionMutationError = RenderErrorResponseDTO; export type DeleteSessionMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Delete session * @summary Delete session
*/ */
export const useDeleteSession = < export const useDeleteSession = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -418,12 +419,12 @@ export const getSessionContext = (signal?: AbortSignal) => {
}; };
export const getGetSessionContextQueryKey = () => { export const getGetSessionContextQueryKey = () => {
return ['getSessionContext'] as const; return [`/api/v2/sessions/context`] as const;
}; };
export const getGetSessionContextQueryOptions = < export const getGetSessionContextQueryOptions = <
TData = Awaited<ReturnType<typeof getSessionContext>>, TData = Awaited<ReturnType<typeof getSessionContext>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof getSessionContext>>, Awaited<ReturnType<typeof getSessionContext>>,
@@ -449,7 +450,7 @@ export const getGetSessionContextQueryOptions = <
export type GetSessionContextQueryResult = NonNullable< export type GetSessionContextQueryResult = NonNullable<
Awaited<ReturnType<typeof getSessionContext>> Awaited<ReturnType<typeof getSessionContext>>
>; >;
export type GetSessionContextQueryError = RenderErrorResponseDTO; export type GetSessionContextQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get session context * @summary Get session context
@@ -457,7 +458,7 @@ export type GetSessionContextQueryError = RenderErrorResponseDTO;
export function useGetSessionContext< export function useGetSessionContext<
TData = Awaited<ReturnType<typeof getSessionContext>>, TData = Awaited<ReturnType<typeof getSessionContext>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof getSessionContext>>, Awaited<ReturnType<typeof getSessionContext>>,
@@ -496,7 +497,7 @@ export const invalidateGetSessionContext = async (
* @summary Create session by email and password * @summary Create session by email and password
*/ */
export const createSessionByEmailPassword = ( export const createSessionByEmailPassword = (
authtypesPostableEmailPasswordSessionDTO: AuthtypesPostableEmailPasswordSessionDTO, authtypesPostableEmailPasswordSessionDTO: BodyType<AuthtypesPostableEmailPasswordSessionDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<CreateSessionByEmailPassword200>({ return GeneratedAPIInstance<CreateSessionByEmailPassword200>({
@@ -509,19 +510,19 @@ export const createSessionByEmailPassword = (
}; };
export const getCreateSessionByEmailPasswordMutationOptions = < export const getCreateSessionByEmailPasswordMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createSessionByEmailPassword>>, Awaited<ReturnType<typeof createSessionByEmailPassword>>,
TError, TError,
{ data: AuthtypesPostableEmailPasswordSessionDTO }, { data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof createSessionByEmailPassword>>, Awaited<ReturnType<typeof createSessionByEmailPassword>>,
TError, TError,
{ data: AuthtypesPostableEmailPasswordSessionDTO }, { data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
TContext TContext
> => { > => {
const mutationKey = ['createSessionByEmailPassword']; const mutationKey = ['createSessionByEmailPassword'];
@@ -535,7 +536,7 @@ export const getCreateSessionByEmailPasswordMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof createSessionByEmailPassword>>, Awaited<ReturnType<typeof createSessionByEmailPassword>>,
{ data: AuthtypesPostableEmailPasswordSessionDTO } { data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -548,26 +549,26 @@ export const getCreateSessionByEmailPasswordMutationOptions = <
export type CreateSessionByEmailPasswordMutationResult = NonNullable< export type CreateSessionByEmailPasswordMutationResult = NonNullable<
Awaited<ReturnType<typeof createSessionByEmailPassword>> Awaited<ReturnType<typeof createSessionByEmailPassword>>
>; >;
export type CreateSessionByEmailPasswordMutationBody = AuthtypesPostableEmailPasswordSessionDTO; export type CreateSessionByEmailPasswordMutationBody = BodyType<AuthtypesPostableEmailPasswordSessionDTO>;
export type CreateSessionByEmailPasswordMutationError = RenderErrorResponseDTO; export type CreateSessionByEmailPasswordMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Create session by email and password * @summary Create session by email and password
*/ */
export const useCreateSessionByEmailPassword = < export const useCreateSessionByEmailPassword = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createSessionByEmailPassword>>, Awaited<ReturnType<typeof createSessionByEmailPassword>>,
TError, TError,
{ data: AuthtypesPostableEmailPasswordSessionDTO }, { data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof createSessionByEmailPassword>>, Awaited<ReturnType<typeof createSessionByEmailPassword>>,
TError, TError,
{ data: AuthtypesPostableEmailPasswordSessionDTO }, { data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
TContext TContext
> => { > => {
const mutationOptions = getCreateSessionByEmailPasswordMutationOptions( const mutationOptions = getCreateSessionByEmailPasswordMutationOptions(
@@ -581,7 +582,7 @@ export const useCreateSessionByEmailPassword = <
* @summary Rotate session * @summary Rotate session
*/ */
export const rotateSession = ( export const rotateSession = (
authtypesPostableRotateTokenDTO: AuthtypesPostableRotateTokenDTO, authtypesPostableRotateTokenDTO: BodyType<AuthtypesPostableRotateTokenDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<RotateSession200>({ return GeneratedAPIInstance<RotateSession200>({
@@ -594,19 +595,19 @@ export const rotateSession = (
}; };
export const getRotateSessionMutationOptions = < export const getRotateSessionMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof rotateSession>>, Awaited<ReturnType<typeof rotateSession>>,
TError, TError,
{ data: AuthtypesPostableRotateTokenDTO }, { data: BodyType<AuthtypesPostableRotateTokenDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof rotateSession>>, Awaited<ReturnType<typeof rotateSession>>,
TError, TError,
{ data: AuthtypesPostableRotateTokenDTO }, { data: BodyType<AuthtypesPostableRotateTokenDTO> },
TContext TContext
> => { > => {
const mutationKey = ['rotateSession']; const mutationKey = ['rotateSession'];
@@ -620,7 +621,7 @@ export const getRotateSessionMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof rotateSession>>, Awaited<ReturnType<typeof rotateSession>>,
{ data: AuthtypesPostableRotateTokenDTO } { data: BodyType<AuthtypesPostableRotateTokenDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -633,26 +634,26 @@ export const getRotateSessionMutationOptions = <
export type RotateSessionMutationResult = NonNullable< export type RotateSessionMutationResult = NonNullable<
Awaited<ReturnType<typeof rotateSession>> Awaited<ReturnType<typeof rotateSession>>
>; >;
export type RotateSessionMutationBody = AuthtypesPostableRotateTokenDTO; export type RotateSessionMutationBody = BodyType<AuthtypesPostableRotateTokenDTO>;
export type RotateSessionMutationError = RenderErrorResponseDTO; export type RotateSessionMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Rotate session * @summary Rotate session
*/ */
export const useRotateSession = < export const useRotateSession = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof rotateSession>>, Awaited<ReturnType<typeof rotateSession>>,
TError, TError,
{ data: AuthtypesPostableRotateTokenDTO }, { data: BodyType<AuthtypesPostableRotateTokenDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof rotateSession>>, Awaited<ReturnType<typeof rotateSession>>,
TError, TError,
{ data: AuthtypesPostableRotateTokenDTO }, { data: BodyType<AuthtypesPostableRotateTokenDTO> },
TContext TContext
> => { > => {
const mutationOptions = getRotateSessionMutationOptions(options); const mutationOptions = getRotateSessionMutationOptions(options);

View File

@@ -81,7 +81,7 @@ export interface AuthtypesGettableAuthDomainDTO {
/** /**
* @type string * @type string
*/ */
id?: string; id: string;
/** /**
* @type string * @type string
*/ */
@@ -108,6 +108,33 @@ export interface AuthtypesGettableAuthDomainDTO {
updatedAt?: Date; updatedAt?: Date;
} }
export interface AuthtypesGettableObjectsDTO {
resource: AuthtypesResourceDTO;
/**
* @type array
*/
selectors: string[];
}
/**
* @nullable
*/
export type AuthtypesGettableResourcesDTORelations = {
[key: string]: string[];
} | null;
export interface AuthtypesGettableResourcesDTO {
/**
* @type object
* @nullable true
*/
relations: AuthtypesGettableResourcesDTORelations;
/**
* @type array
*/
resources: AuthtypesResourceDTO[];
}
export interface AuthtypesGettableTokenDTO { export interface AuthtypesGettableTokenDTO {
/** /**
* @type string * @type string
@@ -182,10 +209,6 @@ export interface AuthtypesGoogleConfigDTO {
serviceAccountJson?: string; serviceAccountJson?: string;
} }
export interface AuthtypesNameDTO {
[key: string]: unknown;
}
export interface AuthtypesOIDCConfigDTO { export interface AuthtypesOIDCConfigDTO {
claimMapping?: AuthtypesAttributeMappingDTO; claimMapping?: AuthtypesAttributeMappingDTO;
/** /**
@@ -216,7 +239,10 @@ export interface AuthtypesOIDCConfigDTO {
export interface AuthtypesObjectDTO { export interface AuthtypesObjectDTO {
resource: AuthtypesResourceDTO; resource: AuthtypesResourceDTO;
selector: AuthtypesSelectorDTO; /**
* @type string
*/
selector: string;
} }
export interface AuthtypesOrgSessionContextDTO { export interface AuthtypesOrgSessionContextDTO {
@@ -239,6 +265,19 @@ export interface AuthtypesPasswordAuthNSupportDTO {
provider?: string; provider?: string;
} }
export interface AuthtypesPatchableObjectsDTO {
/**
* @type array
* @nullable true
*/
additions: AuthtypesGettableObjectsDTO[] | null;
/**
* @type array
* @nullable true
*/
deletions: AuthtypesGettableObjectsDTO[] | null;
}
export interface AuthtypesPostableAuthDomainDTO { export interface AuthtypesPostableAuthDomainDTO {
config?: AuthtypesAuthDomainConfigDTO; config?: AuthtypesAuthDomainConfigDTO;
/** /**
@@ -270,7 +309,10 @@ export interface AuthtypesPostableRotateTokenDTO {
} }
export interface AuthtypesResourceDTO { export interface AuthtypesResourceDTO {
name: AuthtypesNameDTO; /**
* @type string
*/
name: string;
/** /**
* @type string * @type string
*/ */
@@ -320,10 +362,6 @@ export interface AuthtypesSamlConfigDTO {
samlIdp?: string; samlIdp?: string;
} }
export interface AuthtypesSelectorDTO {
[key: string]: unknown;
}
export interface AuthtypesSessionContextDTO { export interface AuthtypesSessionContextDTO {
/** /**
* @type boolean * @type boolean
@@ -337,10 +375,6 @@ export interface AuthtypesSessionContextDTO {
} }
export interface AuthtypesTransactionDTO { export interface AuthtypesTransactionDTO {
/**
* @type string
*/
id?: string;
object: AuthtypesObjectDTO; object: AuthtypesObjectDTO;
/** /**
* @type string * @type string
@@ -436,7 +470,7 @@ export interface ErrorsJSONDTO {
/** /**
* @type string * @type string
*/ */
code?: string; code: string;
/** /**
* @type array * @type array
*/ */
@@ -444,7 +478,7 @@ export interface ErrorsJSONDTO {
/** /**
* @type string * @type string
*/ */
message?: string; message: string;
/** /**
* @type string * @type string
*/ */
@@ -623,14 +657,14 @@ export interface GatewaytypesLimitMetricValueDTO {
export interface GatewaytypesLimitValueDTO { export interface GatewaytypesLimitValueDTO {
/** /**
* @type integer * @type integer
* @format int64 * @nullable true
*/ */
count?: number; count?: number | null;
/** /**
* @type integer * @type integer
* @format int64 * @nullable true
*/ */
size?: number; size?: number | null;
} }
export interface GatewaytypesPaginationDTO { export interface GatewaytypesPaginationDTO {
@@ -1985,44 +2019,11 @@ export enum Querybuildertypesv5VariableTypeDTO {
text = 'text', text = 'text',
} }
export interface RenderErrorResponseDTO { export interface RenderErrorResponseDTO {
error?: ErrorsJSONDTO; error: ErrorsJSONDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}
/**
* @nullable
*/
export type RoletypesGettableResourcesDTORelations = {
[key: string]: string[];
} | null;
export interface RoletypesGettableResourcesDTO {
/**
* @type object
* @nullable true
*/
relations: RoletypesGettableResourcesDTORelations;
/**
* @type array
* @nullable true
*/
resources: AuthtypesResourceDTO[] | null;
}
export interface RoletypesPatchableObjectsDTO {
/**
* @type array
* @nullable true
*/
additions: AuthtypesObjectDTO[] | null;
/**
* @type array
* @nullable true
*/
deletions: AuthtypesObjectDTO[] | null;
} }
export interface RoletypesPatchableRoleDTO { export interface RoletypesPatchableRoleDTO {
@@ -2056,7 +2057,7 @@ export interface RoletypesRoleDTO {
/** /**
* @type string * @type string
*/ */
id?: string; id: string;
/** /**
* @type string * @type string
*/ */
@@ -2197,7 +2198,7 @@ export interface TypesGettableAPIKeyDTO {
/** /**
* @type string * @type string
*/ */
id?: string; id: string;
/** /**
* @type integer * @type integer
* @format int64 * @format int64
@@ -2250,7 +2251,7 @@ export interface TypesIdentifiableDTO {
/** /**
* @type string * @type string
*/ */
id?: string; id: string;
} }
export interface TypesInviteDTO { export interface TypesInviteDTO {
@@ -2266,7 +2267,7 @@ export interface TypesInviteDTO {
/** /**
* @type string * @type string
*/ */
id?: string; id: string;
/** /**
* @type string * @type string
*/ */
@@ -2311,7 +2312,7 @@ export interface TypesOrganizationDTO {
/** /**
* @type string * @type string
*/ */
id?: string; id: string;
/** /**
* @type integer * @type integer
* @minimum 0 * @minimum 0
@@ -2417,7 +2418,7 @@ export interface TypesResetPasswordTokenDTO {
/** /**
* @type string * @type string
*/ */
id?: string; id: string;
/** /**
* @type string * @type string
*/ */
@@ -2441,7 +2442,7 @@ export interface TypesStorableAPIKeyDTO {
/** /**
* @type string * @type string
*/ */
id?: string; id: string;
/** /**
* @type string * @type string
*/ */
@@ -2490,7 +2491,7 @@ export interface TypesUserDTO {
/** /**
* @type string * @type string
*/ */
id?: string; id: string;
/** /**
* @type boolean * @type boolean
*/ */
@@ -2599,30 +2600,38 @@ export type AuthzCheck200 = {
/** /**
* @type array * @type array
*/ */
data?: AuthtypesGettableTransactionDTO[]; data: AuthtypesGettableTransactionDTO[];
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
};
export type AuthzResources200 = {
data: AuthtypesGettableResourcesDTO;
/**
* @type string
*/
status: string;
}; };
export type ChangePasswordPathParameters = { export type ChangePasswordPathParameters = {
id: string; id: string;
}; };
export type CreateSessionByGoogleCallback303 = { export type CreateSessionByGoogleCallback303 = {
data?: AuthtypesGettableTokenDTO; data: AuthtypesGettableTokenDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type CreateSessionByOIDCCallback303 = { export type CreateSessionByOIDCCallback303 = {
data?: AuthtypesGettableTokenDTO; data: AuthtypesGettableTokenDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type CreateSessionBySAMLCallbackParams = { export type CreateSessionBySAMLCallbackParams = {
@@ -2650,11 +2659,11 @@ export type CreateSessionBySAMLCallbackBody = {
}; };
export type CreateSessionBySAMLCallback303 = { export type CreateSessionBySAMLCallback303 = {
data?: AuthtypesGettableTokenDTO; data: AuthtypesGettableTokenDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type DeletePublicDashboardPathParameters = { export type DeletePublicDashboardPathParameters = {
@@ -2664,22 +2673,22 @@ export type GetPublicDashboardPathParameters = {
id: string; id: string;
}; };
export type GetPublicDashboard200 = { export type GetPublicDashboard200 = {
data?: DashboardtypesGettablePublicDasbhboardDTO; data: DashboardtypesGettablePublicDasbhboardDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type CreatePublicDashboardPathParameters = { export type CreatePublicDashboardPathParameters = {
id: string; id: string;
}; };
export type CreatePublicDashboard201 = { export type CreatePublicDashboard201 = {
data?: TypesIdentifiableDTO; data: TypesIdentifiableDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type UpdatePublicDashboardPathParameters = { export type UpdatePublicDashboardPathParameters = {
@@ -2689,19 +2698,19 @@ export type ListAuthDomains200 = {
/** /**
* @type array * @type array
*/ */
data?: AuthtypesGettableAuthDomainDTO[]; data: AuthtypesGettableAuthDomainDTO[];
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type CreateAuthDomain200 = { export type CreateAuthDomain200 = {
data?: AuthtypesGettableAuthDomainDTO; data: AuthtypesGettableAuthDomainDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type DeleteAuthDomainPathParameters = { export type DeleteAuthDomainPathParameters = {
@@ -2757,11 +2766,11 @@ export type GetFieldsKeysParams = {
}; };
export type GetFieldsKeys200 = { export type GetFieldsKeys200 = {
data?: TelemetrytypesGettableFieldKeysDTO; data: TelemetrytypesGettableFieldKeysDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetFieldsValuesParams = { export type GetFieldsValuesParams = {
@@ -2821,49 +2830,49 @@ export type GetFieldsValuesParams = {
}; };
export type GetFieldsValues200 = { export type GetFieldsValues200 = {
data?: TelemetrytypesGettableFieldValuesDTO; data: TelemetrytypesGettableFieldValuesDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetResetPasswordTokenPathParameters = { export type GetResetPasswordTokenPathParameters = {
id: string; id: string;
}; };
export type GetResetPasswordToken200 = { export type GetResetPasswordToken200 = {
data?: TypesResetPasswordTokenDTO; data: TypesResetPasswordTokenDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetGlobalConfig200 = { export type GetGlobalConfig200 = {
data?: TypesGettableGlobalConfigDTO; data: TypesGettableGlobalConfigDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type ListInvite200 = { export type ListInvite200 = {
/** /**
* @type array * @type array
*/ */
data?: TypesInviteDTO[]; data: TypesInviteDTO[];
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type CreateInvite201 = { export type CreateInvite201 = {
data?: TypesInviteDTO; data: TypesInviteDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type DeleteInvitePathParameters = { export type DeleteInvitePathParameters = {
@@ -2873,19 +2882,19 @@ export type GetInvitePathParameters = {
token: string; token: string;
}; };
export type GetInvite200 = { export type GetInvite200 = {
data?: TypesInviteDTO; data: TypesInviteDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type AcceptInvite201 = { export type AcceptInvite201 = {
data?: TypesUserDTO; data: TypesUserDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type ListPromotedAndIndexedPaths200 = { export type ListPromotedAndIndexedPaths200 = {
@@ -2893,33 +2902,33 @@ export type ListPromotedAndIndexedPaths200 = {
* @type array * @type array
* @nullable true * @nullable true
*/ */
data?: PromotetypesPromotePathDTO[] | null; data: PromotetypesPromotePathDTO[] | null;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type ListOrgPreferences200 = { export type ListOrgPreferences200 = {
/** /**
* @type array * @type array
*/ */
data?: PreferencetypesPreferenceDTO[]; data: PreferencetypesPreferenceDTO[];
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetOrgPreferencePathParameters = { export type GetOrgPreferencePathParameters = {
name: string; name: string;
}; };
export type GetOrgPreference200 = { export type GetOrgPreference200 = {
data?: PreferencetypesPreferenceDTO; data: PreferencetypesPreferenceDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type UpdateOrgPreferencePathParameters = { export type UpdateOrgPreferencePathParameters = {
@@ -2929,19 +2938,19 @@ export type ListAPIKeys200 = {
/** /**
* @type array * @type array
*/ */
data?: TypesGettableAPIKeyDTO[]; data: TypesGettableAPIKeyDTO[];
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type CreateAPIKey201 = { export type CreateAPIKey201 = {
data?: TypesGettableAPIKeyDTO; data: TypesGettableAPIKeyDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type RevokeAPIKeyPathParameters = { export type RevokeAPIKeyPathParameters = {
@@ -2954,11 +2963,11 @@ export type GetPublicDashboardDataPathParameters = {
id: string; id: string;
}; };
export type GetPublicDashboardData200 = { export type GetPublicDashboardData200 = {
data?: DashboardtypesGettablePublicDashboardDataDTO; data: DashboardtypesGettablePublicDashboardDataDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetPublicDashboardWidgetQueryRangePathParameters = { export type GetPublicDashboardWidgetQueryRangePathParameters = {
@@ -2966,30 +2975,30 @@ export type GetPublicDashboardWidgetQueryRangePathParameters = {
idx: string; idx: string;
}; };
export type GetPublicDashboardWidgetQueryRange200 = { export type GetPublicDashboardWidgetQueryRange200 = {
data?: Querybuildertypesv5QueryRangeResponseDTO; data: Querybuildertypesv5QueryRangeResponseDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type ListRoles200 = { export type ListRoles200 = {
/** /**
* @type array * @type array
*/ */
data?: RoletypesRoleDTO[]; data: RoletypesRoleDTO[];
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type CreateRole201 = { export type CreateRole201 = {
data?: TypesIdentifiableDTO; data: TypesIdentifiableDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type DeleteRolePathParameters = { export type DeleteRolePathParameters = {
@@ -2999,11 +3008,11 @@ export type GetRolePathParameters = {
id: string; id: string;
}; };
export type GetRole200 = { export type GetRole200 = {
data?: RoletypesRoleDTO; data: RoletypesRoleDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type PatchRolePathParameters = { export type PatchRolePathParameters = {
@@ -3017,34 +3026,26 @@ export type GetObjects200 = {
/** /**
* @type array * @type array
*/ */
data?: AuthtypesObjectDTO[]; data: AuthtypesGettableObjectsDTO[];
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type PatchObjectsPathParameters = { export type PatchObjectsPathParameters = {
id: string; id: string;
relation: string; relation: string;
}; };
export type GetResources200 = {
data?: RoletypesGettableResourcesDTO;
/**
* @type string
*/
status?: string;
};
export type ListUsers200 = { export type ListUsers200 = {
/** /**
* @type array * @type array
*/ */
data?: TypesUserDTO[]; data: TypesUserDTO[];
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type DeleteUserPathParameters = { export type DeleteUserPathParameters = {
@@ -3054,52 +3055,52 @@ export type GetUserPathParameters = {
id: string; id: string;
}; };
export type GetUser200 = { export type GetUser200 = {
data?: TypesUserDTO; data: TypesUserDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type UpdateUserPathParameters = { export type UpdateUserPathParameters = {
id: string; id: string;
}; };
export type UpdateUser200 = { export type UpdateUser200 = {
data?: TypesUserDTO; data: TypesUserDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetMyUser200 = { export type GetMyUser200 = {
data?: TypesUserDTO; data: TypesUserDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type ListUserPreferences200 = { export type ListUserPreferences200 = {
/** /**
* @type array * @type array
*/ */
data?: PreferencetypesPreferenceDTO[]; data: PreferencetypesPreferenceDTO[];
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetUserPreferencePathParameters = { export type GetUserPreferencePathParameters = {
name: string; name: string;
}; };
export type GetUserPreference200 = { export type GetUserPreference200 = {
data?: PreferencetypesPreferenceDTO; data: PreferencetypesPreferenceDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type UpdateUserPreferencePathParameters = { export type UpdateUserPreferencePathParameters = {
@@ -3109,11 +3110,11 @@ export type GetFeatures200 = {
/** /**
* @type array * @type array
*/ */
data?: FeaturetypesGettableFeatureDTO[]; data: FeaturetypesGettableFeatureDTO[];
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetIngestionKeysParams = { export type GetIngestionKeysParams = {
@@ -3130,19 +3131,19 @@ export type GetIngestionKeysParams = {
}; };
export type GetIngestionKeys200 = { export type GetIngestionKeys200 = {
data?: GatewaytypesGettableIngestionKeysDTO; data: GatewaytypesGettableIngestionKeysDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type CreateIngestionKey200 = { export type CreateIngestionKey201 = {
data?: GatewaytypesGettableCreatedIngestionKeyDTO; data: GatewaytypesGettableCreatedIngestionKeyDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type DeleteIngestionKeyPathParameters = { export type DeleteIngestionKeyPathParameters = {
@@ -3155,11 +3156,11 @@ export type CreateIngestionKeyLimitPathParameters = {
keyId: string; keyId: string;
}; };
export type CreateIngestionKeyLimit201 = { export type CreateIngestionKeyLimit201 = {
data?: GatewaytypesGettableCreatedIngestionKeyLimitDTO; data: GatewaytypesGettableCreatedIngestionKeyLimitDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type DeleteIngestionKeyLimitPathParameters = { export type DeleteIngestionKeyLimitPathParameters = {
@@ -3187,11 +3188,11 @@ export type SearchIngestionKeysParams = {
}; };
export type SearchIngestionKeys200 = { export type SearchIngestionKeys200 = {
data?: GatewaytypesGettableIngestionKeysDTO; data: GatewaytypesGettableIngestionKeysDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type ListMetricsParams = { export type ListMetricsParams = {
@@ -3220,22 +3221,22 @@ export type ListMetricsParams = {
}; };
export type ListMetrics200 = { export type ListMetrics200 = {
data?: MetricsexplorertypesListMetricsResponseDTO; data: MetricsexplorertypesListMetricsResponseDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetMetricAlertsPathParameters = { export type GetMetricAlertsPathParameters = {
metricName: string; metricName: string;
}; };
export type GetMetricAlerts200 = { export type GetMetricAlerts200 = {
data?: MetricsexplorertypesMetricAlertsResponseDTO; data: MetricsexplorertypesMetricAlertsResponseDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetMetricAttributesPathParameters = { export type GetMetricAttributesPathParameters = {
@@ -3257,117 +3258,117 @@ export type GetMetricAttributesParams = {
}; };
export type GetMetricAttributes200 = { export type GetMetricAttributes200 = {
data?: MetricsexplorertypesMetricAttributesResponseDTO; data: MetricsexplorertypesMetricAttributesResponseDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetMetricDashboardsPathParameters = { export type GetMetricDashboardsPathParameters = {
metricName: string; metricName: string;
}; };
export type GetMetricDashboards200 = { export type GetMetricDashboards200 = {
data?: MetricsexplorertypesMetricDashboardsResponseDTO; data: MetricsexplorertypesMetricDashboardsResponseDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetMetricHighlightsPathParameters = { export type GetMetricHighlightsPathParameters = {
metricName: string; metricName: string;
}; };
export type GetMetricHighlights200 = { export type GetMetricHighlights200 = {
data?: MetricsexplorertypesMetricHighlightsResponseDTO; data: MetricsexplorertypesMetricHighlightsResponseDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetMetricMetadataPathParameters = { export type GetMetricMetadataPathParameters = {
metricName: string; metricName: string;
}; };
export type GetMetricMetadata200 = { export type GetMetricMetadata200 = {
data?: MetricsexplorertypesMetricMetadataDTO; data: MetricsexplorertypesMetricMetadataDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type UpdateMetricMetadataPathParameters = { export type UpdateMetricMetadataPathParameters = {
metricName: string; metricName: string;
}; };
export type GetMetricsStats200 = { export type GetMetricsStats200 = {
data?: MetricsexplorertypesStatsResponseDTO; data: MetricsexplorertypesStatsResponseDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetMetricsTreemap200 = { export type GetMetricsTreemap200 = {
data?: MetricsexplorertypesTreemapResponseDTO; data: MetricsexplorertypesTreemapResponseDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetMyOrganization200 = { export type GetMyOrganization200 = {
data?: TypesOrganizationDTO; data: TypesOrganizationDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetSessionContext200 = { export type GetSessionContext200 = {
data?: AuthtypesSessionContextDTO; data: AuthtypesSessionContextDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type CreateSessionByEmailPassword200 = { export type CreateSessionByEmailPassword200 = {
data?: AuthtypesGettableTokenDTO; data: AuthtypesGettableTokenDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type RotateSession200 = { export type RotateSession200 = {
data?: AuthtypesGettableTokenDTO; data: AuthtypesGettableTokenDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type GetHosts200 = { export type GetHosts200 = {
data?: ZeustypesGettableHostDTO; data: ZeustypesGettableHostDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type QueryRangeV5200 = { export type QueryRangeV5200 = {
data?: Querybuildertypesv5QueryRangeResponseDTO; data: Querybuildertypesv5QueryRangeResponseDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };
export type ReplaceVariables200 = { export type ReplaceVariables200 = {
data?: Querybuildertypesv5QueryRangeRequestDTO; data: Querybuildertypesv5QueryRangeRequestDTO;
/** /**
* @type string * @type string
*/ */
status?: string; status: string;
}; };

View File

@@ -17,7 +17,8 @@ import type {
} from 'react-query'; } from 'react-query';
import { useMutation, useQuery } from 'react-query'; import { useMutation, useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
AcceptInvite201, AcceptInvite201,
ChangePasswordPathParameters, ChangePasswordPathParameters,
@@ -60,7 +61,7 @@ type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
*/ */
export const changePassword = ( export const changePassword = (
{ id }: ChangePasswordPathParameters, { id }: ChangePasswordPathParameters,
typesChangePasswordRequestDTO: TypesChangePasswordRequestDTO, typesChangePasswordRequestDTO: BodyType<TypesChangePasswordRequestDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<void>({ return GeneratedAPIInstance<void>({
@@ -73,7 +74,7 @@ export const changePassword = (
}; };
export const getChangePasswordMutationOptions = < export const getChangePasswordMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -81,7 +82,7 @@ export const getChangePasswordMutationOptions = <
TError, TError,
{ {
pathParams: ChangePasswordPathParameters; pathParams: ChangePasswordPathParameters;
data: TypesChangePasswordRequestDTO; data: BodyType<TypesChangePasswordRequestDTO>;
}, },
TContext TContext
>; >;
@@ -90,7 +91,7 @@ export const getChangePasswordMutationOptions = <
TError, TError,
{ {
pathParams: ChangePasswordPathParameters; pathParams: ChangePasswordPathParameters;
data: TypesChangePasswordRequestDTO; data: BodyType<TypesChangePasswordRequestDTO>;
}, },
TContext TContext
> => { > => {
@@ -107,7 +108,7 @@ export const getChangePasswordMutationOptions = <
Awaited<ReturnType<typeof changePassword>>, Awaited<ReturnType<typeof changePassword>>,
{ {
pathParams: ChangePasswordPathParameters; pathParams: ChangePasswordPathParameters;
data: TypesChangePasswordRequestDTO; data: BodyType<TypesChangePasswordRequestDTO>;
} }
> = (props) => { > = (props) => {
const { pathParams, data } = props ?? {}; const { pathParams, data } = props ?? {};
@@ -121,14 +122,14 @@ export const getChangePasswordMutationOptions = <
export type ChangePasswordMutationResult = NonNullable< export type ChangePasswordMutationResult = NonNullable<
Awaited<ReturnType<typeof changePassword>> Awaited<ReturnType<typeof changePassword>>
>; >;
export type ChangePasswordMutationBody = TypesChangePasswordRequestDTO; export type ChangePasswordMutationBody = BodyType<TypesChangePasswordRequestDTO>;
export type ChangePasswordMutationError = RenderErrorResponseDTO; export type ChangePasswordMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Change password * @summary Change password
*/ */
export const useChangePassword = < export const useChangePassword = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -136,7 +137,7 @@ export const useChangePassword = <
TError, TError,
{ {
pathParams: ChangePasswordPathParameters; pathParams: ChangePasswordPathParameters;
data: TypesChangePasswordRequestDTO; data: BodyType<TypesChangePasswordRequestDTO>;
}, },
TContext TContext
>; >;
@@ -145,7 +146,7 @@ export const useChangePassword = <
TError, TError,
{ {
pathParams: ChangePasswordPathParameters; pathParams: ChangePasswordPathParameters;
data: TypesChangePasswordRequestDTO; data: BodyType<TypesChangePasswordRequestDTO>;
}, },
TContext TContext
> => { > => {
@@ -171,12 +172,12 @@ export const getResetPasswordToken = (
export const getGetResetPasswordTokenQueryKey = ({ export const getGetResetPasswordTokenQueryKey = ({
id, id,
}: GetResetPasswordTokenPathParameters) => { }: GetResetPasswordTokenPathParameters) => {
return ['getResetPasswordToken'] as const; return [`/api/v1/getResetPasswordToken/${id}`] as const;
}; };
export const getGetResetPasswordTokenQueryOptions = < export const getGetResetPasswordTokenQueryOptions = <
TData = Awaited<ReturnType<typeof getResetPasswordToken>>, TData = Awaited<ReturnType<typeof getResetPasswordToken>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ id }: GetResetPasswordTokenPathParameters, { id }: GetResetPasswordTokenPathParameters,
options?: { options?: {
@@ -211,7 +212,7 @@ export const getGetResetPasswordTokenQueryOptions = <
export type GetResetPasswordTokenQueryResult = NonNullable< export type GetResetPasswordTokenQueryResult = NonNullable<
Awaited<ReturnType<typeof getResetPasswordToken>> Awaited<ReturnType<typeof getResetPasswordToken>>
>; >;
export type GetResetPasswordTokenQueryError = RenderErrorResponseDTO; export type GetResetPasswordTokenQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get reset password token * @summary Get reset password token
@@ -219,7 +220,7 @@ export type GetResetPasswordTokenQueryError = RenderErrorResponseDTO;
export function useGetResetPasswordToken< export function useGetResetPasswordToken<
TData = Awaited<ReturnType<typeof getResetPasswordToken>>, TData = Awaited<ReturnType<typeof getResetPasswordToken>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ id }: GetResetPasswordTokenPathParameters, { id }: GetResetPasswordTokenPathParameters,
options?: { options?: {
@@ -270,12 +271,12 @@ export const listInvite = (signal?: AbortSignal) => {
}; };
export const getListInviteQueryKey = () => { export const getListInviteQueryKey = () => {
return ['listInvite'] as const; return [`/api/v1/invite`] as const;
}; };
export const getListInviteQueryOptions = < export const getListInviteQueryOptions = <
TData = Awaited<ReturnType<typeof listInvite>>, TData = Awaited<ReturnType<typeof listInvite>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions<Awaited<ReturnType<typeof listInvite>>, TError, TData>; query?: UseQueryOptions<Awaited<ReturnType<typeof listInvite>>, TError, TData>;
}) => { }) => {
@@ -297,7 +298,7 @@ export const getListInviteQueryOptions = <
export type ListInviteQueryResult = NonNullable< export type ListInviteQueryResult = NonNullable<
Awaited<ReturnType<typeof listInvite>> Awaited<ReturnType<typeof listInvite>>
>; >;
export type ListInviteQueryError = RenderErrorResponseDTO; export type ListInviteQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary List invites * @summary List invites
@@ -305,7 +306,7 @@ export type ListInviteQueryError = RenderErrorResponseDTO;
export function useListInvite< export function useListInvite<
TData = Awaited<ReturnType<typeof listInvite>>, TData = Awaited<ReturnType<typeof listInvite>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions<Awaited<ReturnType<typeof listInvite>>, TError, TData>; query?: UseQueryOptions<Awaited<ReturnType<typeof listInvite>>, TError, TData>;
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } { }): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
@@ -340,7 +341,7 @@ export const invalidateListInvite = async (
* @summary Create invite * @summary Create invite
*/ */
export const createInvite = ( export const createInvite = (
typesPostableInviteDTO: TypesPostableInviteDTO, typesPostableInviteDTO: BodyType<TypesPostableInviteDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<CreateInvite201>({ return GeneratedAPIInstance<CreateInvite201>({
@@ -353,19 +354,19 @@ export const createInvite = (
}; };
export const getCreateInviteMutationOptions = < export const getCreateInviteMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createInvite>>, Awaited<ReturnType<typeof createInvite>>,
TError, TError,
{ data: TypesPostableInviteDTO }, { data: BodyType<TypesPostableInviteDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof createInvite>>, Awaited<ReturnType<typeof createInvite>>,
TError, TError,
{ data: TypesPostableInviteDTO }, { data: BodyType<TypesPostableInviteDTO> },
TContext TContext
> => { > => {
const mutationKey = ['createInvite']; const mutationKey = ['createInvite'];
@@ -379,7 +380,7 @@ export const getCreateInviteMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof createInvite>>, Awaited<ReturnType<typeof createInvite>>,
{ data: TypesPostableInviteDTO } { data: BodyType<TypesPostableInviteDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -392,26 +393,26 @@ export const getCreateInviteMutationOptions = <
export type CreateInviteMutationResult = NonNullable< export type CreateInviteMutationResult = NonNullable<
Awaited<ReturnType<typeof createInvite>> Awaited<ReturnType<typeof createInvite>>
>; >;
export type CreateInviteMutationBody = TypesPostableInviteDTO; export type CreateInviteMutationBody = BodyType<TypesPostableInviteDTO>;
export type CreateInviteMutationError = RenderErrorResponseDTO; export type CreateInviteMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Create invite * @summary Create invite
*/ */
export const useCreateInvite = < export const useCreateInvite = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createInvite>>, Awaited<ReturnType<typeof createInvite>>,
TError, TError,
{ data: TypesPostableInviteDTO }, { data: BodyType<TypesPostableInviteDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof createInvite>>, Awaited<ReturnType<typeof createInvite>>,
TError, TError,
{ data: TypesPostableInviteDTO }, { data: BodyType<TypesPostableInviteDTO> },
TContext TContext
> => { > => {
const mutationOptions = getCreateInviteMutationOptions(options); const mutationOptions = getCreateInviteMutationOptions(options);
@@ -430,7 +431,7 @@ export const deleteInvite = ({ id }: DeleteInvitePathParameters) => {
}; };
export const getDeleteInviteMutationOptions = < export const getDeleteInviteMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -470,13 +471,13 @@ export type DeleteInviteMutationResult = NonNullable<
Awaited<ReturnType<typeof deleteInvite>> Awaited<ReturnType<typeof deleteInvite>>
>; >;
export type DeleteInviteMutationError = RenderErrorResponseDTO; export type DeleteInviteMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Delete invite * @summary Delete invite
*/ */
export const useDeleteInvite = < export const useDeleteInvite = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -511,12 +512,12 @@ export const getInvite = (
}; };
export const getGetInviteQueryKey = ({ token }: GetInvitePathParameters) => { export const getGetInviteQueryKey = ({ token }: GetInvitePathParameters) => {
return ['getInvite'] as const; return [`/api/v1/invite/${token}`] as const;
}; };
export const getGetInviteQueryOptions = < export const getGetInviteQueryOptions = <
TData = Awaited<ReturnType<typeof getInvite>>, TData = Awaited<ReturnType<typeof getInvite>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ token }: GetInvitePathParameters, { token }: GetInvitePathParameters,
options?: { options?: {
@@ -544,7 +545,7 @@ export const getGetInviteQueryOptions = <
export type GetInviteQueryResult = NonNullable< export type GetInviteQueryResult = NonNullable<
Awaited<ReturnType<typeof getInvite>> Awaited<ReturnType<typeof getInvite>>
>; >;
export type GetInviteQueryError = RenderErrorResponseDTO; export type GetInviteQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get invite * @summary Get invite
@@ -552,7 +553,7 @@ export type GetInviteQueryError = RenderErrorResponseDTO;
export function useGetInvite< export function useGetInvite<
TData = Awaited<ReturnType<typeof getInvite>>, TData = Awaited<ReturnType<typeof getInvite>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ token }: GetInvitePathParameters, { token }: GetInvitePathParameters,
options?: { options?: {
@@ -591,7 +592,7 @@ export const invalidateGetInvite = async (
* @summary Accept invite * @summary Accept invite
*/ */
export const acceptInvite = ( export const acceptInvite = (
typesPostableAcceptInviteDTO: TypesPostableAcceptInviteDTO, typesPostableAcceptInviteDTO: BodyType<TypesPostableAcceptInviteDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<AcceptInvite201>({ return GeneratedAPIInstance<AcceptInvite201>({
@@ -604,19 +605,19 @@ export const acceptInvite = (
}; };
export const getAcceptInviteMutationOptions = < export const getAcceptInviteMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof acceptInvite>>, Awaited<ReturnType<typeof acceptInvite>>,
TError, TError,
{ data: TypesPostableAcceptInviteDTO }, { data: BodyType<TypesPostableAcceptInviteDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof acceptInvite>>, Awaited<ReturnType<typeof acceptInvite>>,
TError, TError,
{ data: TypesPostableAcceptInviteDTO }, { data: BodyType<TypesPostableAcceptInviteDTO> },
TContext TContext
> => { > => {
const mutationKey = ['acceptInvite']; const mutationKey = ['acceptInvite'];
@@ -630,7 +631,7 @@ export const getAcceptInviteMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof acceptInvite>>, Awaited<ReturnType<typeof acceptInvite>>,
{ data: TypesPostableAcceptInviteDTO } { data: BodyType<TypesPostableAcceptInviteDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -643,26 +644,26 @@ export const getAcceptInviteMutationOptions = <
export type AcceptInviteMutationResult = NonNullable< export type AcceptInviteMutationResult = NonNullable<
Awaited<ReturnType<typeof acceptInvite>> Awaited<ReturnType<typeof acceptInvite>>
>; >;
export type AcceptInviteMutationBody = TypesPostableAcceptInviteDTO; export type AcceptInviteMutationBody = BodyType<TypesPostableAcceptInviteDTO>;
export type AcceptInviteMutationError = RenderErrorResponseDTO; export type AcceptInviteMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Accept invite * @summary Accept invite
*/ */
export const useAcceptInvite = < export const useAcceptInvite = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof acceptInvite>>, Awaited<ReturnType<typeof acceptInvite>>,
TError, TError,
{ data: TypesPostableAcceptInviteDTO }, { data: BodyType<TypesPostableAcceptInviteDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof acceptInvite>>, Awaited<ReturnType<typeof acceptInvite>>,
TError, TError,
{ data: TypesPostableAcceptInviteDTO }, { data: BodyType<TypesPostableAcceptInviteDTO> },
TContext TContext
> => { > => {
const mutationOptions = getAcceptInviteMutationOptions(options); const mutationOptions = getAcceptInviteMutationOptions(options);
@@ -674,7 +675,7 @@ export const useAcceptInvite = <
* @summary Create bulk invite * @summary Create bulk invite
*/ */
export const createBulkInvite = ( export const createBulkInvite = (
typesPostableInviteDTO: TypesPostableInviteDTO[], typesPostableInviteDTO: BodyType<TypesPostableInviteDTO[]>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<void>({ return GeneratedAPIInstance<void>({
@@ -687,19 +688,19 @@ export const createBulkInvite = (
}; };
export const getCreateBulkInviteMutationOptions = < export const getCreateBulkInviteMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createBulkInvite>>, Awaited<ReturnType<typeof createBulkInvite>>,
TError, TError,
{ data: TypesPostableInviteDTO[] }, { data: BodyType<TypesPostableInviteDTO[]> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof createBulkInvite>>, Awaited<ReturnType<typeof createBulkInvite>>,
TError, TError,
{ data: TypesPostableInviteDTO[] }, { data: BodyType<TypesPostableInviteDTO[]> },
TContext TContext
> => { > => {
const mutationKey = ['createBulkInvite']; const mutationKey = ['createBulkInvite'];
@@ -713,7 +714,7 @@ export const getCreateBulkInviteMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof createBulkInvite>>, Awaited<ReturnType<typeof createBulkInvite>>,
{ data: TypesPostableInviteDTO[] } { data: BodyType<TypesPostableInviteDTO[]> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -726,26 +727,26 @@ export const getCreateBulkInviteMutationOptions = <
export type CreateBulkInviteMutationResult = NonNullable< export type CreateBulkInviteMutationResult = NonNullable<
Awaited<ReturnType<typeof createBulkInvite>> Awaited<ReturnType<typeof createBulkInvite>>
>; >;
export type CreateBulkInviteMutationBody = TypesPostableInviteDTO[]; export type CreateBulkInviteMutationBody = BodyType<TypesPostableInviteDTO[]>;
export type CreateBulkInviteMutationError = RenderErrorResponseDTO; export type CreateBulkInviteMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Create bulk invite * @summary Create bulk invite
*/ */
export const useCreateBulkInvite = < export const useCreateBulkInvite = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createBulkInvite>>, Awaited<ReturnType<typeof createBulkInvite>>,
TError, TError,
{ data: TypesPostableInviteDTO[] }, { data: BodyType<TypesPostableInviteDTO[]> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof createBulkInvite>>, Awaited<ReturnType<typeof createBulkInvite>>,
TError, TError,
{ data: TypesPostableInviteDTO[] }, { data: BodyType<TypesPostableInviteDTO[]> },
TContext TContext
> => { > => {
const mutationOptions = getCreateBulkInviteMutationOptions(options); const mutationOptions = getCreateBulkInviteMutationOptions(options);
@@ -765,12 +766,12 @@ export const listAPIKeys = (signal?: AbortSignal) => {
}; };
export const getListAPIKeysQueryKey = () => { export const getListAPIKeysQueryKey = () => {
return ['listAPIKeys'] as const; return [`/api/v1/pats`] as const;
}; };
export const getListAPIKeysQueryOptions = < export const getListAPIKeysQueryOptions = <
TData = Awaited<ReturnType<typeof listAPIKeys>>, TData = Awaited<ReturnType<typeof listAPIKeys>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof listAPIKeys>>, Awaited<ReturnType<typeof listAPIKeys>>,
@@ -796,7 +797,7 @@ export const getListAPIKeysQueryOptions = <
export type ListAPIKeysQueryResult = NonNullable< export type ListAPIKeysQueryResult = NonNullable<
Awaited<ReturnType<typeof listAPIKeys>> Awaited<ReturnType<typeof listAPIKeys>>
>; >;
export type ListAPIKeysQueryError = RenderErrorResponseDTO; export type ListAPIKeysQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary List api keys * @summary List api keys
@@ -804,7 +805,7 @@ export type ListAPIKeysQueryError = RenderErrorResponseDTO;
export function useListAPIKeys< export function useListAPIKeys<
TData = Awaited<ReturnType<typeof listAPIKeys>>, TData = Awaited<ReturnType<typeof listAPIKeys>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions< query?: UseQueryOptions<
Awaited<ReturnType<typeof listAPIKeys>>, Awaited<ReturnType<typeof listAPIKeys>>,
@@ -843,7 +844,7 @@ export const invalidateListAPIKeys = async (
* @summary Create api key * @summary Create api key
*/ */
export const createAPIKey = ( export const createAPIKey = (
typesPostableAPIKeyDTO: TypesPostableAPIKeyDTO, typesPostableAPIKeyDTO: BodyType<TypesPostableAPIKeyDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<CreateAPIKey201>({ return GeneratedAPIInstance<CreateAPIKey201>({
@@ -856,19 +857,19 @@ export const createAPIKey = (
}; };
export const getCreateAPIKeyMutationOptions = < export const getCreateAPIKeyMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createAPIKey>>, Awaited<ReturnType<typeof createAPIKey>>,
TError, TError,
{ data: TypesPostableAPIKeyDTO }, { data: BodyType<TypesPostableAPIKeyDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof createAPIKey>>, Awaited<ReturnType<typeof createAPIKey>>,
TError, TError,
{ data: TypesPostableAPIKeyDTO }, { data: BodyType<TypesPostableAPIKeyDTO> },
TContext TContext
> => { > => {
const mutationKey = ['createAPIKey']; const mutationKey = ['createAPIKey'];
@@ -882,7 +883,7 @@ export const getCreateAPIKeyMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof createAPIKey>>, Awaited<ReturnType<typeof createAPIKey>>,
{ data: TypesPostableAPIKeyDTO } { data: BodyType<TypesPostableAPIKeyDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -895,26 +896,26 @@ export const getCreateAPIKeyMutationOptions = <
export type CreateAPIKeyMutationResult = NonNullable< export type CreateAPIKeyMutationResult = NonNullable<
Awaited<ReturnType<typeof createAPIKey>> Awaited<ReturnType<typeof createAPIKey>>
>; >;
export type CreateAPIKeyMutationBody = TypesPostableAPIKeyDTO; export type CreateAPIKeyMutationBody = BodyType<TypesPostableAPIKeyDTO>;
export type CreateAPIKeyMutationError = RenderErrorResponseDTO; export type CreateAPIKeyMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Create api key * @summary Create api key
*/ */
export const useCreateAPIKey = < export const useCreateAPIKey = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createAPIKey>>, Awaited<ReturnType<typeof createAPIKey>>,
TError, TError,
{ data: TypesPostableAPIKeyDTO }, { data: BodyType<TypesPostableAPIKeyDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof createAPIKey>>, Awaited<ReturnType<typeof createAPIKey>>,
TError, TError,
{ data: TypesPostableAPIKeyDTO }, { data: BodyType<TypesPostableAPIKeyDTO> },
TContext TContext
> => { > => {
const mutationOptions = getCreateAPIKeyMutationOptions(options); const mutationOptions = getCreateAPIKeyMutationOptions(options);
@@ -933,7 +934,7 @@ export const revokeAPIKey = ({ id }: RevokeAPIKeyPathParameters) => {
}; };
export const getRevokeAPIKeyMutationOptions = < export const getRevokeAPIKeyMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -973,13 +974,13 @@ export type RevokeAPIKeyMutationResult = NonNullable<
Awaited<ReturnType<typeof revokeAPIKey>> Awaited<ReturnType<typeof revokeAPIKey>>
>; >;
export type RevokeAPIKeyMutationError = RenderErrorResponseDTO; export type RevokeAPIKeyMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Revoke api key * @summary Revoke api key
*/ */
export const useRevokeAPIKey = < export const useRevokeAPIKey = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -1004,7 +1005,7 @@ export const useRevokeAPIKey = <
*/ */
export const updateAPIKey = ( export const updateAPIKey = (
{ id }: UpdateAPIKeyPathParameters, { id }: UpdateAPIKeyPathParameters,
typesStorableAPIKeyDTO: TypesStorableAPIKeyDTO, typesStorableAPIKeyDTO: BodyType<TypesStorableAPIKeyDTO>,
) => { ) => {
return GeneratedAPIInstance<string>({ return GeneratedAPIInstance<string>({
url: `/api/v1/pats/${id}`, url: `/api/v1/pats/${id}`,
@@ -1015,19 +1016,25 @@ export const updateAPIKey = (
}; };
export const getUpdateAPIKeyMutationOptions = < export const getUpdateAPIKeyMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof updateAPIKey>>, Awaited<ReturnType<typeof updateAPIKey>>,
TError, TError,
{ pathParams: UpdateAPIKeyPathParameters; data: TypesStorableAPIKeyDTO }, {
pathParams: UpdateAPIKeyPathParameters;
data: BodyType<TypesStorableAPIKeyDTO>;
},
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof updateAPIKey>>, Awaited<ReturnType<typeof updateAPIKey>>,
TError, TError,
{ pathParams: UpdateAPIKeyPathParameters; data: TypesStorableAPIKeyDTO }, {
pathParams: UpdateAPIKeyPathParameters;
data: BodyType<TypesStorableAPIKeyDTO>;
},
TContext TContext
> => { > => {
const mutationKey = ['updateAPIKey']; const mutationKey = ['updateAPIKey'];
@@ -1041,7 +1048,10 @@ export const getUpdateAPIKeyMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof updateAPIKey>>, Awaited<ReturnType<typeof updateAPIKey>>,
{ pathParams: UpdateAPIKeyPathParameters; data: TypesStorableAPIKeyDTO } {
pathParams: UpdateAPIKeyPathParameters;
data: BodyType<TypesStorableAPIKeyDTO>;
}
> = (props) => { > = (props) => {
const { pathParams, data } = props ?? {}; const { pathParams, data } = props ?? {};
@@ -1054,26 +1064,32 @@ export const getUpdateAPIKeyMutationOptions = <
export type UpdateAPIKeyMutationResult = NonNullable< export type UpdateAPIKeyMutationResult = NonNullable<
Awaited<ReturnType<typeof updateAPIKey>> Awaited<ReturnType<typeof updateAPIKey>>
>; >;
export type UpdateAPIKeyMutationBody = TypesStorableAPIKeyDTO; export type UpdateAPIKeyMutationBody = BodyType<TypesStorableAPIKeyDTO>;
export type UpdateAPIKeyMutationError = RenderErrorResponseDTO; export type UpdateAPIKeyMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Update api key * @summary Update api key
*/ */
export const useUpdateAPIKey = < export const useUpdateAPIKey = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof updateAPIKey>>, Awaited<ReturnType<typeof updateAPIKey>>,
TError, TError,
{ pathParams: UpdateAPIKeyPathParameters; data: TypesStorableAPIKeyDTO }, {
pathParams: UpdateAPIKeyPathParameters;
data: BodyType<TypesStorableAPIKeyDTO>;
},
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof updateAPIKey>>, Awaited<ReturnType<typeof updateAPIKey>>,
TError, TError,
{ pathParams: UpdateAPIKeyPathParameters; data: TypesStorableAPIKeyDTO }, {
pathParams: UpdateAPIKeyPathParameters;
data: BodyType<TypesStorableAPIKeyDTO>;
},
TContext TContext
> => { > => {
const mutationOptions = getUpdateAPIKeyMutationOptions(options); const mutationOptions = getUpdateAPIKeyMutationOptions(options);
@@ -1085,7 +1101,7 @@ export const useUpdateAPIKey = <
* @summary Reset password * @summary Reset password
*/ */
export const resetPassword = ( export const resetPassword = (
typesPostableResetPasswordDTO: TypesPostableResetPasswordDTO, typesPostableResetPasswordDTO: BodyType<TypesPostableResetPasswordDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<void>({ return GeneratedAPIInstance<void>({
@@ -1098,19 +1114,19 @@ export const resetPassword = (
}; };
export const getResetPasswordMutationOptions = < export const getResetPasswordMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof resetPassword>>, Awaited<ReturnType<typeof resetPassword>>,
TError, TError,
{ data: TypesPostableResetPasswordDTO }, { data: BodyType<TypesPostableResetPasswordDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof resetPassword>>, Awaited<ReturnType<typeof resetPassword>>,
TError, TError,
{ data: TypesPostableResetPasswordDTO }, { data: BodyType<TypesPostableResetPasswordDTO> },
TContext TContext
> => { > => {
const mutationKey = ['resetPassword']; const mutationKey = ['resetPassword'];
@@ -1124,7 +1140,7 @@ export const getResetPasswordMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof resetPassword>>, Awaited<ReturnType<typeof resetPassword>>,
{ data: TypesPostableResetPasswordDTO } { data: BodyType<TypesPostableResetPasswordDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -1137,26 +1153,26 @@ export const getResetPasswordMutationOptions = <
export type ResetPasswordMutationResult = NonNullable< export type ResetPasswordMutationResult = NonNullable<
Awaited<ReturnType<typeof resetPassword>> Awaited<ReturnType<typeof resetPassword>>
>; >;
export type ResetPasswordMutationBody = TypesPostableResetPasswordDTO; export type ResetPasswordMutationBody = BodyType<TypesPostableResetPasswordDTO>;
export type ResetPasswordMutationError = RenderErrorResponseDTO; export type ResetPasswordMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Reset password * @summary Reset password
*/ */
export const useResetPassword = < export const useResetPassword = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof resetPassword>>, Awaited<ReturnType<typeof resetPassword>>,
TError, TError,
{ data: TypesPostableResetPasswordDTO }, { data: BodyType<TypesPostableResetPasswordDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof resetPassword>>, Awaited<ReturnType<typeof resetPassword>>,
TError, TError,
{ data: TypesPostableResetPasswordDTO }, { data: BodyType<TypesPostableResetPasswordDTO> },
TContext TContext
> => { > => {
const mutationOptions = getResetPasswordMutationOptions(options); const mutationOptions = getResetPasswordMutationOptions(options);
@@ -1176,12 +1192,12 @@ export const listUsers = (signal?: AbortSignal) => {
}; };
export const getListUsersQueryKey = () => { export const getListUsersQueryKey = () => {
return ['listUsers'] as const; return [`/api/v1/user`] as const;
}; };
export const getListUsersQueryOptions = < export const getListUsersQueryOptions = <
TData = Awaited<ReturnType<typeof listUsers>>, TData = Awaited<ReturnType<typeof listUsers>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions<Awaited<ReturnType<typeof listUsers>>, TError, TData>; query?: UseQueryOptions<Awaited<ReturnType<typeof listUsers>>, TError, TData>;
}) => { }) => {
@@ -1203,7 +1219,7 @@ export const getListUsersQueryOptions = <
export type ListUsersQueryResult = NonNullable< export type ListUsersQueryResult = NonNullable<
Awaited<ReturnType<typeof listUsers>> Awaited<ReturnType<typeof listUsers>>
>; >;
export type ListUsersQueryError = RenderErrorResponseDTO; export type ListUsersQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary List users * @summary List users
@@ -1211,7 +1227,7 @@ export type ListUsersQueryError = RenderErrorResponseDTO;
export function useListUsers< export function useListUsers<
TData = Awaited<ReturnType<typeof listUsers>>, TData = Awaited<ReturnType<typeof listUsers>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions<Awaited<ReturnType<typeof listUsers>>, TError, TData>; query?: UseQueryOptions<Awaited<ReturnType<typeof listUsers>>, TError, TData>;
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } { }): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
@@ -1253,7 +1269,7 @@ export const deleteUser = ({ id }: DeleteUserPathParameters) => {
}; };
export const getDeleteUserMutationOptions = < export const getDeleteUserMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -1293,13 +1309,13 @@ export type DeleteUserMutationResult = NonNullable<
Awaited<ReturnType<typeof deleteUser>> Awaited<ReturnType<typeof deleteUser>>
>; >;
export type DeleteUserMutationError = RenderErrorResponseDTO; export type DeleteUserMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Delete user * @summary Delete user
*/ */
export const useDeleteUser = < export const useDeleteUser = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
@@ -1334,12 +1350,12 @@ export const getUser = (
}; };
export const getGetUserQueryKey = ({ id }: GetUserPathParameters) => { export const getGetUserQueryKey = ({ id }: GetUserPathParameters) => {
return ['getUser'] as const; return [`/api/v1/user/${id}`] as const;
}; };
export const getGetUserQueryOptions = < export const getGetUserQueryOptions = <
TData = Awaited<ReturnType<typeof getUser>>, TData = Awaited<ReturnType<typeof getUser>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ id }: GetUserPathParameters, { id }: GetUserPathParameters,
options?: { options?: {
@@ -1367,7 +1383,7 @@ export const getGetUserQueryOptions = <
export type GetUserQueryResult = NonNullable< export type GetUserQueryResult = NonNullable<
Awaited<ReturnType<typeof getUser>> Awaited<ReturnType<typeof getUser>>
>; >;
export type GetUserQueryError = RenderErrorResponseDTO; export type GetUserQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get user * @summary Get user
@@ -1375,7 +1391,7 @@ export type GetUserQueryError = RenderErrorResponseDTO;
export function useGetUser< export function useGetUser<
TData = Awaited<ReturnType<typeof getUser>>, TData = Awaited<ReturnType<typeof getUser>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>( >(
{ id }: GetUserPathParameters, { id }: GetUserPathParameters,
options?: { options?: {
@@ -1415,7 +1431,7 @@ export const invalidateGetUser = async (
*/ */
export const updateUser = ( export const updateUser = (
{ id }: UpdateUserPathParameters, { id }: UpdateUserPathParameters,
typesUserDTO: TypesUserDTO, typesUserDTO: BodyType<TypesUserDTO>,
) => { ) => {
return GeneratedAPIInstance<UpdateUser200>({ return GeneratedAPIInstance<UpdateUser200>({
url: `/api/v1/user/${id}`, url: `/api/v1/user/${id}`,
@@ -1426,19 +1442,19 @@ export const updateUser = (
}; };
export const getUpdateUserMutationOptions = < export const getUpdateUserMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof updateUser>>, Awaited<ReturnType<typeof updateUser>>,
TError, TError,
{ pathParams: UpdateUserPathParameters; data: TypesUserDTO }, { pathParams: UpdateUserPathParameters; data: BodyType<TypesUserDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof updateUser>>, Awaited<ReturnType<typeof updateUser>>,
TError, TError,
{ pathParams: UpdateUserPathParameters; data: TypesUserDTO }, { pathParams: UpdateUserPathParameters; data: BodyType<TypesUserDTO> },
TContext TContext
> => { > => {
const mutationKey = ['updateUser']; const mutationKey = ['updateUser'];
@@ -1452,7 +1468,7 @@ export const getUpdateUserMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof updateUser>>, Awaited<ReturnType<typeof updateUser>>,
{ pathParams: UpdateUserPathParameters; data: TypesUserDTO } { pathParams: UpdateUserPathParameters; data: BodyType<TypesUserDTO> }
> = (props) => { > = (props) => {
const { pathParams, data } = props ?? {}; const { pathParams, data } = props ?? {};
@@ -1465,26 +1481,26 @@ export const getUpdateUserMutationOptions = <
export type UpdateUserMutationResult = NonNullable< export type UpdateUserMutationResult = NonNullable<
Awaited<ReturnType<typeof updateUser>> Awaited<ReturnType<typeof updateUser>>
>; >;
export type UpdateUserMutationBody = TypesUserDTO; export type UpdateUserMutationBody = BodyType<TypesUserDTO>;
export type UpdateUserMutationError = RenderErrorResponseDTO; export type UpdateUserMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Update user * @summary Update user
*/ */
export const useUpdateUser = < export const useUpdateUser = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof updateUser>>, Awaited<ReturnType<typeof updateUser>>,
TError, TError,
{ pathParams: UpdateUserPathParameters; data: TypesUserDTO }, { pathParams: UpdateUserPathParameters; data: BodyType<TypesUserDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof updateUser>>, Awaited<ReturnType<typeof updateUser>>,
TError, TError,
{ pathParams: UpdateUserPathParameters; data: TypesUserDTO }, { pathParams: UpdateUserPathParameters; data: BodyType<TypesUserDTO> },
TContext TContext
> => { > => {
const mutationOptions = getUpdateUserMutationOptions(options); const mutationOptions = getUpdateUserMutationOptions(options);
@@ -1504,12 +1520,12 @@ export const getMyUser = (signal?: AbortSignal) => {
}; };
export const getGetMyUserQueryKey = () => { export const getGetMyUserQueryKey = () => {
return ['getMyUser'] as const; return [`/api/v1/user/me`] as const;
}; };
export const getGetMyUserQueryOptions = < export const getGetMyUserQueryOptions = <
TData = Awaited<ReturnType<typeof getMyUser>>, TData = Awaited<ReturnType<typeof getMyUser>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions<Awaited<ReturnType<typeof getMyUser>>, TError, TData>; query?: UseQueryOptions<Awaited<ReturnType<typeof getMyUser>>, TError, TData>;
}) => { }) => {
@@ -1531,7 +1547,7 @@ export const getGetMyUserQueryOptions = <
export type GetMyUserQueryResult = NonNullable< export type GetMyUserQueryResult = NonNullable<
Awaited<ReturnType<typeof getMyUser>> Awaited<ReturnType<typeof getMyUser>>
>; >;
export type GetMyUserQueryError = RenderErrorResponseDTO; export type GetMyUserQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get my user * @summary Get my user
@@ -1539,7 +1555,7 @@ export type GetMyUserQueryError = RenderErrorResponseDTO;
export function useGetMyUser< export function useGetMyUser<
TData = Awaited<ReturnType<typeof getMyUser>>, TData = Awaited<ReturnType<typeof getMyUser>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions<Awaited<ReturnType<typeof getMyUser>>, TError, TData>; query?: UseQueryOptions<Awaited<ReturnType<typeof getMyUser>>, TError, TData>;
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } { }): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
@@ -1574,7 +1590,7 @@ export const invalidateGetMyUser = async (
* @summary Forgot password * @summary Forgot password
*/ */
export const forgotPassword = ( export const forgotPassword = (
typesPostableForgotPasswordDTO: TypesPostableForgotPasswordDTO, typesPostableForgotPasswordDTO: BodyType<TypesPostableForgotPasswordDTO>,
signal?: AbortSignal, signal?: AbortSignal,
) => { ) => {
return GeneratedAPIInstance<void>({ return GeneratedAPIInstance<void>({
@@ -1587,19 +1603,19 @@ export const forgotPassword = (
}; };
export const getForgotPasswordMutationOptions = < export const getForgotPasswordMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof forgotPassword>>, Awaited<ReturnType<typeof forgotPassword>>,
TError, TError,
{ data: TypesPostableForgotPasswordDTO }, { data: BodyType<TypesPostableForgotPasswordDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof forgotPassword>>, Awaited<ReturnType<typeof forgotPassword>>,
TError, TError,
{ data: TypesPostableForgotPasswordDTO }, { data: BodyType<TypesPostableForgotPasswordDTO> },
TContext TContext
> => { > => {
const mutationKey = ['forgotPassword']; const mutationKey = ['forgotPassword'];
@@ -1613,7 +1629,7 @@ export const getForgotPasswordMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof forgotPassword>>, Awaited<ReturnType<typeof forgotPassword>>,
{ data: TypesPostableForgotPasswordDTO } { data: BodyType<TypesPostableForgotPasswordDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -1626,26 +1642,26 @@ export const getForgotPasswordMutationOptions = <
export type ForgotPasswordMutationResult = NonNullable< export type ForgotPasswordMutationResult = NonNullable<
Awaited<ReturnType<typeof forgotPassword>> Awaited<ReturnType<typeof forgotPassword>>
>; >;
export type ForgotPasswordMutationBody = TypesPostableForgotPasswordDTO; export type ForgotPasswordMutationBody = BodyType<TypesPostableForgotPasswordDTO>;
export type ForgotPasswordMutationError = RenderErrorResponseDTO; export type ForgotPasswordMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Forgot password * @summary Forgot password
*/ */
export const useForgotPassword = < export const useForgotPassword = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof forgotPassword>>, Awaited<ReturnType<typeof forgotPassword>>,
TError, TError,
{ data: TypesPostableForgotPasswordDTO }, { data: BodyType<TypesPostableForgotPasswordDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof forgotPassword>>, Awaited<ReturnType<typeof forgotPassword>>,
TError, TError,
{ data: TypesPostableForgotPasswordDTO }, { data: BodyType<TypesPostableForgotPasswordDTO> },
TContext TContext
> => { > => {
const mutationOptions = getForgotPasswordMutationOptions(options); const mutationOptions = getForgotPasswordMutationOptions(options);

View File

@@ -17,7 +17,8 @@ import type {
} from 'react-query'; } from 'react-query';
import { useMutation, useQuery } from 'react-query'; import { useMutation, useQuery } from 'react-query';
import { GeneratedAPIInstance } from '../../../index'; import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
import type { import type {
GetHosts200, GetHosts200,
RenderErrorResponseDTO, RenderErrorResponseDTO,
@@ -42,12 +43,12 @@ export const getHosts = (signal?: AbortSignal) => {
}; };
export const getGetHostsQueryKey = () => { export const getGetHostsQueryKey = () => {
return ['getHosts'] as const; return [`/api/v2/zeus/hosts`] as const;
}; };
export const getGetHostsQueryOptions = < export const getGetHostsQueryOptions = <
TData = Awaited<ReturnType<typeof getHosts>>, TData = Awaited<ReturnType<typeof getHosts>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions<Awaited<ReturnType<typeof getHosts>>, TError, TData>; query?: UseQueryOptions<Awaited<ReturnType<typeof getHosts>>, TError, TData>;
}) => { }) => {
@@ -69,7 +70,7 @@ export const getGetHostsQueryOptions = <
export type GetHostsQueryResult = NonNullable< export type GetHostsQueryResult = NonNullable<
Awaited<ReturnType<typeof getHosts>> Awaited<ReturnType<typeof getHosts>>
>; >;
export type GetHostsQueryError = RenderErrorResponseDTO; export type GetHostsQueryError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Get host info from Zeus. * @summary Get host info from Zeus.
@@ -77,7 +78,7 @@ export type GetHostsQueryError = RenderErrorResponseDTO;
export function useGetHosts< export function useGetHosts<
TData = Awaited<ReturnType<typeof getHosts>>, TData = Awaited<ReturnType<typeof getHosts>>,
TError = RenderErrorResponseDTO TError = ErrorType<RenderErrorResponseDTO>
>(options?: { >(options?: {
query?: UseQueryOptions<Awaited<ReturnType<typeof getHosts>>, TError, TData>; query?: UseQueryOptions<Awaited<ReturnType<typeof getHosts>>, TError, TData>;
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } { }): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
@@ -111,7 +112,9 @@ export const invalidateGetHosts = async (
* This endpoint saves the host of a deployment to zeus. * This endpoint saves the host of a deployment to zeus.
* @summary Put host in Zeus for a deployment. * @summary Put host in Zeus for a deployment.
*/ */
export const putHost = (zeustypesPostableHostDTO: ZeustypesPostableHostDTO) => { export const putHost = (
zeustypesPostableHostDTO: BodyType<ZeustypesPostableHostDTO>,
) => {
return GeneratedAPIInstance<void>({ return GeneratedAPIInstance<void>({
url: `/api/v2/zeus/hosts`, url: `/api/v2/zeus/hosts`,
method: 'PUT', method: 'PUT',
@@ -121,19 +124,19 @@ export const putHost = (zeustypesPostableHostDTO: ZeustypesPostableHostDTO) => {
}; };
export const getPutHostMutationOptions = < export const getPutHostMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof putHost>>, Awaited<ReturnType<typeof putHost>>,
TError, TError,
{ data: ZeustypesPostableHostDTO }, { data: BodyType<ZeustypesPostableHostDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof putHost>>, Awaited<ReturnType<typeof putHost>>,
TError, TError,
{ data: ZeustypesPostableHostDTO }, { data: BodyType<ZeustypesPostableHostDTO> },
TContext TContext
> => { > => {
const mutationKey = ['putHost']; const mutationKey = ['putHost'];
@@ -147,7 +150,7 @@ export const getPutHostMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof putHost>>, Awaited<ReturnType<typeof putHost>>,
{ data: ZeustypesPostableHostDTO } { data: BodyType<ZeustypesPostableHostDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -160,26 +163,26 @@ export const getPutHostMutationOptions = <
export type PutHostMutationResult = NonNullable< export type PutHostMutationResult = NonNullable<
Awaited<ReturnType<typeof putHost>> Awaited<ReturnType<typeof putHost>>
>; >;
export type PutHostMutationBody = ZeustypesPostableHostDTO; export type PutHostMutationBody = BodyType<ZeustypesPostableHostDTO>;
export type PutHostMutationError = RenderErrorResponseDTO; export type PutHostMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Put host in Zeus for a deployment. * @summary Put host in Zeus for a deployment.
*/ */
export const usePutHost = < export const usePutHost = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof putHost>>, Awaited<ReturnType<typeof putHost>>,
TError, TError,
{ data: ZeustypesPostableHostDTO }, { data: BodyType<ZeustypesPostableHostDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof putHost>>, Awaited<ReturnType<typeof putHost>>,
TError, TError,
{ data: ZeustypesPostableHostDTO }, { data: BodyType<ZeustypesPostableHostDTO> },
TContext TContext
> => { > => {
const mutationOptions = getPutHostMutationOptions(options); const mutationOptions = getPutHostMutationOptions(options);
@@ -191,7 +194,7 @@ export const usePutHost = <
* @summary Put profile in Zeus for a deployment. * @summary Put profile in Zeus for a deployment.
*/ */
export const putProfile = ( export const putProfile = (
zeustypesPostableProfileDTO: ZeustypesPostableProfileDTO, zeustypesPostableProfileDTO: BodyType<ZeustypesPostableProfileDTO>,
) => { ) => {
return GeneratedAPIInstance<void>({ return GeneratedAPIInstance<void>({
url: `/api/v2/zeus/profiles`, url: `/api/v2/zeus/profiles`,
@@ -202,19 +205,19 @@ export const putProfile = (
}; };
export const getPutProfileMutationOptions = < export const getPutProfileMutationOptions = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof putProfile>>, Awaited<ReturnType<typeof putProfile>>,
TError, TError,
{ data: ZeustypesPostableProfileDTO }, { data: BodyType<ZeustypesPostableProfileDTO> },
TContext TContext
>; >;
}): UseMutationOptions< }): UseMutationOptions<
Awaited<ReturnType<typeof putProfile>>, Awaited<ReturnType<typeof putProfile>>,
TError, TError,
{ data: ZeustypesPostableProfileDTO }, { data: BodyType<ZeustypesPostableProfileDTO> },
TContext TContext
> => { > => {
const mutationKey = ['putProfile']; const mutationKey = ['putProfile'];
@@ -228,7 +231,7 @@ export const getPutProfileMutationOptions = <
const mutationFn: MutationFunction< const mutationFn: MutationFunction<
Awaited<ReturnType<typeof putProfile>>, Awaited<ReturnType<typeof putProfile>>,
{ data: ZeustypesPostableProfileDTO } { data: BodyType<ZeustypesPostableProfileDTO> }
> = (props) => { > = (props) => {
const { data } = props ?? {}; const { data } = props ?? {};
@@ -241,26 +244,26 @@ export const getPutProfileMutationOptions = <
export type PutProfileMutationResult = NonNullable< export type PutProfileMutationResult = NonNullable<
Awaited<ReturnType<typeof putProfile>> Awaited<ReturnType<typeof putProfile>>
>; >;
export type PutProfileMutationBody = ZeustypesPostableProfileDTO; export type PutProfileMutationBody = BodyType<ZeustypesPostableProfileDTO>;
export type PutProfileMutationError = RenderErrorResponseDTO; export type PutProfileMutationError = ErrorType<RenderErrorResponseDTO>;
/** /**
* @summary Put profile in Zeus for a deployment. * @summary Put profile in Zeus for a deployment.
*/ */
export const usePutProfile = < export const usePutProfile = <
TError = RenderErrorResponseDTO, TError = ErrorType<RenderErrorResponseDTO>,
TContext = unknown TContext = unknown
>(options?: { >(options?: {
mutation?: UseMutationOptions< mutation?: UseMutationOptions<
Awaited<ReturnType<typeof putProfile>>, Awaited<ReturnType<typeof putProfile>>,
TError, TError,
{ data: ZeustypesPostableProfileDTO }, { data: BodyType<ZeustypesPostableProfileDTO> },
TContext TContext
>; >;
}): UseMutationResult< }): UseMutationResult<
Awaited<ReturnType<typeof putProfile>>, Awaited<ReturnType<typeof putProfile>>,
TError, TError,
{ data: ZeustypesPostableProfileDTO }, { data: BodyType<ZeustypesPostableProfileDTO> },
TContext TContext
> => { > => {
const mutationOptions = getPutProfileMutationOptions(options); const mutationOptions = getPutProfileMutationOptions(options);

View File

@@ -0,0 +1,27 @@
import {
interceptorRejected,
interceptorsRequestResponse,
interceptorsResponse,
} from 'api';
import axios, { AxiosError, AxiosRequestConfig } from 'axios';
import { ENVIRONMENT } from 'constants/env';
// generated API Instance
const generatedAPIAxiosInstance = axios.create({
baseURL: ENVIRONMENT.baseURL,
});
export const GeneratedAPIInstance = <T>(
config: AxiosRequestConfig,
): Promise<T> => {
return generatedAPIAxiosInstance({ ...config }).then(({ data }) => data);
};
generatedAPIAxiosInstance.interceptors.request.use(interceptorsRequestResponse);
generatedAPIAxiosInstance.interceptors.response.use(
interceptorsResponse,
interceptorRejected,
);
export type ErrorType<Error> = AxiosError<Error>;
export type BodyType<BodyData> = BodyData;

View File

@@ -28,7 +28,7 @@ const queryClient = new QueryClient({
}, },
}); });
const interceptorsResponse = ( export const interceptorsResponse = (
value: AxiosResponse<any>, value: AxiosResponse<any>,
): Promise<AxiosResponse<any>> => { ): Promise<AxiosResponse<any>> => {
if ((value.config as any)?.metadata) { if ((value.config as any)?.metadata) {
@@ -51,7 +51,7 @@ const interceptorsResponse = (
return Promise.resolve(value); return Promise.resolve(value);
}; };
const interceptorsRequestResponse = ( export const interceptorsRequestResponse = (
value: InternalAxiosRequestConfig, value: InternalAxiosRequestConfig,
): InternalAxiosRequestConfig => { ): InternalAxiosRequestConfig => {
// Attach metadata safely (not sent with the request) // Attach metadata safely (not sent with the request)
@@ -69,7 +69,7 @@ const interceptorsRequestResponse = (
return value; return value;
}; };
const interceptorRejected = async ( export const interceptorRejected = async (
value: AxiosResponse<any>, value: AxiosResponse<any>,
): Promise<AxiosResponse<any>> => { ): Promise<AxiosResponse<any>> => {
try { try {
@@ -203,17 +203,6 @@ LogEventAxiosInstance.interceptors.response.use(
LogEventAxiosInstance.interceptors.request.use(interceptorsRequestResponse); LogEventAxiosInstance.interceptors.request.use(interceptorsRequestResponse);
// //
// generated API Instance
export const GeneratedAPIInstance = axios.create({
baseURL: ENVIRONMENT.baseURL,
});
GeneratedAPIInstance.interceptors.request.use(interceptorsRequestResponse);
GeneratedAPIInstance.interceptors.response.use(
interceptorsResponse,
interceptorRejected,
);
AxiosAlertManagerInstance.interceptors.response.use( AxiosAlertManagerInstance.interceptors.response.use(
interceptorsResponse, interceptorsResponse,
interceptorRejected, interceptorRejected,

View File

@@ -1,4 +1,5 @@
import { UniversalYAxisUnit } from '../types'; import { YAxisCategoryNames } from '../constants';
import { UniversalYAxisUnit, YAxisCategory } from '../types';
import { import {
getUniversalNameFromMetricUnit, getUniversalNameFromMetricUnit,
mapMetricUnitToUniversalUnit, mapMetricUnitToUniversalUnit,
@@ -41,29 +42,29 @@ describe('YAxisUnitSelector utils', () => {
describe('mergeCategories', () => { describe('mergeCategories', () => {
it('merges categories correctly', () => { it('merges categories correctly', () => {
const categories1 = [ const categories1: YAxisCategory[] = [
{ {
name: 'Data', name: YAxisCategoryNames.Data,
units: [ units: [
{ name: 'bytes', id: UniversalYAxisUnit.BYTES }, { name: 'bytes', id: UniversalYAxisUnit.BYTES },
{ name: 'kilobytes', id: UniversalYAxisUnit.KILOBYTES }, { name: 'kilobytes', id: UniversalYAxisUnit.KILOBYTES },
], ],
}, },
]; ];
const categories2 = [ const categories2: YAxisCategory[] = [
{ {
name: 'Data', name: YAxisCategoryNames.Data,
units: [{ name: 'bits', id: UniversalYAxisUnit.BITS }], units: [{ name: 'bits', id: UniversalYAxisUnit.BITS }],
}, },
{ {
name: 'Time', name: YAxisCategoryNames.Time,
units: [{ name: 'seconds', id: UniversalYAxisUnit.SECONDS }], units: [{ name: 'seconds', id: UniversalYAxisUnit.SECONDS }],
}, },
]; ];
const mergedCategories = mergeCategories(categories1, categories2); const mergedCategories = mergeCategories(categories1, categories2);
expect(mergedCategories).toEqual([ expect(mergedCategories).toEqual([
{ {
name: 'Data', name: YAxisCategoryNames.Data,
units: [ units: [
{ name: 'bytes', id: UniversalYAxisUnit.BYTES }, { name: 'bytes', id: UniversalYAxisUnit.BYTES },
{ name: 'kilobytes', id: UniversalYAxisUnit.KILOBYTES }, { name: 'kilobytes', id: UniversalYAxisUnit.KILOBYTES },
@@ -71,7 +72,7 @@ describe('YAxisUnitSelector utils', () => {
], ],
}, },
{ {
name: 'Time', name: YAxisCategoryNames.Time,
units: [{ name: 'seconds', id: UniversalYAxisUnit.SECONDS }], units: [{ name: 'seconds', id: UniversalYAxisUnit.SECONDS }],
}, },
]); ]);

View File

@@ -1,5 +1,36 @@
import { UnitFamilyConfig, UniversalYAxisUnit, YAxisUnit } from './types'; import { UnitFamilyConfig, UniversalYAxisUnit, YAxisUnit } from './types';
export enum YAxisCategoryNames {
Time = 'Time',
Data = 'Data',
DataRate = 'Data Rate',
Count = 'Count',
Operations = 'Operations',
Percentage = 'Percentage',
Boolean = 'Boolean',
None = 'None',
HashRate = 'Hash Rate',
Miscellaneous = 'Miscellaneous',
Acceleration = 'Acceleration',
Angular = 'Angular',
Area = 'Area',
Flops = 'FLOPs',
Concentration = 'Concentration',
Currency = 'Currency',
Datetime = 'Datetime',
PowerElectrical = 'Power/Electrical',
Flow = 'Flow',
Force = 'Force',
Mass = 'Mass',
Length = 'Length',
Pressure = 'Pressure',
Radiation = 'Radiation',
RotationSpeed = 'Rotation Speed',
Temperature = 'Temperature',
Velocity = 'Velocity',
Volume = 'Volume',
}
// Mapping of universal y-axis units to their AWS, UCUM, and OpenMetrics equivalents (if available) // Mapping of universal y-axis units to their AWS, UCUM, and OpenMetrics equivalents (if available)
export const UniversalYAxisUnitMappings: Partial< export const UniversalYAxisUnitMappings: Partial<
Record<UniversalYAxisUnit, Set<YAxisUnit> | null> Record<UniversalYAxisUnit, Set<YAxisUnit> | null>

View File

@@ -1,10 +1,11 @@
import { Y_AXIS_UNIT_NAMES } from './constants'; import { Y_AXIS_UNIT_NAMES } from './constants';
import { YAxisCategoryNames } from './constants';
import { UniversalYAxisUnit, YAxisCategory } from './types'; import { UniversalYAxisUnit, YAxisCategory } from './types';
// Base categories for the universal y-axis units // Base categories for the universal y-axis units
export const BASE_Y_AXIS_CATEGORIES: YAxisCategory[] = [ export const BASE_Y_AXIS_CATEGORIES: YAxisCategory[] = [
{ {
name: 'Time', name: YAxisCategoryNames.Time,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.SECONDS], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.SECONDS],
@@ -37,7 +38,7 @@ export const BASE_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Data', name: YAxisCategoryNames.Data,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.BYTES], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.BYTES],
@@ -154,7 +155,7 @@ export const BASE_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Data Rate', name: YAxisCategoryNames.DataRate,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.BYTES_SECOND], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.BYTES_SECOND],
@@ -295,7 +296,7 @@ export const BASE_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Count', name: YAxisCategoryNames.Count,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.COUNT], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.COUNT],
@@ -312,7 +313,7 @@ export const BASE_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Operations', name: YAxisCategoryNames.Operations,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.OPS_SECOND], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.OPS_SECOND],
@@ -353,7 +354,7 @@ export const BASE_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Percentage', name: YAxisCategoryNames.Percentage,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.PERCENT], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.PERCENT],
@@ -366,7 +367,7 @@ export const BASE_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Boolean', name: YAxisCategoryNames.Boolean,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.TRUE_FALSE], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.TRUE_FALSE],
@@ -382,7 +383,7 @@ export const BASE_Y_AXIS_CATEGORIES: YAxisCategory[] = [
export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
{ {
name: 'Time', name: YAxisCategoryNames.Time,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.DURATION_MS], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.DURATION_MS],
@@ -419,7 +420,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Data Rate', name: YAxisCategoryNames.DataRate,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.DATA_RATE_PACKETS_PER_SECOND], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.DATA_RATE_PACKETS_PER_SECOND],
@@ -428,7 +429,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Boolean', name: YAxisCategoryNames.Boolean,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.ON_OFF], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.ON_OFF],
@@ -437,7 +438,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'None', name: YAxisCategoryNames.None,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.NONE], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.NONE],
@@ -446,7 +447,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Hash Rate', name: YAxisCategoryNames.HashRate,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.HASH_RATE_HASHES_PER_SECOND], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.HASH_RATE_HASHES_PER_SECOND],
@@ -479,7 +480,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Miscellaneous', name: YAxisCategoryNames.Miscellaneous,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.MISC_STRING], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.MISC_STRING],
@@ -520,7 +521,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Acceleration', name: YAxisCategoryNames.Acceleration,
units: [ units: [
{ {
name: name:
@@ -541,7 +542,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Angular', name: YAxisCategoryNames.Angular,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.ANGULAR_DEGREE], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.ANGULAR_DEGREE],
@@ -566,7 +567,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Area', name: YAxisCategoryNames.Area,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.AREA_SQUARE_METERS], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.AREA_SQUARE_METERS],
@@ -583,7 +584,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'FLOPs', name: YAxisCategoryNames.Flops,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.FLOPS_FLOPS], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.FLOPS_FLOPS],
@@ -620,7 +621,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Concentration', name: YAxisCategoryNames.Concentration,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.CONCENTRATION_PPM], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.CONCENTRATION_PPM],
@@ -677,7 +678,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Currency', name: YAxisCategoryNames.Currency,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.CURRENCY_USD], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.CURRENCY_USD],
@@ -774,7 +775,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Datetime', name: YAxisCategoryNames.Datetime,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.DATETIME_ISO], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.DATETIME_ISO],
@@ -811,7 +812,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Power/Electrical', name: YAxisCategoryNames.PowerElectrical,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.POWER_WATT], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.POWER_WATT],
@@ -968,7 +969,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Flow', name: YAxisCategoryNames.Flow,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.FLOW_GALLONS_PER_MINUTE], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.FLOW_GALLONS_PER_MINUTE],
@@ -1005,7 +1006,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Force', name: YAxisCategoryNames.Force,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.FORCE_NEWTON_METERS], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.FORCE_NEWTON_METERS],
@@ -1026,7 +1027,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Mass', name: YAxisCategoryNames.Mass,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.MASS_MILLIGRAM], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.MASS_MILLIGRAM],
@@ -1051,7 +1052,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Length', name: YAxisCategoryNames.Length,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.LENGTH_MILLIMETER], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.LENGTH_MILLIMETER],
@@ -1080,7 +1081,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Pressure', name: YAxisCategoryNames.Pressure,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.PRESSURE_MILLIBAR], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.PRESSURE_MILLIBAR],
@@ -1117,7 +1118,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Radiation', name: YAxisCategoryNames.Radiation,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.RADIATION_BECQUEREL], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.RADIATION_BECQUEREL],
@@ -1174,7 +1175,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Rotation Speed', name: YAxisCategoryNames.RotationSpeed,
units: [ units: [
{ {
name: name:
@@ -1200,7 +1201,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Temperature', name: YAxisCategoryNames.Temperature,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.TEMPERATURE_CELSIUS], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.TEMPERATURE_CELSIUS],
@@ -1217,7 +1218,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Velocity', name: YAxisCategoryNames.Velocity,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.VELOCITY_METERS_PER_SECOND], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.VELOCITY_METERS_PER_SECOND],
@@ -1238,7 +1239,7 @@ export const ADDITIONAL_Y_AXIS_CATEGORIES: YAxisCategory[] = [
], ],
}, },
{ {
name: 'Volume', name: YAxisCategoryNames.Volume,
units: [ units: [
{ {
name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.VOLUME_MILLILITER], name: Y_AXIS_UNIT_NAMES[UniversalYAxisUnit.VOLUME_MILLILITER],

View File

@@ -1,3 +1,5 @@
import { YAxisCategoryNames } from './constants';
export interface YAxisUnitSelectorProps { export interface YAxisUnitSelectorProps {
value: string | undefined; value: string | undefined;
onChange: (value: UniversalYAxisUnit) => void; onChange: (value: UniversalYAxisUnit) => void;
@@ -669,7 +671,7 @@ export interface UnitFamilyConfig {
} }
export interface YAxisCategory { export interface YAxisCategory {
name: string; name: YAxisCategoryNames;
units: { units: {
name: string; name: string;
id: UniversalYAxisUnit; id: UniversalYAxisUnit;

View File

@@ -81,14 +81,14 @@ export default function CustomDomainSettings(): JSX.Element {
}, [hosts]); }, [hosts]);
useEffect(() => { useEffect(() => {
if (isFetchingHosts) { if (isFetchingHosts || !hostsData) {
return; return;
} }
if (hostsData?.data?.status === 'success') { if (hostsData.status === 'success') {
setHosts(hostsData?.data?.data?.hosts ?? null); setHosts(hostsData.data.hosts ?? null);
const activeCustomDomain = hostsData?.data?.data?.hosts?.find( const activeCustomDomain = hostsData.data.hosts?.find(
(host) => !host.is_default, (host) => !host.is_default,
); );
@@ -99,13 +99,13 @@ export default function CustomDomainSettings(): JSX.Element {
} }
} }
if (hostsData?.data?.data?.state !== 'HEALTHY' && isPollingEnabled) { if (hostsData.data.state !== 'HEALTHY' && isPollingEnabled) {
setTimeout(() => { setTimeout(() => {
refetchHosts(); refetchHosts();
}, 3000); }, 3000);
} }
if (hostsData?.data?.data?.state === 'HEALTHY') { if (hostsData.data.state === 'HEALTHY') {
setIsPollingEnabled(false); setIsPollingEnabled(false);
} }
}, [hostsData, refetchHosts, isPollingEnabled, isFetchingHosts]); }, [hostsData, refetchHosts, isPollingEnabled, isFetchingHosts]);

View File

@@ -172,23 +172,51 @@ function ExplorerOptions({
const { user } = useAppContext(); const { user } = useAppContext();
const handleConditionalQueryModification = useCallback( const handleConditionalQueryModification = useCallback(
// eslint-disable-next-line sonarjs/cognitive-complexity
(defaultQuery: Query | null): string => { (defaultQuery: Query | null): string => {
const queryToUse = defaultQuery || query; const queryToUse = defaultQuery || query;
if (!queryToUse) {
throw new Error('No query provided');
}
if ( if (
queryToUse?.builder?.queryData?.[0]?.aggregateOperator !== queryToUse?.builder?.queryData?.[0]?.aggregateOperator !==
StringOperators.NOOP StringOperators.NOOP &&
sourcepage !== DataSource.LOGS
) { ) {
return JSON.stringify(queryToUse); return JSON.stringify(queryToUse);
} }
// Modify aggregateOperator to count, as noop is not supported in alerts // Convert NOOP to COUNT for alerts and strip orderBy for logs
const modifiedQuery = cloneDeep(queryToUse); const modifiedQuery = cloneDeep(queryToUse);
if (modifiedQuery && modifiedQuery.builder?.queryData) {
modifiedQuery.builder.queryData = modifiedQuery.builder.queryData.map(
(item) => {
const updatedItem = { ...item };
modifiedQuery.builder.queryData[0].aggregateOperator = StringOperators.COUNT; if (updatedItem.aggregateOperator === StringOperators.NOOP) {
updatedItem.aggregateOperator = StringOperators.COUNT;
}
return JSON.stringify(modifiedQuery); // Alerts do not support order by on logs explorer queries
if (sourcepage === DataSource.LOGS && panelType === PANEL_TYPES.LIST) {
updatedItem.orderBy = [];
}
return updatedItem;
},
);
}
try {
return JSON.stringify(modifiedQuery);
} catch (err) {
throw new Error(
'Failed to stringify modified query: ' +
(err instanceof Error ? err.message : String(err)),
);
}
}, },
[query], [panelType, query, sourcepage],
); );
const onCreateAlertsHandler = useCallback( const onCreateAlertsHandler = useCallback(
@@ -757,9 +785,9 @@ function ExplorerOptions({
); );
}, [ }, [
disabled, disabled,
query,
isOneChartPerQuery, isOneChartPerQuery,
onCreateAlertsHandler, onCreateAlertsHandler,
query,
splitedQueries, splitedQueries,
]); ]);

View File

@@ -1,3 +1,4 @@
import { useHistory } from 'react-router-dom';
import { PANEL_TYPES } from 'constants/queryBuilder'; import { PANEL_TYPES } from 'constants/queryBuilder';
import { MOCK_QUERY } from 'container/QueryTable/Drilldown/__tests__/mockTableData'; import { MOCK_QUERY } from 'container/QueryTable/Drilldown/__tests__/mockTableData';
import { useUpdateDashboard } from 'hooks/dashboard/useUpdateDashboard'; import { useUpdateDashboard } from 'hooks/dashboard/useUpdateDashboard';
@@ -15,6 +16,11 @@ import { getExplorerToolBarVisibility } from '../utils';
// Mock dependencies // Mock dependencies
jest.mock('hooks/dashboard/useUpdateDashboard'); jest.mock('hooks/dashboard/useUpdateDashboard');
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useHistory: jest.fn(),
}));
jest.mock('../utils', () => ({ jest.mock('../utils', () => ({
getExplorerToolBarVisibility: jest.fn(), getExplorerToolBarVisibility: jest.fn(),
generateRGBAFromHex: jest.fn(() => 'rgba(0, 0, 0, 0.08)'), generateRGBAFromHex: jest.fn(() => 'rgba(0, 0, 0, 0.08)'),
@@ -29,6 +35,7 @@ const mockGetExplorerToolBarVisibility = jest.mocked(
); );
const mockUseUpdateDashboard = jest.mocked(useUpdateDashboard); const mockUseUpdateDashboard = jest.mocked(useUpdateDashboard);
const mockUseHistory = jest.mocked(useHistory);
// Mock data // Mock data
const TEST_QUERY_ID = 'test-query-id'; const TEST_QUERY_ID = 'test-query-id';
@@ -103,7 +110,6 @@ describe('ExplorerOptionWrapper', () => {
beforeEach(() => { beforeEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
mockGetExplorerToolBarVisibility.mockReturnValue(true); mockGetExplorerToolBarVisibility.mockReturnValue(true);
// Mock useUpdateDashboard to return a mutation object // Mock useUpdateDashboard to return a mutation object
mockUseUpdateDashboard.mockReturnValue(({ mockUseUpdateDashboard.mockReturnValue(({
mutate: jest.fn(), mutate: jest.fn(),
@@ -117,6 +123,28 @@ describe('ExplorerOptionWrapper', () => {
} as unknown) as ReturnType<typeof useUpdateDashboard>); } as unknown) as ReturnType<typeof useUpdateDashboard>);
}); });
it('should navigate to alert creation page when "Create an Alert" is clicked in logs-explorer', async () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
const mockPush = jest.fn();
mockUseHistory.mockReturnValue(({
push: mockPush,
} as unknown) as ReturnType<typeof useHistory>);
renderExplorerOptionWrapper({ sourcepage: DataSource.LOGS });
const createAlertButton = screen.getByRole('button', {
name: 'Create an Alert',
});
await user.click(createAlertButton);
expect(mockPush).toHaveBeenCalledTimes(1);
const calledWith = mockPush.mock.calls[0][0] as string;
const [path, search = ''] = calledWith.split('?');
expect(path).toBe('/alerts/new');
const params = new URLSearchParams(search);
expect(params.has('compositeQuery')).toBe(true);
});
describe('onExport functionality', () => { describe('onExport functionality', () => {
it('should call onExport when New Dashboard button is clicked in export modal', async () => { it('should call onExport when New Dashboard button is clicked in export modal', async () => {
const user = userEvent.setup({ pointerEventsCheck: 0 }); const user = userEvent.setup({ pointerEventsCheck: 0 });

View File

@@ -3,13 +3,11 @@ import { Button } from '@signozhq/button';
import { ArrowLeft, ArrowRight } from '@signozhq/icons'; import { ArrowLeft, ArrowRight } from '@signozhq/icons';
import { Input } from '@signozhq/input'; import { Input } from '@signozhq/input';
import { Form, Select } from 'antd'; import { Form, Select } from 'antd';
import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2'; import { ErrorResponseHandlerForGeneratedAPIs } from 'api/ErrorResponseHandlerForGeneratedAPIs';
import { useForgotPassword } from 'api/generated/services/users'; import { useForgotPassword } from 'api/generated/services/users';
import { AxiosError } from 'axios';
import AuthError from 'components/AuthError/AuthError'; import AuthError from 'components/AuthError/AuthError';
import ROUTES from 'constants/routes'; import ROUTES from 'constants/routes';
import history from 'lib/history'; import history from 'lib/history';
import { ErrorV2Resp } from 'types/api';
import APIError from 'types/api/error'; import APIError from 'types/api/error';
import { OrgSessionContext } from 'types/api/v2/sessions/context/get'; import { OrgSessionContext } from 'types/api/v2/sessions/context/get';
@@ -48,7 +46,7 @@ function ForgotPassword({
} }
try { try {
ErrorResponseHandlerV2(mutationError as AxiosError<ErrorV2Resp>); ErrorResponseHandlerForGeneratedAPIs(mutationError);
} catch (apiError) { } catch (apiError) {
return apiError as APIError; return apiError as APIError;
} }

View File

@@ -34,7 +34,7 @@ function DataSourceInfo({
useEffect(() => { useEffect(() => {
if (hostsData) { if (hostsData) {
const defaultHost = hostsData?.data?.data?.hosts?.find((h) => h.is_default); const defaultHost = hostsData?.data.hosts?.find((h) => h.is_default);
if (defaultHost?.url) { if (defaultHost?.url) {
const url = defaultHost?.url?.split('://')[1] ?? ''; const url = defaultHost?.url?.split('://')[1] ?? '';
setUrl(url); setUrl(url);

View File

@@ -27,7 +27,7 @@ import { GlobalReducer } from 'types/reducer/globalTime';
import { FeatureKeys } from '../../../constants/features'; import { FeatureKeys } from '../../../constants/features';
import { useAppContext } from '../../../providers/App/App'; import { useAppContext } from '../../../providers/App/App';
import { getOrderByFromParams } from '../commonUtils'; import { getOrderByFromParams, safeParseJSON } from '../commonUtils';
import { import {
GetK8sEntityToAggregateAttribute, GetK8sEntityToAggregateAttribute,
INFRA_MONITORING_K8S_PARAMS_KEYS, INFRA_MONITORING_K8S_PARAMS_KEYS,
@@ -103,9 +103,10 @@ function K8sClustersList({
const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => { const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => {
const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY); const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY);
if (groupBy) { if (groupBy) {
const decoded = decodeURIComponent(groupBy); const parsed = safeParseJSON<IBuilderQuery['groupBy']>(groupBy);
const parsed = JSON.parse(decoded); if (parsed) {
return parsed as IBuilderQuery['groupBy']; return parsed;
}
} }
return []; return [];
}); });

View File

@@ -28,7 +28,7 @@ import { GlobalReducer } from 'types/reducer/globalTime';
import { FeatureKeys } from '../../../constants/features'; import { FeatureKeys } from '../../../constants/features';
import { useAppContext } from '../../../providers/App/App'; import { useAppContext } from '../../../providers/App/App';
import { getOrderByFromParams } from '../commonUtils'; import { getOrderByFromParams, safeParseJSON } from '../commonUtils';
import { import {
GetK8sEntityToAggregateAttribute, GetK8sEntityToAggregateAttribute,
INFRA_MONITORING_K8S_PARAMS_KEYS, INFRA_MONITORING_K8S_PARAMS_KEYS,
@@ -105,9 +105,10 @@ function K8sDaemonSetsList({
const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => { const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => {
const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY); const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY);
if (groupBy) { if (groupBy) {
const decoded = decodeURIComponent(groupBy); const parsed = safeParseJSON<IBuilderQuery['groupBy']>(groupBy);
const parsed = JSON.parse(decoded); if (parsed) {
return parsed as IBuilderQuery['groupBy']; return parsed;
}
} }
return []; return [];
}); });

View File

@@ -28,7 +28,7 @@ import { GlobalReducer } from 'types/reducer/globalTime';
import { FeatureKeys } from '../../../constants/features'; import { FeatureKeys } from '../../../constants/features';
import { useAppContext } from '../../../providers/App/App'; import { useAppContext } from '../../../providers/App/App';
import { getOrderByFromParams } from '../commonUtils'; import { getOrderByFromParams, safeParseJSON } from '../commonUtils';
import { import {
GetK8sEntityToAggregateAttribute, GetK8sEntityToAggregateAttribute,
INFRA_MONITORING_K8S_PARAMS_KEYS, INFRA_MONITORING_K8S_PARAMS_KEYS,
@@ -106,9 +106,10 @@ function K8sDeploymentsList({
const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => { const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => {
const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY); const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY);
if (groupBy) { if (groupBy) {
const decoded = decodeURIComponent(groupBy); const parsed = safeParseJSON<IBuilderQuery['groupBy']>(groupBy);
const parsed = JSON.parse(decoded); if (parsed) {
return parsed as IBuilderQuery['groupBy']; return parsed;
}
} }
return []; return [];
}); });

View File

@@ -28,7 +28,7 @@ import { GlobalReducer } from 'types/reducer/globalTime';
import { FeatureKeys } from '../../../constants/features'; import { FeatureKeys } from '../../../constants/features';
import { useAppContext } from '../../../providers/App/App'; import { useAppContext } from '../../../providers/App/App';
import { getOrderByFromParams } from '../commonUtils'; import { getOrderByFromParams, safeParseJSON } from '../commonUtils';
import { import {
GetK8sEntityToAggregateAttribute, GetK8sEntityToAggregateAttribute,
INFRA_MONITORING_K8S_PARAMS_KEYS, INFRA_MONITORING_K8S_PARAMS_KEYS,
@@ -101,9 +101,10 @@ function K8sJobsList({
const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => { const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => {
const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY); const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY);
if (groupBy) { if (groupBy) {
const decoded = decodeURIComponent(groupBy); const parsed = safeParseJSON<IBuilderQuery['groupBy']>(groupBy);
const parsed = JSON.parse(decoded); if (parsed) {
return parsed as IBuilderQuery['groupBy']; return parsed;
}
} }
return []; return [];
}); });

View File

@@ -10,6 +10,7 @@ import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteRe
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData'; import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
import { DataSource } from 'types/common/queryBuilder'; import { DataSource } from 'types/common/queryBuilder';
import { safeParseJSON } from './commonUtils';
import { INFRA_MONITORING_K8S_PARAMS_KEYS, K8sCategory } from './constants'; import { INFRA_MONITORING_K8S_PARAMS_KEYS, K8sCategory } from './constants';
import K8sFiltersSidePanel from './K8sFiltersSidePanel/K8sFiltersSidePanel'; import K8sFiltersSidePanel from './K8sFiltersSidePanel/K8sFiltersSidePanel';
import { IEntityColumn } from './utils'; import { IEntityColumn } from './utils';
@@ -58,9 +59,10 @@ function K8sHeader({
const urlFilters = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.FILTERS); const urlFilters = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.FILTERS);
let { filters } = currentQuery.builder.queryData[0]; let { filters } = currentQuery.builder.queryData[0];
if (urlFilters) { if (urlFilters) {
const decoded = decodeURIComponent(urlFilters); const parsed = safeParseJSON<IBuilderQuery['filters']>(urlFilters);
const parsed = JSON.parse(decoded); if (parsed) {
filters = parsed; filters = parsed;
}
} }
return { return {
...currentQuery, ...currentQuery,

View File

@@ -27,7 +27,7 @@ import { GlobalReducer } from 'types/reducer/globalTime';
import { FeatureKeys } from '../../../constants/features'; import { FeatureKeys } from '../../../constants/features';
import { useAppContext } from '../../../providers/App/App'; import { useAppContext } from '../../../providers/App/App';
import { getOrderByFromParams } from '../commonUtils'; import { getOrderByFromParams, safeParseJSON } from '../commonUtils';
import { import {
GetK8sEntityToAggregateAttribute, GetK8sEntityToAggregateAttribute,
INFRA_MONITORING_K8S_PARAMS_KEYS, INFRA_MONITORING_K8S_PARAMS_KEYS,
@@ -104,9 +104,10 @@ function K8sNamespacesList({
const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => { const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => {
const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY); const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY);
if (groupBy) { if (groupBy) {
const decoded = decodeURIComponent(groupBy); const parsed = safeParseJSON<IBuilderQuery['groupBy']>(groupBy);
const parsed = JSON.parse(decoded); if (parsed) {
return parsed as IBuilderQuery['groupBy']; return parsed;
}
} }
return []; return [];
}); });

View File

@@ -27,7 +27,7 @@ import { GlobalReducer } from 'types/reducer/globalTime';
import { FeatureKeys } from '../../../constants/features'; import { FeatureKeys } from '../../../constants/features';
import { useAppContext } from '../../../providers/App/App'; import { useAppContext } from '../../../providers/App/App';
import { getOrderByFromParams } from '../commonUtils'; import { getOrderByFromParams, safeParseJSON } from '../commonUtils';
import { import {
GetK8sEntityToAggregateAttribute, GetK8sEntityToAggregateAttribute,
INFRA_MONITORING_K8S_PARAMS_KEYS, INFRA_MONITORING_K8S_PARAMS_KEYS,
@@ -99,9 +99,10 @@ function K8sNodesList({
const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => { const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => {
const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY); const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY);
if (groupBy) { if (groupBy) {
const decoded = decodeURIComponent(groupBy); const parsed = safeParseJSON<IBuilderQuery['groupBy']>(groupBy);
const parsed = JSON.parse(decoded); if (parsed) {
return parsed as IBuilderQuery['groupBy']; return parsed;
}
} }
return []; return [];
}); });

View File

@@ -29,7 +29,7 @@ import { GlobalReducer } from 'types/reducer/globalTime';
import { FeatureKeys } from '../../../constants/features'; import { FeatureKeys } from '../../../constants/features';
import { useAppContext } from '../../../providers/App/App'; import { useAppContext } from '../../../providers/App/App';
import { getOrderByFromParams } from '../commonUtils'; import { getOrderByFromParams, safeParseJSON } from '../commonUtils';
import { import {
GetK8sEntityToAggregateAttribute, GetK8sEntityToAggregateAttribute,
INFRA_MONITORING_K8S_PARAMS_KEYS, INFRA_MONITORING_K8S_PARAMS_KEYS,
@@ -92,9 +92,10 @@ function K8sPodsList({
const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => { const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => {
const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY); const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY);
if (groupBy) { if (groupBy) {
const decoded = decodeURIComponent(groupBy); const parsed = safeParseJSON<IBuilderQuery['groupBy']>(groupBy);
const parsed = JSON.parse(decoded); if (parsed) {
return parsed as IBuilderQuery['groupBy']; return parsed;
}
} }
return []; return [];
}); });

View File

@@ -28,7 +28,7 @@ import { GlobalReducer } from 'types/reducer/globalTime';
import { FeatureKeys } from '../../../constants/features'; import { FeatureKeys } from '../../../constants/features';
import { useAppContext } from '../../../providers/App/App'; import { useAppContext } from '../../../providers/App/App';
import { getOrderByFromParams } from '../commonUtils'; import { getOrderByFromParams, safeParseJSON } from '../commonUtils';
import { import {
GetK8sEntityToAggregateAttribute, GetK8sEntityToAggregateAttribute,
INFRA_MONITORING_K8S_PARAMS_KEYS, INFRA_MONITORING_K8S_PARAMS_KEYS,
@@ -105,9 +105,10 @@ function K8sStatefulSetsList({
const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => { const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => {
const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY); const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY);
if (groupBy) { if (groupBy) {
const decoded = decodeURIComponent(groupBy); const parsed = safeParseJSON<IBuilderQuery['groupBy']>(groupBy);
const parsed = JSON.parse(decoded); if (parsed) {
return parsed as IBuilderQuery['groupBy']; return parsed;
}
} }
return []; return [];
}); });

View File

@@ -28,7 +28,7 @@ import { GlobalReducer } from 'types/reducer/globalTime';
import { FeatureKeys } from '../../../constants/features'; import { FeatureKeys } from '../../../constants/features';
import { useAppContext } from '../../../providers/App/App'; import { useAppContext } from '../../../providers/App/App';
import { getOrderByFromParams } from '../commonUtils'; import { getOrderByFromParams, safeParseJSON } from '../commonUtils';
import { import {
GetK8sEntityToAggregateAttribute, GetK8sEntityToAggregateAttribute,
INFRA_MONITORING_K8S_PARAMS_KEYS, INFRA_MONITORING_K8S_PARAMS_KEYS,
@@ -105,9 +105,10 @@ function K8sVolumesList({
const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => { const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>(() => {
const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY); const groupBy = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.GROUP_BY);
if (groupBy) { if (groupBy) {
const decoded = decodeURIComponent(groupBy); const parsed = safeParseJSON<IBuilderQuery['groupBy']>(groupBy);
const parsed = JSON.parse(decoded); if (parsed) {
return parsed as IBuilderQuery['groupBy']; return parsed;
}
} }
return []; return [];
}); });

View File

@@ -5,6 +5,7 @@
/* eslint-disable prefer-destructuring */ /* eslint-disable prefer-destructuring */
import { useMemo } from 'react'; import { useMemo } from 'react';
import * as Sentry from '@sentry/react';
import { Color } from '@signozhq/design-tokens'; import { Color } from '@signozhq/design-tokens';
import { Table, Tooltip, Typography } from 'antd'; import { Table, Tooltip, Typography } from 'antd';
import { Progress } from 'antd/lib'; import { Progress } from 'antd/lib';
@@ -260,6 +261,19 @@ export const filterDuplicateFilters = (
return uniqueFilters; return uniqueFilters;
}; };
export const safeParseJSON = <T,>(value: string): T | null => {
if (!value) {
return null;
}
try {
return JSON.parse(value) as T;
} catch (e) {
console.error('Error parsing JSON from URL parameter:', e);
// TODO: Should we capture this error in Sentry?
return null;
}
};
export const getOrderByFromParams = ( export const getOrderByFromParams = (
searchParams: URLSearchParams, searchParams: URLSearchParams,
returnNullAsDefault = false, returnNullAsDefault = false,
@@ -271,9 +285,12 @@ export const getOrderByFromParams = (
INFRA_MONITORING_K8S_PARAMS_KEYS.ORDER_BY, INFRA_MONITORING_K8S_PARAMS_KEYS.ORDER_BY,
); );
if (orderByFromParams) { if (orderByFromParams) {
const decoded = decodeURIComponent(orderByFromParams); const parsed = safeParseJSON<{ columnName: string; order: 'asc' | 'desc' }>(
const parsed = JSON.parse(decoded); orderByFromParams,
return parsed as { columnName: string; order: 'asc' | 'desc' }; );
if (parsed) {
return parsed;
}
} }
if (returnNullAsDefault) { if (returnNullAsDefault) {
return null; return null;
@@ -287,13 +304,7 @@ export const getFiltersFromParams = (
): IBuilderQuery['filters'] | null => { ): IBuilderQuery['filters'] | null => {
const filtersFromParams = searchParams.get(queryKey); const filtersFromParams = searchParams.get(queryKey);
if (filtersFromParams) { if (filtersFromParams) {
try { return safeParseJSON<IBuilderQuery['filters']>(filtersFromParams);
const decoded = decodeURIComponent(filtersFromParams);
const parsed = JSON.parse(decoded);
return parsed as IBuilderQuery['filters'];
} catch (error) {
return null;
}
} }
return null; return null;
}; };

View File

@@ -335,14 +335,14 @@ function MultiIngestionSettings(): JSX.Element {
const isError = isSearching ? isSearchError : isGetError; const isError = isSearching ? isSearchError : isGetError;
useEffect(() => { useEffect(() => {
setDataSource(ingestionKeys?.data.data?.keys || []); setDataSource(ingestionKeys?.data.keys || []);
setTotalIngestionKeys(ingestionKeys?.data?.data?._pagination?.total || 0); setTotalIngestionKeys(ingestionKeys?.data._pagination?.total || 0);
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [ingestionKeys?.data?.data]); }, [ingestionKeys?.data]);
useEffect(() => { useEffect(() => {
if (isError) { if (isError && error) {
showErrorNotification(notifications, error as AxiosError); showErrorNotification(notifications, error);
} }
}, [error, isError, notifications]); }, [error, isError, notifications]);

View File

@@ -18,8 +18,8 @@ jest.mock('lib/query/createTableColumnsFromQuery', () => ({
jest.mock('container/NewWidget/utils', () => ({ jest.mock('container/NewWidget/utils', () => ({
unitOptions: jest.fn(() => [ unitOptions: jest.fn(() => [
{ value: 'none', label: 'None' }, { value: 'none', label: 'None' },
{ value: 'percent', label: 'Percent' }, { value: '%', label: 'Percent (0 - 100)' },
{ value: 'ms', label: 'Milliseconds' }, { value: 'ms', label: 'Milliseconds (ms)' },
]), ]),
})); }));
@@ -39,7 +39,7 @@ const defaultProps = {
], ],
thresholdTableOptions: 'cpu_usage', thresholdTableOptions: 'cpu_usage',
columnUnits: { cpu_usage: 'percent', memory_usage: 'bytes' }, columnUnits: { cpu_usage: 'percent', memory_usage: 'bytes' },
yAxisUnit: 'percent', yAxisUnit: '%',
moveThreshold: jest.fn(), moveThreshold: jest.fn(),
}; };

View File

@@ -1,99 +0,0 @@
import { Dispatch, SetStateAction, useEffect, useState } from 'react';
import { AutoComplete, Input, Typography } from 'antd';
import { find } from 'lodash-es';
import { flattenedCategories } from './dataFormatCategories';
const findCategoryById = (
searchValue: string,
): Record<string, string> | undefined =>
find(flattenedCategories, (option) => option.id === searchValue);
const findCategoryByName = (
searchValue: string,
): Record<string, string> | undefined =>
find(flattenedCategories, (option) => option.name === searchValue);
type OnSelectType = Dispatch<SetStateAction<string>> | ((val: string) => void);
/**
* @deprecated Use DashboardYAxisUnitSelectorWrapper instead.
*/
function YAxisUnitSelector({
value,
onSelect,
fieldLabel,
handleClear,
}: {
value: string;
onSelect: OnSelectType;
fieldLabel: string;
handleClear?: () => void;
}): JSX.Element {
const [inputValue, setInputValue] = useState('');
// Sync input value with the actual value prop
useEffect(() => {
const category = findCategoryById(value);
setInputValue(category?.name || '');
}, [value]);
const onSelectHandler = (selectedValue: string): void => {
const category = findCategoryByName(selectedValue);
if (category) {
onSelect(category.id);
setInputValue(selectedValue);
}
};
const onChangeHandler = (inputValue: string): void => {
setInputValue(inputValue);
// Clear the yAxisUnit if input is empty or doesn't match any option
if (!inputValue) {
onSelect('');
}
};
const onClearHandler = (): void => {
setInputValue('');
onSelect('');
if (handleClear) {
handleClear();
}
};
const options = flattenedCategories.map((options) => ({
value: options.name,
}));
return (
<div className="y-axis-unit-selector">
<Typography.Text className="heading">{fieldLabel}</Typography.Text>
<AutoComplete
style={{ width: '100%' }}
rootClassName="y-axis-root-popover"
options={options}
allowClear
value={inputValue}
onChange={onChangeHandler}
onClear={onClearHandler}
onSelect={onSelectHandler}
filterOption={(inputValue, option): boolean => {
if (option) {
return (
option.value.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1
);
}
return false;
}}
>
<Input placeholder="Unit" rootClassName="input" />
</AutoComplete>
</div>
);
}
export default YAxisUnitSelector;
YAxisUnitSelector.defaultProps = {
handleClear: (): void => {},
};

View File

@@ -1,240 +0,0 @@
/* eslint-disable sonarjs/no-duplicate-string */
import { act } from 'react-dom/test-utils';
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import YAxisUnitSelector from '../YAxisUnitSelector';
// Mock the dataFormatCategories to have predictable test data
jest.mock('../dataFormatCategories', () => ({
flattenedCategories: [
{ id: 'seconds', name: 'seconds (s)' },
{ id: 'milliseconds', name: 'milliseconds (ms)' },
{ id: 'hours', name: 'hours (h)' },
{ id: 'minutes', name: 'minutes (m)' },
],
}));
const MOCK_SECONDS = 'seconds';
const MOCK_MILLISECONDS = 'milliseconds';
describe('YAxisUnitSelector', () => {
const defaultProps = {
value: MOCK_SECONDS,
onSelect: jest.fn(),
fieldLabel: 'Y Axis Unit',
handleClear: jest.fn(),
};
let user: ReturnType<typeof userEvent.setup>;
beforeEach(() => {
jest.clearAllMocks();
user = userEvent.setup();
});
afterEach(() => {
jest.restoreAllMocks();
});
describe('Rendering (Read) & (write)', () => {
it('renders with correct field label', () => {
render(
<YAxisUnitSelector
value={defaultProps.value}
onSelect={defaultProps.onSelect}
fieldLabel={defaultProps.fieldLabel}
handleClear={defaultProps.handleClear}
/>,
);
expect(screen.getByText('Y Axis Unit')).toBeInTheDocument();
const input = screen.getByRole('combobox');
expect(input).toHaveValue('seconds (s)');
});
it('renders with custom field label', () => {
render(
<YAxisUnitSelector
value={defaultProps.value}
onSelect={defaultProps.onSelect}
fieldLabel="Custom Unit Label"
handleClear={defaultProps.handleClear}
/>,
);
expect(screen.getByText('Custom Unit Label')).toBeInTheDocument();
});
it('displays empty input when value prop is empty', () => {
render(
<YAxisUnitSelector
value=""
onSelect={defaultProps.onSelect}
fieldLabel={defaultProps.fieldLabel}
handleClear={defaultProps.handleClear}
/>,
);
expect(screen.getByDisplayValue('')).toBeInTheDocument();
});
it('shows placeholder text', () => {
render(
<YAxisUnitSelector
value={defaultProps.value}
onSelect={defaultProps.onSelect}
fieldLabel={defaultProps.fieldLabel}
handleClear={defaultProps.handleClear}
/>,
);
expect(screen.getByPlaceholderText('Unit')).toBeInTheDocument();
});
it('handles numeric input', async () => {
render(
<YAxisUnitSelector
value={defaultProps.value}
onSelect={defaultProps.onSelect}
fieldLabel={defaultProps.fieldLabel}
handleClear={defaultProps.handleClear}
/>,
);
const input = screen.getByRole('combobox');
await user.clear(input);
await user.type(input, '12345');
expect(input).toHaveValue('12345');
});
it('handles mixed content input', async () => {
render(
<YAxisUnitSelector
value={defaultProps.value}
onSelect={defaultProps.onSelect}
fieldLabel={defaultProps.fieldLabel}
handleClear={defaultProps.handleClear}
/>,
);
const input = screen.getByRole('combobox');
await user.clear(input);
await user.type(input, 'Test123!@#');
expect(input).toHaveValue('Test123!@#');
});
});
describe('State Management', () => {
it('syncs input value with value prop changes', async () => {
const { rerender } = render(
<YAxisUnitSelector
value={defaultProps.value}
onSelect={defaultProps.onSelect}
fieldLabel={defaultProps.fieldLabel}
handleClear={defaultProps.handleClear}
/>,
);
const input = screen.getByRole('combobox');
// Initial value
expect(input).toHaveValue('seconds (s)');
// Change value prop
rerender(
<YAxisUnitSelector
value={MOCK_MILLISECONDS}
onSelect={defaultProps.onSelect}
fieldLabel={defaultProps.fieldLabel}
handleClear={defaultProps.handleClear}
/>,
);
await waitFor(() => {
expect(input).toHaveValue('milliseconds (ms)');
});
});
it('handles empty value prop correctly', async () => {
const { rerender } = render(
<YAxisUnitSelector
value={defaultProps.value}
onSelect={defaultProps.onSelect}
fieldLabel={defaultProps.fieldLabel}
handleClear={defaultProps.handleClear}
/>,
);
const input = screen.getByRole('combobox');
// Change to empty value
rerender(
<YAxisUnitSelector
value=""
onSelect={defaultProps.onSelect}
fieldLabel={defaultProps.fieldLabel}
handleClear={defaultProps.handleClear}
/>,
);
await waitFor(() => {
expect(input).toHaveValue('');
});
});
it('handles invalid value prop gracefully', async () => {
const { rerender } = render(
<YAxisUnitSelector
value={defaultProps.value}
onSelect={defaultProps.onSelect}
fieldLabel={defaultProps.fieldLabel}
handleClear={defaultProps.handleClear}
/>,
);
const input = screen.getByRole('combobox');
// Change to invalid value
rerender(
<YAxisUnitSelector
value="invalid_id"
onSelect={defaultProps.onSelect}
fieldLabel={defaultProps.fieldLabel}
handleClear={defaultProps.handleClear}
/>,
);
await waitFor(() => {
expect(input).toHaveValue('');
});
});
it('maintains local state during typing', async () => {
render(
<YAxisUnitSelector
value={defaultProps.value}
onSelect={defaultProps.onSelect}
fieldLabel={defaultProps.fieldLabel}
handleClear={defaultProps.handleClear}
/>,
);
const input = screen.getByRole('combobox');
// first clear then type
await user.clear(input);
await user.type(input, 'test');
expect(input).toHaveValue('test');
// Value prop change should not override local typing
await act(async () => {
// Simulate prop change
render(
<YAxisUnitSelector
value="bytes"
onSelect={defaultProps.onSelect}
fieldLabel={defaultProps.fieldLabel}
handleClear={defaultProps.handleClear}
/>,
);
});
// Local typing should be preserved
expect(input).toHaveValue('test');
});
});
});

View File

@@ -1,613 +1,53 @@
import { flattenDeep } from 'lodash-es';
import { import {
AccelerationFormats, UniversalUnitToGrafanaUnit,
AngularFormats, YAxisCategoryNames,
AreaFormats, } from 'components/YAxisUnitSelector/constants';
BooleanFormats, import { YAxisSource } from 'components/YAxisUnitSelector/types';
CategoryNames, import { getYAxisCategories } from 'components/YAxisUnitSelector/utils';
ConcentrationFormats, import { convertValue } from 'lib/getConvertedValue';
CurrencyFormats,
DataFormats,
DataRateFormats,
DataTypeCategories,
DatetimeFormats,
FlopsFormats,
FlowFormats,
ForceFormats,
HashRateFormats,
LengthFormats,
MassFormats,
MiscellaneousFormats,
PowerElectricalFormats,
PressureFormats,
RadiationFormats,
RotationSpeedFormats,
TemperatureFormats,
ThroughputFormats,
TimeFormats,
VelocityFormats,
VolumeFormats,
} from './types';
export const dataTypeCategories: DataTypeCategories = [ // Function to get the category name for a given unit ID (Grafana or universal)
{ export const getCategoryName = (unitId: string): YAxisCategoryNames | null => {
name: CategoryNames.Time, const categories = getYAxisCategories(YAxisSource.DASHBOARDS);
formats: [
{ name: 'Hertz (1/s)', id: TimeFormats.Hertz },
{ name: 'nanoseconds (ns)', id: TimeFormats.Nanoseconds },
{ name: 'microseconds (µs)', id: TimeFormats.Microseconds },
{ name: 'milliseconds (ms)', id: TimeFormats.Milliseconds },
{ name: 'seconds (s)', id: TimeFormats.Seconds },
{ name: 'minutes (m)', id: TimeFormats.Minutes },
{ name: 'hours (h)', id: TimeFormats.Hours },
{ name: 'days (d)', id: TimeFormats.Days },
{ name: 'duration in ms (dtdurationms)', id: TimeFormats.DurationMs },
{ name: 'duration in s (dtdurations)', id: TimeFormats.DurationS },
{ name: 'duration in h:m:s (dthms)', id: TimeFormats.DurationHms },
{ name: 'duration in d:h:m:s (dtdhms)', id: TimeFormats.DurationDhms },
{ name: 'timeticks (timeticks)', id: TimeFormats.Timeticks },
{ name: 'clock in ms (clockms)', id: TimeFormats.ClockMs },
{ name: 'clock in s (clocks)', id: TimeFormats.ClockS },
],
},
{
name: CategoryNames.Throughput,
formats: [
{ name: 'counts/sec (cps)', id: ThroughputFormats.CountsPerSec },
{ name: 'ops/sec (ops)', id: ThroughputFormats.OpsPerSec },
{ name: 'requests/sec (reqps)', id: ThroughputFormats.RequestsPerSec },
{ name: 'reads/sec (rps)', id: ThroughputFormats.ReadsPerSec },
{ name: 'writes/sec (wps)', id: ThroughputFormats.WritesPerSec },
{ name: 'I/O operations/sec (iops)', id: ThroughputFormats.IOOpsPerSec },
{ name: 'counts/min (cpm)', id: ThroughputFormats.CountsPerMin },
{ name: 'ops/min (opm)', id: ThroughputFormats.OpsPerMin },
{ name: 'reads/min (rpm)', id: ThroughputFormats.ReadsPerMin },
{ name: 'writes/min (wpm)', id: ThroughputFormats.WritesPerMin },
],
},
{
name: CategoryNames.Data,
formats: [
{ name: 'bytes(IEC)', id: DataFormats.BytesIEC },
{ name: 'bytes(SI)', id: DataFormats.BytesSI },
{ name: 'bits(IEC)', id: DataFormats.BitsIEC },
{ name: 'bits(SI)', id: DataFormats.BitsSI },
{ name: 'kibibytes', id: DataFormats.KibiBytes },
{ name: 'kilobytes', id: DataFormats.KiloBytes },
{ name: 'mebibytes', id: DataFormats.MebiBytes },
{ name: 'megabytes', id: DataFormats.MegaBytes },
{ name: 'gibibytes', id: DataFormats.GibiBytes },
{ name: 'gigabytes', id: DataFormats.GigaBytes },
{ name: 'tebibytes', id: DataFormats.TebiBytes },
{ name: 'terabytes', id: DataFormats.TeraBytes },
{ name: 'pebibytes', id: DataFormats.PebiBytes },
{ name: 'petabytes', id: DataFormats.PetaBytes },
],
},
{
name: CategoryNames.DataRate,
formats: [
{ name: 'packets/sec', id: DataRateFormats.PacketsPerSec },
{ name: 'bytes/sec(IEC)', id: DataRateFormats.BytesPerSecIEC },
{ name: 'bytes/sec(SI)', id: DataRateFormats.BytesPerSecSI },
{ name: 'bits/sec(IEC)', id: DataRateFormats.BitsPerSecIEC },
{ name: 'bits/sec(SI)', id: DataRateFormats.BitsPerSecSI },
{ name: 'kibibytes/sec', id: DataRateFormats.KibiBytesPerSec },
{ name: 'kibibits/sec', id: DataRateFormats.KibiBitsPerSec },
{ name: 'kilobytes/sec', id: DataRateFormats.KiloBytesPerSec },
{ name: 'kilobits/sec', id: DataRateFormats.KiloBitsPerSec },
{ name: 'mebibytes/sec', id: DataRateFormats.MebiBytesPerSec },
{ name: 'mebibits/sec', id: DataRateFormats.MebiBitsPerSec },
{ name: 'megabytes/sec', id: DataRateFormats.MegaBytesPerSec },
{ name: 'megabits/sec', id: DataRateFormats.MegaBitsPerSec },
{ name: 'gibibytes/sec', id: DataRateFormats.GibiBytesPerSec },
{ name: 'gibibits/sec', id: DataRateFormats.GibiBitsPerSec },
{ name: 'gigabytes/sec', id: DataRateFormats.GigaBytesPerSec },
{ name: 'gigabits/sec', id: DataRateFormats.GigaBitsPerSec },
{ name: 'tebibytes/sec', id: DataRateFormats.TebiBytesPerSec },
{ name: 'tebibits/sec', id: DataRateFormats.TebiBitsPerSec },
{ name: 'terabytes/sec', id: DataRateFormats.TeraBytesPerSec },
{ name: 'terabits/sec', id: DataRateFormats.TeraBitsPerSec },
{ name: 'pebibytes/sec', id: DataRateFormats.PebiBytesPerSec },
{ name: 'pebibits/sec', id: DataRateFormats.PebiBitsPerSec },
{ name: 'petabytes/sec', id: DataRateFormats.PetaBytesPerSec },
{ name: 'petabits/sec', id: DataRateFormats.PetaBitsPerSec },
],
},
{
name: CategoryNames.HashRate,
formats: [
{ name: 'hashes/sec', id: HashRateFormats.HashesPerSec },
{ name: 'kilohashes/sec', id: HashRateFormats.KiloHashesPerSec },
{ name: 'megahashes/sec', id: HashRateFormats.MegaHashesPerSec },
{ name: 'gigahashes/sec', id: HashRateFormats.GigaHashesPerSec },
{ name: 'terahashes/sec', id: HashRateFormats.TeraHashesPerSec },
{ name: 'petahashes/sec', id: HashRateFormats.PetaHashesPerSec },
{ name: 'exahashes/sec', id: HashRateFormats.ExaHashesPerSec },
],
},
{
name: CategoryNames.Miscellaneous,
formats: [
{ name: 'none', id: MiscellaneousFormats.None },
{ name: 'String', id: MiscellaneousFormats.String },
{ name: 'short', id: MiscellaneousFormats.Short },
{ name: 'Percent (0-100)', id: MiscellaneousFormats.Percent },
{ name: 'Percent (0.0-1.0)', id: MiscellaneousFormats.PercentUnit },
{ name: 'Humidity (%H)', id: MiscellaneousFormats.Humidity },
{ name: 'Decibel', id: MiscellaneousFormats.Decibel },
{ name: 'Hexadecimal (0x)', id: MiscellaneousFormats.Hexadecimal0x },
{ name: 'Hexadecimal', id: MiscellaneousFormats.Hexadecimal },
{ name: 'Scientific notation', id: MiscellaneousFormats.ScientificNotation },
{ name: 'Locale format', id: MiscellaneousFormats.LocaleFormat },
{ name: 'Pixels', id: MiscellaneousFormats.Pixels },
],
},
{
name: CategoryNames.Acceleration,
formats: [
{ name: 'Meters/sec²', id: AccelerationFormats.MetersPerSecondSquared },
{ name: 'Feet/sec²', id: AccelerationFormats.FeetPerSecondSquared },
{ name: 'G unit', id: AccelerationFormats.GUnit },
],
},
{
name: CategoryNames.Angle,
formats: [
{ name: 'Degrees (°)', id: AngularFormats.Degree },
{ name: 'Radians', id: AngularFormats.Radian },
{ name: 'Gradian', id: AngularFormats.Gradian },
{ name: 'Arc Minutes', id: AngularFormats.ArcMinute },
{ name: 'Arc Seconds', id: AngularFormats.ArcSecond },
],
},
{
name: CategoryNames.Area,
formats: [
{ name: 'Square Meters (m²)', id: AreaFormats.SquareMeters },
{ name: 'Square Feet (ft²)', id: AreaFormats.SquareFeet },
{ name: 'Square Miles (mi²)', id: AreaFormats.SquareMiles },
],
},
{
name: CategoryNames.Computation,
formats: [
{ name: 'FLOP/s', id: FlopsFormats.FLOPs },
{ name: 'MFLOP/s', id: FlopsFormats.MFLOPs },
{ name: 'GFLOP/s', id: FlopsFormats.GFLOPs },
{ name: 'TFLOP/s', id: FlopsFormats.TFLOPs },
{ name: 'PFLOP/s', id: FlopsFormats.PFLOPs },
{ name: 'EFLOP/s', id: FlopsFormats.EFLOPs },
{ name: 'ZFLOP/s', id: FlopsFormats.ZFLOPs },
{ name: 'YFLOP/s', id: FlopsFormats.YFLOPs },
],
},
{
name: CategoryNames.Concentration,
formats: [
{ name: 'parts-per-million (ppm)', id: ConcentrationFormats.PPM },
{ name: 'parts-per-billion (ppb)', id: ConcentrationFormats.PPB },
{ name: 'nanogram per cubic meter (ng/m³)', id: ConcentrationFormats.NgM3 },
{
name: 'nanogram per normal cubic meter (ng/Nm³)',
id: ConcentrationFormats.NgNM3,
},
{ name: 'microgram per cubic meter (μg/m³)', id: ConcentrationFormats.UgM3 },
{
name: 'microgram per normal cubic meter (μg/Nm³)',
id: ConcentrationFormats.UgNM3,
},
{ name: 'milligram per cubic meter (mg/m³)', id: ConcentrationFormats.MgM3 },
{
name: 'milligram per normal cubic meter (mg/Nm³)',
id: ConcentrationFormats.MgNM3,
},
{ name: 'gram per cubic meter (g/m³)', id: ConcentrationFormats.GM3 },
{
name: 'gram per normal cubic meter (g/Nm³)',
id: ConcentrationFormats.GNM3,
},
{ name: 'milligrams per decilitre (mg/dL)', id: ConcentrationFormats.MgDL },
{ name: 'millimoles per litre (mmol/L)', id: ConcentrationFormats.MmolL },
],
},
{
name: CategoryNames.Currency,
formats: [
{ name: 'Dollars ($)', id: CurrencyFormats.USD },
{ name: 'Pounds (£)', id: CurrencyFormats.GBP },
{ name: 'Euro (€)', id: CurrencyFormats.EUR },
{ name: 'Yen (¥)', id: CurrencyFormats.JPY },
{ name: 'Rubles (₽)', id: CurrencyFormats.RUB },
{ name: 'Hryvnias (₴)', id: CurrencyFormats.UAH },
{ name: 'Real (R$)', id: CurrencyFormats.BRL },
{ name: 'Danish Krone (kr)', id: CurrencyFormats.DKK },
{ name: 'Icelandic Króna (kr)', id: CurrencyFormats.ISK },
{ name: 'Norwegian Krone (kr)', id: CurrencyFormats.NOK },
{ name: 'Swedish Krona (kr)', id: CurrencyFormats.SEK },
{ name: 'Czech koruna (czk)', id: CurrencyFormats.CZK },
{ name: 'Swiss franc (CHF)', id: CurrencyFormats.CHF },
{ name: 'Polish Złoty (PLN)', id: CurrencyFormats.PLN },
{ name: 'Bitcoin (฿)', id: CurrencyFormats.BTC },
{ name: 'Milli Bitcoin (฿)', id: CurrencyFormats.MBTC },
{ name: 'Micro Bitcoin (฿)', id: CurrencyFormats.UBTC },
{ name: 'South African Rand (R)', id: CurrencyFormats.ZAR },
{ name: 'Indian Rupee (₹)', id: CurrencyFormats.INR },
{ name: 'South Korean Won (₩)', id: CurrencyFormats.KRW },
{ name: 'Indonesian Rupiah (Rp)', id: CurrencyFormats.IDR },
{ name: 'Philippine Peso (PHP)', id: CurrencyFormats.PHP },
{ name: 'Vietnamese Dong (VND)', id: CurrencyFormats.VND },
],
},
{
name: CategoryNames.Datetime,
formats: [
{ name: 'Datetime ISO', id: DatetimeFormats.ISO },
{
name: 'Datetime ISO (No date if today)',
id: DatetimeFormats.ISONoDateIfToday,
},
{ name: 'Datetime US', id: DatetimeFormats.US },
{
name: 'Datetime US (No date if today)',
id: DatetimeFormats.USNoDateIfToday,
},
{ name: 'Datetime local', id: DatetimeFormats.Local },
{
name: 'Datetime local (No date if today)',
id: DatetimeFormats.LocalNoDateIfToday,
},
{ name: 'Datetime default', id: DatetimeFormats.System },
{ name: 'From Now', id: DatetimeFormats.FromNow },
],
},
{
name: CategoryNames.Energy,
formats: [
{ name: 'Watt (W)', id: PowerElectricalFormats.WATT },
{ name: 'Kilowatt (kW)', id: PowerElectricalFormats.KWATT },
{ name: 'Megawatt (MW)', id: PowerElectricalFormats.MEGWATT },
{ name: 'Gigawatt (GW)', id: PowerElectricalFormats.GWATT },
{ name: 'Milliwatt (mW)', id: PowerElectricalFormats.MWATT },
{ name: 'Watt per square meter (W/m²)', id: PowerElectricalFormats.WM2 },
{ name: 'Volt-Ampere (VA)', id: PowerElectricalFormats.VOLTAMP },
{ name: 'Kilovolt-Ampere (kVA)', id: PowerElectricalFormats.KVOLTAMP },
{
name: 'Volt-Ampere reactive (VAr)',
id: PowerElectricalFormats.VOLTAMPREACT,
},
{
name: 'Kilovolt-Ampere reactive (kVAr)',
id: PowerElectricalFormats.KVOLTAMPREACT,
},
{ name: 'Watt-hour (Wh)', id: PowerElectricalFormats.WATTH },
{
name: 'Watt-hour per Kilogram (Wh/kg)',
id: PowerElectricalFormats.WATTHPERKG,
},
{ name: 'Kilowatt-hour (kWh)', id: PowerElectricalFormats.KWATTH },
{ name: 'Kilowatt-min (kWm)', id: PowerElectricalFormats.KWATTM },
{ name: 'Ampere-hour (Ah)', id: PowerElectricalFormats.AMPH },
{ name: 'Kiloampere-hour (kAh)', id: PowerElectricalFormats.KAMPH },
{ name: 'Milliampere-hour (mAh)', id: PowerElectricalFormats.MAMPH },
{ name: 'Joule (J)', id: PowerElectricalFormats.JOULE },
{ name: 'Electron volt (eV)', id: PowerElectricalFormats.EV },
{ name: 'Ampere (A)', id: PowerElectricalFormats.AMP },
{ name: 'Kiloampere (kA)', id: PowerElectricalFormats.KAMP },
{ name: 'Milliampere (mA)', id: PowerElectricalFormats.MAMP },
{ name: 'Volt (V)', id: PowerElectricalFormats.VOLT },
{ name: 'Kilovolt (kV)', id: PowerElectricalFormats.KVOLT },
{ name: 'Millivolt (mV)', id: PowerElectricalFormats.MVOLT },
{ name: 'Decibel-milliwatt (dBm)', id: PowerElectricalFormats.DBM },
{ name: 'Ohm (Ω)', id: PowerElectricalFormats.OHM },
{ name: 'Kiloohm (kΩ)', id: PowerElectricalFormats.KOHM },
{ name: 'Megaohm (MΩ)', id: PowerElectricalFormats.MOHM },
{ name: 'Farad (F)', id: PowerElectricalFormats.FARAD },
{ name: 'Microfarad (µF)', id: PowerElectricalFormats.µFARAD },
{ name: 'Nanofarad (nF)', id: PowerElectricalFormats.NFARAD },
{ name: 'Picofarad (pF)', id: PowerElectricalFormats.PFARAD },
{ name: 'Femtofarad (fF)', id: PowerElectricalFormats.FFARAD },
{ name: 'Henry (H)', id: PowerElectricalFormats.HENRY },
{ name: 'Millihenry (mH)', id: PowerElectricalFormats.MHENRY },
{ name: 'Microhenry (µH)', id: PowerElectricalFormats.µHENRY },
{ name: 'Lumens (Lm)', id: PowerElectricalFormats.LUMENS },
],
},
{
name: CategoryNames.Flow,
formats: [
{ name: 'Gallons/min (gpm)', id: FlowFormats.FLOWGPM },
{ name: 'Cubic meters/sec (cms)', id: FlowFormats.FLOWCMS },
{ name: 'Cubic feet/sec (cfs)', id: FlowFormats.FLOWCFS },
{ name: 'Cubic feet/min (cfm)', id: FlowFormats.FLOWCFM },
{ name: 'Litre/hour', id: FlowFormats.LITREH },
{ name: 'Litre/min (L/min)', id: FlowFormats.FLOWLPM },
{ name: 'milliLitre/min (mL/min)', id: FlowFormats.FLOWMLPM },
{ name: 'Lux (lx)', id: FlowFormats.LUX },
],
},
{
name: CategoryNames.Force,
formats: [
{ name: 'Newton-meters (Nm)', id: ForceFormats.FORCENM },
{ name: 'Kilonewton-meters (kNm)', id: ForceFormats.FORCEKNM },
{ name: 'Newtons (N)', id: ForceFormats.FORCEN },
{ name: 'Kilonewtons (kN)', id: ForceFormats.FORCEKN },
],
},
{
name: CategoryNames.Mass,
formats: [
{ name: 'milligram (mg)', id: MassFormats.MASSMG },
{ name: 'gram (g)', id: MassFormats.MASSG },
{ name: 'pound (lb)', id: MassFormats.MASSLB },
{ name: 'kilogram (kg)', id: MassFormats.MASSKG },
{ name: 'metric ton (t)', id: MassFormats.MASST },
],
},
{
name: CategoryNames.Length,
formats: [
{ name: 'millimeter (mm)', id: LengthFormats.LENGTHMM },
{ name: 'inch (in)', id: LengthFormats.LENGTHIN },
{ name: 'feet (ft)', id: LengthFormats.LENGTHFT },
{ name: 'meter (m)', id: LengthFormats.LENGTHM },
{ name: 'kilometer (km)', id: LengthFormats.LENGTHKM },
{ name: 'mile (mi)', id: LengthFormats.LENGTHMI },
],
},
{
name: CategoryNames.Pressure,
formats: [
{ name: 'Millibars', id: PressureFormats.PRESSUREMBAR },
{ name: 'Bars', id: PressureFormats.PRESSUREBAR },
{ name: 'Kilobars', id: PressureFormats.PRESSUREKBAR },
{ name: 'Pascals', id: PressureFormats.PRESSUREPA },
{ name: 'Hectopascals', id: PressureFormats.PRESSUREHPA },
{ name: 'Kilopascals', id: PressureFormats.PRESSUREKPA },
{ name: 'Inches of mercury', id: PressureFormats.PRESSUREHG },
{ name: 'PSI', id: PressureFormats.PRESSUREPSI },
],
},
{
name: CategoryNames.Radiation,
formats: [
{ name: 'Becquerel (Bq)', id: RadiationFormats.RADBQ },
{ name: 'curie (Ci)', id: RadiationFormats.RADCI },
{ name: 'Gray (Gy)', id: RadiationFormats.RADGY },
{ name: 'rad', id: RadiationFormats.RADRAD },
{ name: 'Sievert (Sv)', id: RadiationFormats.RADSV },
{ name: 'milliSievert (mSv)', id: RadiationFormats.RADMSV },
{ name: 'microSievert (µSv)', id: RadiationFormats.RADUSV },
{ name: 'rem', id: RadiationFormats.RADREM },
{ name: 'Exposure (C/kg)', id: RadiationFormats.RADEXPCKG },
{ name: 'roentgen (R)', id: RadiationFormats.RADR },
{ name: 'Sievert/hour (Sv/h)', id: RadiationFormats.RADSVH },
{ name: 'milliSievert/hour (mSv/h)', id: RadiationFormats.RADMSVH },
{ name: 'microSievert/hour (µSv/h)', id: RadiationFormats.RADUSVH },
],
},
{
name: CategoryNames.RotationSpeed,
formats: [
{ name: 'Revolutions per minute (rpm)', id: RotationSpeedFormats.ROTRPM },
{ name: 'Hertz (Hz)', id: RotationSpeedFormats.ROTHZ },
{ name: 'Radians per second (rad/s)', id: RotationSpeedFormats.ROTRADS },
{ name: 'Degrees per second (°/s)', id: RotationSpeedFormats.ROTDEGS },
],
},
{
name: CategoryNames.Temperature,
formats: [
{ name: 'Celsius (°C)', id: TemperatureFormats.CELSIUS },
{ name: 'Fahrenheit (°F)', id: TemperatureFormats.FAHRENHEIT },
{ name: 'Kelvin (K)', id: TemperatureFormats.KELVIN },
],
},
{
name: CategoryNames.Velocity,
formats: [
{ name: 'meters/second (m/s)', id: VelocityFormats.METERS_PER_SECOND },
{ name: 'kilometers/hour (km/h)', id: VelocityFormats.KILOMETERS_PER_HOUR },
{ name: 'miles/hour (mph)', id: VelocityFormats.MILES_PER_HOUR },
{ name: 'knot (kn)', id: VelocityFormats.KNOT },
],
},
{
name: CategoryNames.Volume,
formats: [
{ name: 'millilitre (mL)', id: VolumeFormats.MILLILITRE },
{ name: 'litre (L)', id: VolumeFormats.LITRE },
{ name: 'cubic meter', id: VolumeFormats.CUBIC_METER },
{ name: 'Normal cubic meter', id: VolumeFormats.NORMAL_CUBIC_METER },
{ name: 'cubic decimeter', id: VolumeFormats.CUBIC_DECIMETER },
{ name: 'gallons', id: VolumeFormats.GALLONS },
],
},
{
name: CategoryNames.Boolean,
formats: [
{ name: 'True / False', id: BooleanFormats.TRUE_FALSE },
{ name: 'Yes / No', id: BooleanFormats.YES_NO },
{ name: 'On / Off', id: BooleanFormats.ON_OFF },
],
},
];
export const flattenedCategories = flattenDeep( const foundCategory = categories.find((category) =>
dataTypeCategories.map((category) => category.formats), category.units.some((unit) => {
); // Units in Y-axis categories use universal unit IDs.
// Thresholds / column units often use Grafana-style IDs.
// Treat a unit as matching if either:
// - it is already the universal ID, or
// - it matches the mapped Grafana ID for that universal unit.
if (unit.id === unitId) {
return true;
}
type ConversionFactors = { const grafanaId = UniversalUnitToGrafanaUnit[unit.id];
[key: string]: { return grafanaId === unitId;
[key: string]: number | null; }),
}; );
return foundCategory ? foundCategory.name : null;
}; };
// Object containing conversion factors for various categories and formats
const conversionFactors: ConversionFactors = {
[CategoryNames.Time]: {
[TimeFormats.Hertz]: 1,
[TimeFormats.Nanoseconds]: 1e-9,
[TimeFormats.Microseconds]: 1e-6,
[TimeFormats.Milliseconds]: 1e-3,
[TimeFormats.Seconds]: 1,
[TimeFormats.Minutes]: 60,
[TimeFormats.Hours]: 3600,
[TimeFormats.Days]: 86400,
[TimeFormats.DurationMs]: 1e-3,
[TimeFormats.DurationS]: 1,
[TimeFormats.DurationHms]: null, // Requires special handling
[TimeFormats.DurationDhms]: null, // Requires special handling
[TimeFormats.Timeticks]: null, // Requires special handling
[TimeFormats.ClockMs]: 1e-3,
[TimeFormats.ClockS]: 1,
},
[CategoryNames.Throughput]: {
[ThroughputFormats.CountsPerSec]: 1,
[ThroughputFormats.OpsPerSec]: 1,
[ThroughputFormats.RequestsPerSec]: 1,
[ThroughputFormats.ReadsPerSec]: 1,
[ThroughputFormats.WritesPerSec]: 1,
[ThroughputFormats.IOOpsPerSec]: 1,
[ThroughputFormats.CountsPerMin]: 1 / 60,
[ThroughputFormats.OpsPerMin]: 1 / 60,
[ThroughputFormats.ReadsPerMin]: 1 / 60,
[ThroughputFormats.WritesPerMin]: 1 / 60,
},
[CategoryNames.Data]: {
[DataFormats.BytesIEC]: 1,
[DataFormats.BytesSI]: 1,
[DataFormats.BitsIEC]: 0.125,
[DataFormats.BitsSI]: 0.125,
[DataFormats.KibiBytes]: 1024,
[DataFormats.KiloBytes]: 1000,
[DataFormats.MebiBytes]: 1048576,
[DataFormats.MegaBytes]: 1000000,
[DataFormats.GibiBytes]: 1073741824,
[DataFormats.GigaBytes]: 1000000000,
[DataFormats.TebiBytes]: 1099511627776,
[DataFormats.TeraBytes]: 1000000000000,
[DataFormats.PebiBytes]: 1125899906842624,
[DataFormats.PetaBytes]: 1000000000000000,
},
[CategoryNames.DataRate]: {
[DataRateFormats.PacketsPerSec]: null, // Cannot convert directly to other data rates
[DataRateFormats.BytesPerSecIEC]: 1,
[DataRateFormats.BytesPerSecSI]: 1,
[DataRateFormats.BitsPerSecIEC]: 0.125,
[DataRateFormats.BitsPerSecSI]: 0.125,
[DataRateFormats.KibiBytesPerSec]: 1024,
[DataRateFormats.KibiBitsPerSec]: 128,
[DataRateFormats.KiloBytesPerSec]: 1000,
[DataRateFormats.KiloBitsPerSec]: 125,
[DataRateFormats.MebiBytesPerSec]: 1048576,
[DataRateFormats.MebiBitsPerSec]: 131072,
[DataRateFormats.MegaBytesPerSec]: 1000000,
[DataRateFormats.MegaBitsPerSec]: 125000,
[DataRateFormats.GibiBytesPerSec]: 1073741824,
[DataRateFormats.GibiBitsPerSec]: 134217728,
[DataRateFormats.GigaBytesPerSec]: 1000000000,
[DataRateFormats.GigaBitsPerSec]: 125000000,
[DataRateFormats.TebiBytesPerSec]: 1099511627776,
[DataRateFormats.TebiBitsPerSec]: 137438953472,
[DataRateFormats.TeraBytesPerSec]: 1000000000000,
[DataRateFormats.TeraBitsPerSec]: 125000000000,
[DataRateFormats.PebiBytesPerSec]: 1125899906842624,
[DataRateFormats.PebiBitsPerSec]: 140737488355328,
[DataRateFormats.PetaBytesPerSec]: 1000000000000000,
[DataRateFormats.PetaBitsPerSec]: 125000000000000,
},
[CategoryNames.Miscellaneous]: {
[MiscellaneousFormats.None]: null,
[MiscellaneousFormats.String]: null,
[MiscellaneousFormats.Short]: null,
[MiscellaneousFormats.Percent]: 1,
[MiscellaneousFormats.PercentUnit]: 100,
[MiscellaneousFormats.Humidity]: 1,
[MiscellaneousFormats.Decibel]: null,
[MiscellaneousFormats.Hexadecimal0x]: null,
[MiscellaneousFormats.Hexadecimal]: null,
[MiscellaneousFormats.ScientificNotation]: null,
[MiscellaneousFormats.LocaleFormat]: null,
[MiscellaneousFormats.Pixels]: null,
},
[CategoryNames.Boolean]: {
[BooleanFormats.TRUE_FALSE]: null, // Not convertible
[BooleanFormats.YES_NO]: null, // Not convertible
[BooleanFormats.ON_OFF]: null, // Not convertible
},
};
// Function to get the conversion factor between two units in a specific category
function getConversionFactor(
fromUnit: string,
toUnit: string,
category: CategoryNames,
): number | null {
// Retrieves the conversion factors for the specified category
const categoryFactors = conversionFactors[category];
if (!categoryFactors) {
return null; // Returns null if the category does not exist
}
const fromFactor = categoryFactors[fromUnit];
const toFactor = categoryFactors[toUnit];
if (
fromFactor === undefined ||
toFactor === undefined ||
fromFactor === null ||
toFactor === null
) {
return null; // Returns null if either unit does not exist or is not convertible
}
return fromFactor / toFactor; // Returns the conversion factor ratio
}
// Function to convert a value from one unit to another // Function to convert a value from one unit to another
export function convertUnit( export function convertUnit(
value: number, value: number,
fromUnitId?: string, fromUnitId?: string,
toUnitId?: string, toUnitId?: string,
): number | null { ): number | null {
let fromUnit: string | undefined; if (!fromUnitId || !toUnitId) {
let toUnit: string | undefined;
// Finds the category that contains the specified units and extracts fromUnit and toUnit using array methods
const category = dataTypeCategories.find((category) =>
category.formats.some((format) => {
if (format.id === fromUnitId) {
fromUnit = format.id;
}
if (format.id === toUnitId) {
toUnit = format.id;
}
return fromUnit && toUnit; // Break out early if both units are found
}),
);
if (!category || !fromUnit || !toUnit) {
return null; return null;
} // Return null if category or units are not found }
// Gets the conversion factor for the specified units const fromCategory = getCategoryName(fromUnitId);
const conversionFactor = getConversionFactor( const toCategory = getCategoryName(toUnitId);
fromUnit,
toUnit, // If either unit is unknown or the categories don't match, the conversion is invalid
category.name as any, if (!fromCategory || !toCategory || fromCategory !== toCategory) {
);
if (conversionFactor === null) {
return null; return null;
} // Return null if conversion is not possible }
return value * conversionFactor; // Delegate the actual numeric conversion (or identity) to the shared helper,
// which understands both Grafana-style and universal unit IDs.
return convertValue(value, fromUnitId, toUnitId);
} }
// Function to get the category name for a given unit ID
export const getCategoryName = (unitId: string): CategoryNames | null => {
// Finds the category that contains the specified unit ID
const foundCategory = dataTypeCategories.find((category) =>
category.formats.some((format) => format.id === unitId),
);
return foundCategory ? (foundCategory.name as CategoryNames) : null;
};

View File

@@ -2,6 +2,9 @@ import { Layout } from 'react-grid-layout';
import { DefaultOptionType } from 'antd/es/select'; import { DefaultOptionType } from 'antd/es/select';
import { omitIdFromQuery } from 'components/ExplorerCard/utils'; import { omitIdFromQuery } from 'components/ExplorerCard/utils';
import { PrecisionOptionsEnum } from 'components/Graph/types'; import { PrecisionOptionsEnum } from 'components/Graph/types';
import { YAxisCategoryNames } from 'components/YAxisUnitSelector/constants';
import { YAxisSource } from 'components/YAxisUnitSelector/types';
import { getYAxisCategories } from 'components/YAxisUnitSelector/utils';
import { import {
initialQueryBuilderFormValuesMap, initialQueryBuilderFormValuesMap,
PANEL_TYPES, PANEL_TYPES,
@@ -21,11 +24,7 @@ import { IBuilderQuery, Query } from 'types/api/queryBuilder/queryBuilderData';
import { EQueryType } from 'types/common/dashboard'; import { EQueryType } from 'types/common/dashboard';
import { DataSource } from 'types/common/queryBuilder'; import { DataSource } from 'types/common/queryBuilder';
import { import { getCategoryName } from './RightContainer/dataFormatCategories';
dataTypeCategories,
getCategoryName,
} from './RightContainer/dataFormatCategories';
import { CategoryNames } from './RightContainer/types';
export const getIsQueryModified = ( export const getIsQueryModified = (
currentQuery: Query, currentQuery: Query,
@@ -606,14 +605,21 @@ export const PANEL_TYPE_TO_QUERY_TYPES: Record<PANEL_TYPES, EQueryType[]> = {
* the label and value for each format. * the label and value for each format.
*/ */
export const getCategorySelectOptionByName = ( export const getCategorySelectOptionByName = (
name?: CategoryNames | string, name?: YAxisCategoryNames,
): DefaultOptionType[] => ): DefaultOptionType[] => {
dataTypeCategories const categories = getYAxisCategories(YAxisSource.DASHBOARDS);
.find((category) => category.name === name) if (!categories.length) {
?.formats.map((format) => ({ return [];
label: format.name, }
value: format.id, return (
})) || []; categories
.find((category) => category.name === name)
?.units.map((unit) => ({
label: unit.name,
value: unit.id,
})) || []
);
};
/** /**
* Generates unit options based on the provided column unit. * Generates unit options based on the provided column unit.

View File

@@ -8,7 +8,7 @@ import logEvent from 'api/common/logEvent';
import inviteUsers from 'api/v1/invite/bulk/create'; import inviteUsers from 'api/v1/invite/bulk/create';
import AuthError from 'components/AuthError/AuthError'; import AuthError from 'components/AuthError/AuthError';
import { useNotifications } from 'hooks/useNotifications'; import { useNotifications } from 'hooks/useNotifications';
import { cloneDeep, debounce, isEmpty } from 'lodash-es'; import { cloneDeep, debounce } from 'lodash-es';
import { import {
ArrowRight, ArrowRight,
ChevronDown, ChevronDown,
@@ -65,7 +65,7 @@ function InviteTeamMembers({
}; };
useEffect(() => { useEffect(() => {
if (isEmpty(teamMembers)) { if (teamMembers === null) {
const initialTeamMembers = Array.from({ length: 3 }, () => ({ const initialTeamMembers = Array.from({ length: 3 }, () => ({
...defaultTeamMember, ...defaultTeamMember,
id: uuid(), id: uuid(),
@@ -88,7 +88,10 @@ function InviteTeamMembers({
setTeamMembersToInvite((prev) => (prev || []).filter((m) => m.id !== id)); setTeamMembersToInvite((prev) => (prev || []).filter((m) => m.id !== id));
}; };
// Validation function to check all users const isMemberTouched = (member: TeamMember): boolean =>
member.email.trim() !== '' ||
Boolean(member.role && member.role.trim() !== '');
const validateAllUsers = (): boolean => { const validateAllUsers = (): boolean => {
let isValid = true; let isValid = true;
let hasEmailErrors = false; let hasEmailErrors = false;
@@ -96,7 +99,9 @@ function InviteTeamMembers({
const updatedEmailValidity: Record<string, boolean> = {}; const updatedEmailValidity: Record<string, boolean> = {};
teamMembersToInvite?.forEach((member) => { const touchedMembers = teamMembersToInvite?.filter(isMemberTouched) ?? [];
touchedMembers?.forEach((member) => {
const emailValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(member.email); const emailValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(member.email);
const roleValid = Boolean(member.role && member.role.trim() !== ''); const roleValid = Boolean(member.role && member.role.trim() !== '');
@@ -150,12 +155,12 @@ function InviteTeamMembers({
const handleNext = (): void => { const handleNext = (): void => {
if (validateAllUsers()) { if (validateAllUsers()) {
setTeamMembers(teamMembersToInvite || []); setTeamMembers(teamMembersToInvite?.filter(isMemberTouched) ?? []);
setHasInvalidEmails(false); setHasInvalidEmails(false);
setHasInvalidRoles(false); setHasInvalidRoles(false);
setInviteError(null); setInviteError(null);
sendInvites({ sendInvites({
invites: teamMembersToInvite || [], invites: teamMembersToInvite?.filter(isMemberTouched) ?? [],
}); });
} }
}; };
@@ -230,12 +235,12 @@ function InviteTeamMembers({
const getValidationErrorMessage = (): string => { const getValidationErrorMessage = (): string => {
if (hasInvalidEmails && hasInvalidRoles) { if (hasInvalidEmails && hasInvalidRoles) {
return 'Please enter valid emails and select roles for all team members'; return 'Please enter valid emails and select roles for team members';
} }
if (hasInvalidEmails) { if (hasInvalidEmails) {
return 'Please enter valid emails for all team members'; return 'Please enter valid emails for team members';
} }
return 'Please select roles for all team members'; return 'Please select roles for team members';
}; };
const handleDoLater = (): void => { const handleDoLater = (): void => {
@@ -246,7 +251,10 @@ function InviteTeamMembers({
onNext(); onNext();
}; };
const hasInvites =
(teamMembersToInvite?.filter(isMemberTouched) ?? []).length > 0;
const isButtonDisabled = isSendingInvites || isLoading; const isButtonDisabled = isSendingInvites || isLoading;
const isInviteButtonDisabled = isButtonDisabled || !hasInvites;
return ( return (
<div className="questions-container"> <div className="questions-container">
@@ -356,9 +364,11 @@ function InviteTeamMembers({
<Button <Button
variant="solid" variant="solid"
color="primary" color="primary"
className={`onboarding-next-button ${isButtonDisabled ? 'disabled' : ''}`} className={`onboarding-next-button ${
isInviteButtonDisabled ? 'disabled' : ''
}`}
onClick={handleNext} onClick={handleNext}
disabled={isButtonDisabled} disabled={isInviteButtonDisabled}
suffixIcon={ suffixIcon={
isButtonDisabled ? ( isButtonDisabled ? (
<Loader2 className="animate-spin" size={12} /> <Loader2 className="animate-spin" size={12} />
@@ -367,7 +377,7 @@ function InviteTeamMembers({
) )
} }
> >
Complete Send Invites
</Button> </Button>
<Button <Button
variant="ghost" variant="ghost"

View File

@@ -0,0 +1,480 @@
import { rest, server } from 'mocks-server/server';
import {
fireEvent,
render,
screen,
userEvent,
waitFor,
} from 'tests/test-utils';
import InviteTeamMembers from '../InviteTeamMembers';
jest.mock('api/common/logEvent', () => ({
__esModule: true,
default: jest.fn(),
}));
const mockNotificationSuccess = jest.fn() as jest.MockedFunction<
(args: { message: string }) => void
>;
const mockNotificationError = jest.fn() as jest.MockedFunction<
(args: { message: string }) => void
>;
jest.mock('hooks/useNotifications', () => ({
useNotifications: (): any => ({
notifications: {
success: mockNotificationSuccess,
error: mockNotificationError,
},
}),
}));
const INVITE_USERS_ENDPOINT = '*/api/v1/invite/bulk';
interface TeamMember {
email: string;
role: string;
name: string;
frontendBaseUrl: string;
id: string;
}
interface InviteRequestBody {
invites: { email: string; role: string }[];
}
interface RenderProps {
isLoading?: boolean;
teamMembers?: TeamMember[] | null;
}
const mockOnNext = jest.fn() as jest.MockedFunction<() => void>;
const mockSetTeamMembers = jest.fn() as jest.MockedFunction<
(members: TeamMember[]) => void
>;
function renderComponent({
isLoading = false,
teamMembers = null,
}: RenderProps = {}): ReturnType<typeof render> {
return render(
<InviteTeamMembers
isLoading={isLoading}
teamMembers={teamMembers}
setTeamMembers={mockSetTeamMembers}
onNext={mockOnNext}
/>,
);
}
async function selectRole(
user: ReturnType<typeof userEvent.setup>,
selectIndex: number,
optionLabel: string,
): Promise<void> {
const placeholders = screen.getAllByText(/select roles/i);
await user.click(placeholders[selectIndex]);
const optionContent = await screen.findByText(optionLabel);
fireEvent.click(optionContent);
}
describe('InviteTeamMembers', () => {
beforeEach(() => {
jest.clearAllMocks();
server.use(
rest.post(INVITE_USERS_ENDPOINT, (_, res, ctx) =>
res(ctx.status(200), ctx.json({ status: 'success' })),
),
);
});
afterEach(() => {
jest.useRealTimers();
server.resetHandlers();
});
describe('Initial rendering', () => {
it('renders the page header, column labels, default rows, and action buttons', () => {
renderComponent();
expect(
screen.getByRole('heading', { name: /invite your team/i }),
).toBeInTheDocument();
expect(
screen.getByText(/signoz is a lot more useful with collaborators/i),
).toBeInTheDocument();
expect(
screen.getAllByPlaceholderText(/e\.g\. john@signoz\.io/i),
).toHaveLength(3);
expect(screen.getByText('Email address')).toBeInTheDocument();
expect(screen.getByText('Roles')).toBeInTheDocument();
expect(
screen.getByRole('button', { name: /send invites/i }),
).toBeInTheDocument();
expect(
screen.getByRole('button', { name: /i'll do this later/i }),
).toBeInTheDocument();
});
it('disables both action buttons while isLoading is true', () => {
renderComponent({ isLoading: true });
expect(screen.getByRole('button', { name: /send invites/i })).toBeDisabled();
expect(
screen.getByRole('button', { name: /i'll do this later/i }),
).toBeDisabled();
});
});
describe('Row management', () => {
it('adds a new empty row when "Add another" is clicked', async () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
renderComponent();
expect(
screen.getAllByPlaceholderText(/e\.g\. john@signoz\.io/i),
).toHaveLength(3);
await user.click(screen.getByRole('button', { name: /add another/i }));
expect(
screen.getAllByPlaceholderText(/e\.g\. john@signoz\.io/i),
).toHaveLength(4);
});
it('removes the correct row when its trash icon is clicked', async () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
renderComponent();
const emailInputs = screen.getAllByPlaceholderText(
/e\.g\. john@signoz\.io/i,
);
await user.type(emailInputs[0], 'first@example.com');
await screen.findByDisplayValue('first@example.com');
await user.click(
screen.getAllByRole('button', { name: /remove team member/i })[0],
);
await waitFor(() => {
expect(
screen.queryByDisplayValue('first@example.com'),
).not.toBeInTheDocument();
expect(
screen.getAllByPlaceholderText(/e\.g\. john@signoz\.io/i),
).toHaveLength(2);
});
});
it('hides remove buttons when only one row remains', async () => {
renderComponent();
const user = userEvent.setup({ pointerEventsCheck: 0 });
let removeButtons = screen.getAllByRole('button', {
name: /remove team member/i,
});
while (removeButtons.length > 0) {
await user.click(removeButtons[0]);
removeButtons = screen.queryAllByRole('button', {
name: /remove team member/i,
});
}
expect(
screen.queryByRole('button', { name: /remove team member/i }),
).not.toBeInTheDocument();
});
});
describe('Inline email validation', () => {
it('shows an inline error after typing an invalid email and clears it when a valid email is entered', async () => {
jest.useFakeTimers();
const user = userEvent.setup({
advanceTimers: (ms) => jest.advanceTimersByTime(ms),
});
renderComponent();
const [firstInput] = screen.getAllByPlaceholderText(
/e\.g\. john@signoz\.io/i,
);
await user.type(firstInput, 'not-an-email');
jest.advanceTimersByTime(600);
await waitFor(() => {
expect(screen.getByText(/invalid email address/i)).toBeInTheDocument();
});
await user.clear(firstInput);
await user.type(firstInput, 'good@example.com');
jest.advanceTimersByTime(600);
await waitFor(() => {
expect(
screen.queryByText(/invalid email address/i),
).not.toBeInTheDocument();
});
});
it('does not show an inline error when the field is cleared back to empty', async () => {
jest.useFakeTimers();
const user = userEvent.setup({
advanceTimers: (ms) => jest.advanceTimersByTime(ms),
});
renderComponent();
const [firstInput] = screen.getAllByPlaceholderText(
/e\.g\. john@signoz\.io/i,
);
await user.type(firstInput, 'a');
await user.clear(firstInput);
jest.advanceTimersByTime(600);
await waitFor(() => {
expect(
screen.queryByText(/invalid email address/i),
).not.toBeInTheDocument();
});
});
});
describe('Validation callout on Complete', () => {
it('shows the correct callout message for each combination of email/role validity', async () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
renderComponent();
const removeButtons = screen.getAllByRole('button', {
name: /remove team member/i,
});
await user.click(removeButtons[0]);
await user.click(
screen.getAllByRole('button', { name: /remove team member/i })[0],
);
const [firstInput] = screen.getAllByPlaceholderText(
/e\.g\. john@signoz\.io/i,
);
await user.type(firstInput, 'bad-email');
await user.click(screen.getByRole('button', { name: /send invites/i }));
await waitFor(() => {
expect(
screen.getByText(
/please enter valid emails and select roles for team members/i,
),
).toBeInTheDocument();
expect(
screen.queryByText(/please enter valid emails for team members/i),
).not.toBeInTheDocument();
expect(
screen.queryByText(/please select roles for team members/i),
).not.toBeInTheDocument();
});
await selectRole(user, 0, 'Viewer');
await user.click(screen.getByRole('button', { name: /send invites/i }));
await waitFor(() => {
expect(
screen.getByText(/please enter valid emails for team members/i),
).toBeInTheDocument();
expect(
screen.queryByText(/please select roles for team members/i),
).not.toBeInTheDocument();
expect(
screen.queryByText(/please enter valid emails and select roles/i),
).not.toBeInTheDocument();
});
await user.clear(firstInput);
await user.type(firstInput, 'valid@example.com');
await user.click(screen.getByRole('button', { name: /add another/i }));
const allInputs = screen.getAllByPlaceholderText(/e\.g\. john@signoz\.io/i);
await user.type(allInputs[1], 'norole@example.com');
await user.click(screen.getByRole('button', { name: /send invites/i }));
await waitFor(() => {
expect(
screen.getByText(/please select roles for team members/i),
).toBeInTheDocument();
expect(
screen.queryByText(/please enter valid emails for team members/i),
).not.toBeInTheDocument();
expect(
screen.queryByText(/please enter valid emails and select roles/i),
).not.toBeInTheDocument();
});
});
it('treats whitespace as untouched, clears the callout on fix-and-resubmit, and clears role error on role select', async () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
renderComponent();
const removeButtons = screen.getAllByRole('button', {
name: /remove team member/i,
});
await user.click(removeButtons[0]);
await user.click(
screen.getAllByRole('button', { name: /remove team member/i })[0],
);
const [firstInput] = screen.getAllByPlaceholderText(
/e\.g\. john@signoz\.io/i,
);
await user.type(firstInput, ' ');
await user.click(screen.getByRole('button', { name: /send invites/i }));
await waitFor(() => {
expect(
screen.queryByText(/please enter valid emails/i),
).not.toBeInTheDocument();
expect(screen.queryByText(/please select roles/i)).not.toBeInTheDocument();
});
await user.clear(firstInput);
await user.type(firstInput, 'bad-email');
await user.click(screen.getByRole('button', { name: /send invites/i }));
await waitFor(() => {
expect(
screen.getByText(
/please enter valid emails and select roles for team members/i,
),
).toBeInTheDocument();
expect(
screen.queryByText(/please enter valid emails for team members/i),
).not.toBeInTheDocument();
expect(
screen.queryByText(/please select roles for team members/i),
).not.toBeInTheDocument();
});
await user.clear(firstInput);
await user.type(firstInput, 'good@example.com');
await selectRole(user, 0, 'Admin');
await user.click(screen.getByRole('button', { name: /send invites/i }));
await waitFor(() => {
expect(
screen.queryByText(/please enter valid emails and select roles/i),
).not.toBeInTheDocument();
expect(
screen.queryByText(/please enter valid emails for team members/i),
).not.toBeInTheDocument();
expect(
screen.queryByText(/please select roles for team members/i),
).not.toBeInTheDocument();
});
await waitFor(() => expect(mockOnNext).toHaveBeenCalledTimes(1), {
timeout: 1200,
});
});
it('disables the Send Invites button when all rows are untouched (empty)', async () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
renderComponent();
const sendInvitesBtn = screen.getByRole('button', { name: /send invites/i });
expect(sendInvitesBtn).toBeDisabled();
// Type something to make a row touched
const [firstInput] = screen.getAllByPlaceholderText(
/e\.g\. john@signoz\.io/i,
);
await user.type(firstInput, 'a');
expect(sendInvitesBtn).not.toBeDisabled();
});
});
describe('API integration', () => {
it('only sends touched (non-empty) rows — empty rows are excluded from the invite payload', async () => {
let capturedBody: InviteRequestBody | null = null;
server.use(
rest.post(INVITE_USERS_ENDPOINT, async (req, res, ctx) => {
capturedBody = await req.json<InviteRequestBody>();
return res(ctx.status(200), ctx.json({ status: 'success' }));
}),
);
const user = userEvent.setup({ pointerEventsCheck: 0 });
renderComponent();
const [firstInput] = screen.getAllByPlaceholderText(
/e\.g\. john@signoz\.io/i,
);
await user.type(firstInput, 'only@example.com');
await selectRole(user, 0, 'Admin');
await user.click(screen.getByRole('button', { name: /send invites/i }));
await waitFor(() => {
expect(capturedBody).not.toBeNull();
expect(capturedBody?.invites).toHaveLength(1);
expect(capturedBody?.invites[0]).toMatchObject({
email: 'only@example.com',
role: 'ADMIN',
});
});
await waitFor(() => expect(mockOnNext).toHaveBeenCalled(), {
timeout: 1200,
});
});
it('calls the invite API, shows a success notification, and calls onNext after the 1 s delay', async () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
renderComponent();
const [firstInput] = screen.getAllByPlaceholderText(
/e\.g\. john@signoz\.io/i,
);
await user.type(firstInput, 'alice@example.com');
await selectRole(user, 0, 'Admin');
await user.click(screen.getByRole('button', { name: /send invites/i }));
await waitFor(() => {
expect(mockNotificationSuccess).toHaveBeenCalledWith(
expect.objectContaining({ message: 'Invites sent successfully!' }),
);
});
await waitFor(
() => {
expect(mockOnNext).toHaveBeenCalledTimes(1);
},
{ timeout: 1200 },
);
});
it('renders an API error container when the invite request fails', async () => {
server.use(
rest.post(INVITE_USERS_ENDPOINT, (_, res, ctx) =>
res(
ctx.status(500),
ctx.json({
errors: [{ code: 'INTERNAL_ERROR', msg: 'Something went wrong' }],
}),
),
),
);
const user = userEvent.setup({ pointerEventsCheck: 0 });
renderComponent();
const [firstInput] = screen.getAllByPlaceholderText(
/e\.g\. john@signoz\.io/i,
);
await user.type(firstInput, 'fail@example.com');
await selectRole(user, 0, 'Viewer');
await user.click(screen.getByRole('button', { name: /send invites/i }));
await waitFor(() => {
expect(document.querySelector('.auth-error-container')).toBeInTheDocument();
});
await user.type(firstInput, 'x');
await waitFor(() => {
expect(
document.querySelector('.auth-error-container'),
).not.toBeInTheDocument();
});
});
});
});

View File

@@ -3,11 +3,7 @@ import { useCopyToClipboard } from 'react-use';
import { Button, Skeleton, Tooltip, Typography } from 'antd'; import { Button, Skeleton, Tooltip, Typography } from 'antd';
import logEvent from 'api/common/logEvent'; import logEvent from 'api/common/logEvent';
import { useGetIngestionKeys } from 'api/generated/services/gateway'; import { useGetIngestionKeys } from 'api/generated/services/gateway';
import { import { GatewaytypesIngestionKeyDTO } from 'api/generated/services/sigNoz.schemas';
GatewaytypesIngestionKeyDTO,
RenderErrorResponseDTO,
} from 'api/generated/services/sigNoz.schemas';
import { AxiosError } from 'axios';
import { DOCS_BASE_URL } from 'constants/app'; import { DOCS_BASE_URL } from 'constants/app';
import { useGetGlobalConfig } from 'hooks/globalConfig/useGetGlobalConfig'; import { useGetGlobalConfig } from 'hooks/globalConfig/useGetGlobalConfig';
import { useNotifications } from 'hooks/useNotifications'; import { useNotifications } from 'hooks/useNotifications';
@@ -72,24 +68,21 @@ export default function OnboardingIngestionDetails(): JSX.Element {
}; };
useEffect(() => { useEffect(() => {
if ( if (!ingestionKeys || isIngestionKeysLoading) {
ingestionKeys?.data?.data?.keys && return;
ingestionKeys?.data.data.keys.length > 0
) {
setFirstIngestionKey(ingestionKeys?.data.data.keys[0]);
} }
}, [ingestionKeys]);
if (ingestionKeys.data.keys && ingestionKeys.data.keys.length > 0) {
setFirstIngestionKey(ingestionKeys.data.keys[0]);
}
}, [isIngestionKeysLoading, ingestionKeys]);
return ( return (
<div className="configure-product-ingestion-section-content"> <div className="configure-product-ingestion-section-content">
{isError && ( {isError && (
<div className="ingestion-endpoint-section-error-container"> <div className="ingestion-endpoint-section-error-container">
<Typography.Text className="ingestion-endpoint-section-error-text error"> <Typography.Text className="ingestion-endpoint-section-error-text error">
<TriangleAlert size={14} />{' '} <TriangleAlert size={14} /> {error.message || 'Something went wrong'}
{(error as AxiosError<RenderErrorResponseDTO>)?.response?.data?.error
?.message ||
(error as AxiosError)?.message ||
'Something went wrong'}
</Typography.Text> </Typography.Text>
<div className="ingestion-setup-details-links"> <div className="ingestion-setup-details-links">

View File

@@ -116,7 +116,7 @@ describe('SSOEnforcementToggle', () => {
render( render(
<SSOEnforcementToggle <SSOEnforcementToggle
isDefaultChecked={true} isDefaultChecked={true}
record={{ ...mockGoogleAuthDomain, id: undefined }} record={{ ...mockGoogleAuthDomain, id: '' }}
/>, />,
); );

View File

@@ -6,7 +6,7 @@ import { toast } from '@signozhq/sonner';
import { Modal } from 'antd'; import { Modal } from 'antd';
import { Table } from 'antd'; import { Table } from 'antd';
import { ColumnsType } from 'antd/lib/table'; import { ColumnsType } from 'antd/lib/table';
import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2'; import { ErrorResponseHandlerForGeneratedAPIs } from 'api/ErrorResponseHandlerForGeneratedAPIs';
import { import {
useDeleteAuthDomain, useDeleteAuthDomain,
useListAuthDomains, useListAuthDomains,
@@ -19,7 +19,6 @@ import { AxiosError } from 'axios';
import ErrorContent from 'components/ErrorModal/components/ErrorContent'; import ErrorContent from 'components/ErrorModal/components/ErrorContent';
import CopyToClipboard from 'periscope/components/CopyToClipboard'; import CopyToClipboard from 'periscope/components/CopyToClipboard';
import { useErrorModal } from 'providers/ErrorModalProvider'; import { useErrorModal } from 'providers/ErrorModalProvider';
import { ErrorV2Resp } from 'types/api';
import APIError from 'types/api/error'; import APIError from 'types/api/error';
import CreateEdit from './CreateEdit/CreateEdit'; import CreateEdit from './CreateEdit/CreateEdit';
@@ -86,7 +85,7 @@ function AuthDomain(): JSX.Element {
}, },
onError: (error) => { onError: (error) => {
try { try {
ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>); ErrorResponseHandlerForGeneratedAPIs(error);
} catch (apiError) { } catch (apiError) {
showErrorModal(apiError as APIError); showErrorModal(apiError as APIError);
} }
@@ -109,9 +108,7 @@ function AuthDomain(): JSX.Element {
let errorResult: APIError | null = null; let errorResult: APIError | null = null;
try { try {
ErrorResponseHandlerV2( ErrorResponseHandlerForGeneratedAPIs(errorFetchingAuthDomainListResponse);
errorFetchingAuthDomainListResponse as AxiosError<ErrorV2Resp>,
);
} catch (error) { } catch (error) {
errorResult = error as APIError; errorResult = error as APIError;
} }
@@ -202,7 +199,7 @@ function AuthDomain(): JSX.Element {
{!errorFetchingAuthDomainListResponse && ( {!errorFetchingAuthDomainListResponse && (
<Table <Table
columns={columns} columns={columns}
dataSource={authDomainListResponse?.data?.data} dataSource={authDomainListResponse?.data}
onRow={undefined} onRow={undefined}
loading={ loading={
isLoadingAuthDomainListResponse || isFetchingAuthDomainListResponse isLoadingAuthDomainListResponse || isFetchingAuthDomainListResponse

View File

@@ -1,10 +1,13 @@
import { CategoryNames } from 'container/NewWidget/RightContainer/types'; import { YAxisCategoryNames } from 'components/YAxisUnitSelector/constants';
export const categoryToSupport = [ export const categoryToSupport: YAxisCategoryNames[] = [
CategoryNames.Data, YAxisCategoryNames.None,
CategoryNames.DataRate, YAxisCategoryNames.Data,
CategoryNames.Time, YAxisCategoryNames.DataRate,
CategoryNames.Throughput, YAxisCategoryNames.Time,
CategoryNames.Miscellaneous, YAxisCategoryNames.Count,
CategoryNames.Boolean, YAxisCategoryNames.Operations,
YAxisCategoryNames.Percentage,
YAxisCategoryNames.Miscellaneous,
YAxisCategoryNames.Boolean,
]; ];

View File

@@ -40,7 +40,7 @@ function RolesListingTable({
[history, urlQuery], [history, urlQuery],
); );
const roles = useMemo(() => data?.data?.data ?? [], [data]); const roles = useMemo(() => data?.data ?? [], [data]);
const formatTimestamp = (date?: Date | string): string => { const formatTimestamp = (date?: Date | string): string => {
if (!date) { if (!date) {

287
go.mod
View File

@@ -3,22 +3,23 @@ module github.com/SigNoz/signoz
go 1.24.0 go 1.24.0
require ( require (
dario.cat/mergo v1.0.2 dario.cat/mergo v1.0.1
github.com/AfterShip/clickhouse-sql-parser v0.4.16 github.com/AfterShip/clickhouse-sql-parser v0.4.16
github.com/ClickHouse/clickhouse-go/v2 v2.40.1 github.com/ClickHouse/clickhouse-go/v2 v2.40.1
github.com/DATA-DOG/go-sqlmock v1.5.2 github.com/DATA-DOG/go-sqlmock v1.5.2
github.com/SigNoz/govaluate v0.0.0-20240203125216-988004ccc7fd github.com/SigNoz/govaluate v0.0.0-20240203125216-988004ccc7fd
github.com/SigNoz/signoz-otel-collector v0.142.1-rc.1 github.com/SigNoz/signoz-otel-collector v0.129.10-rc.9
github.com/antlr4-go/antlr/v4 v4.13.1 github.com/antlr4-go/antlr/v4 v4.13.1
github.com/antonmedv/expr v1.15.3 github.com/antonmedv/expr v1.15.3
github.com/bytedance/sonic v1.14.1
github.com/cespare/xxhash/v2 v2.3.0 github.com/cespare/xxhash/v2 v2.3.0
github.com/coreos/go-oidc/v3 v3.16.0 github.com/coreos/go-oidc/v3 v3.14.1
github.com/dgraph-io/ristretto/v2 v2.3.0 github.com/dgraph-io/ristretto/v2 v2.3.0
github.com/dustin/go-humanize v1.0.1 github.com/dustin/go-humanize v1.0.1
github.com/gin-gonic/gin v1.11.0 github.com/gin-gonic/gin v1.11.0
github.com/go-co-op/gocron v1.30.1 github.com/go-co-op/gocron v1.30.1
github.com/go-openapi/runtime v0.28.0 github.com/go-openapi/runtime v0.28.0
github.com/go-openapi/strfmt v0.24.0 github.com/go-openapi/strfmt v0.23.0
github.com/go-redis/redismock/v9 v9.2.0 github.com/go-redis/redismock/v9 v9.2.0
github.com/go-viper/mapstructure/v2 v2.4.0 github.com/go-viper/mapstructure/v2 v2.4.0
github.com/gojek/heimdall/v7 v7.0.3 github.com/gojek/heimdall/v7 v7.0.3
@@ -29,22 +30,22 @@ require (
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674
github.com/huandu/go-sqlbuilder v1.35.0 github.com/huandu/go-sqlbuilder v1.35.0
github.com/jackc/pgx/v5 v5.7.6 github.com/jackc/pgx/v5 v5.7.6
github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12 github.com/json-iterator/go v1.1.12
github.com/knadh/koanf v1.5.0 github.com/knadh/koanf v1.5.0
github.com/knadh/koanf/v2 v2.3.0 github.com/knadh/koanf/v2 v2.2.0
github.com/mailru/easyjson v0.9.0 github.com/mailru/easyjson v0.7.7
github.com/open-telemetry/opamp-go v0.22.0 github.com/open-telemetry/opamp-go v0.19.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza v0.142.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza v0.128.0
github.com/openfga/api/proto v0.0.0-20250909172242-b4b2a12f5c67 github.com/openfga/api/proto v0.0.0-20250909172242-b4b2a12f5c67
github.com/openfga/language/pkg/go v0.2.0-beta.2.0.20250428093642-7aeebe78bbfe github.com/openfga/language/pkg/go v0.2.0-beta.2.0.20250428093642-7aeebe78bbfe
github.com/opentracing/opentracing-go v1.2.0 github.com/opentracing/opentracing-go v1.2.0
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/prometheus/alertmanager v0.28.1 github.com/prometheus/alertmanager v0.28.1
github.com/prometheus/client_golang v1.23.2 github.com/prometheus/client_golang v1.23.2
github.com/prometheus/common v0.67.4 github.com/prometheus/common v0.66.1
github.com/prometheus/prometheus v0.308.0 github.com/prometheus/prometheus v0.304.1
github.com/redis/go-redis/extra/redisotel/v9 v9.15.1 github.com/redis/go-redis/extra/redisotel/v9 v9.15.1
github.com/redis/go-redis/v9 v9.17.2 github.com/redis/go-redis/v9 v9.15.1
github.com/rs/cors v1.11.1 github.com/rs/cors v1.11.1
github.com/russellhaering/gosaml2 v0.9.0 github.com/russellhaering/gosaml2 v0.9.0
github.com/russellhaering/goxmldsig v1.2.0 github.com/russellhaering/goxmldsig v1.2.0
@@ -53,7 +54,7 @@ require (
github.com/sethvargo/go-password v0.2.0 github.com/sethvargo/go-password v0.2.0
github.com/smartystreets/goconvey v1.8.1 github.com/smartystreets/goconvey v1.8.1
github.com/soheilhy/cmux v0.1.5 github.com/soheilhy/cmux v0.1.5
github.com/spf13/cobra v1.10.2 github.com/spf13/cobra v1.10.1
github.com/srikanthccv/ClickHouse-go-mock v0.13.0 github.com/srikanthccv/ClickHouse-go-mock v0.13.0
github.com/stretchr/testify v1.11.1 github.com/stretchr/testify v1.11.1
github.com/swaggest/jsonschema-go v0.3.78 github.com/swaggest/jsonschema-go v0.3.78
@@ -63,59 +64,43 @@ require (
github.com/uptrace/bun/dialect/pgdialect v1.2.9 github.com/uptrace/bun/dialect/pgdialect v1.2.9
github.com/uptrace/bun/dialect/sqlitedialect v1.2.9 github.com/uptrace/bun/dialect/sqlitedialect v1.2.9
github.com/uptrace/bun/extra/bunotel v1.2.9 github.com/uptrace/bun/extra/bunotel v1.2.9
go.opentelemetry.io/collector/confmap v1.48.0 go.opentelemetry.io/collector/confmap v1.34.0
go.opentelemetry.io/collector/otelcol v0.142.0 go.opentelemetry.io/collector/otelcol v0.128.0
go.opentelemetry.io/collector/pdata v1.48.0 go.opentelemetry.io/collector/pdata v1.34.0
go.opentelemetry.io/contrib/config v0.10.0 go.opentelemetry.io/contrib/config v0.10.0
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.63.0 go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.63.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.64.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0
go.opentelemetry.io/otel v1.39.0 go.opentelemetry.io/otel v1.38.0
go.opentelemetry.io/otel/metric v1.39.0 go.opentelemetry.io/otel/metric v1.38.0
go.opentelemetry.io/otel/sdk v1.39.0 go.opentelemetry.io/otel/sdk v1.38.0
go.opentelemetry.io/otel/trace v1.39.0 go.opentelemetry.io/otel/trace v1.38.0
go.uber.org/multierr v1.11.0 go.uber.org/multierr v1.11.0
go.uber.org/zap v1.27.1 go.uber.org/zap v1.27.0
golang.org/x/crypto v0.46.0 golang.org/x/crypto v0.46.0
golang.org/x/exp v0.0.0-20251113190631-e25ba8c21ef6 golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b
golang.org/x/net v0.48.0 golang.org/x/net v0.47.0
golang.org/x/oauth2 v0.33.0 golang.org/x/oauth2 v0.30.0
golang.org/x/sync v0.19.0 golang.org/x/sync v0.19.0
golang.org/x/text v0.32.0 golang.org/x/text v0.32.0
google.golang.org/protobuf v1.36.10 google.golang.org/protobuf v1.36.9
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
k8s.io/apimachinery v0.35.0-alpha.0 k8s.io/apimachinery v0.34.0
modernc.org/sqlite v1.39.1 modernc.org/sqlite v1.39.1
) )
require ( require (
github.com/aws/aws-sdk-go-v2 v1.40.0 // indirect
github.com/aws/aws-sdk-go-v2/config v1.32.1 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.19.1 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.14 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.14 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.14 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.14 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.0.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.30.4 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.9 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.41.1 // indirect
github.com/aws/smithy-go v1.23.2 // indirect
github.com/bytedance/gopkg v0.1.3 // indirect github.com/bytedance/gopkg v0.1.3 // indirect
github.com/bytedance/sonic v1.14.1 // indirect
github.com/bytedance/sonic/loader v0.3.0 // indirect github.com/bytedance/sonic/loader v0.3.0 // indirect
github.com/cloudwego/base64x v0.1.6 // indirect github.com/cloudwego/base64x v0.1.6 // indirect
github.com/gabriel-vasile/mimetype v1.4.8 // indirect github.com/gabriel-vasile/mimetype v1.4.8 // indirect
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.27.0 // indirect github.com/go-playground/validator/v10 v10.27.0 // indirect
github.com/goccy/go-yaml v1.19.0 // indirect github.com/goccy/go-yaml v1.18.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/prometheus/client_golang/exp v0.0.0-20250914183048-a974e0d45e0a // indirect
github.com/redis/go-redis/extra/rediscmd/v9 v9.15.1 // indirect github.com/redis/go-redis/extra/rediscmd/v9 v9.15.1 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/swaggest/refl v1.4.0 // indirect github.com/swaggest/refl v1.4.0 // indirect
@@ -123,27 +108,24 @@ require (
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.3.0 // indirect github.com/ugorji/go/codec v1.3.0 // indirect
github.com/uptrace/opentelemetry-go-extra/otelsql v0.3.2 // indirect github.com/uptrace/opentelemetry-go-extra/otelsql v0.3.2 // indirect
go.opentelemetry.io/collector/client v1.48.0 // indirect go.opentelemetry.io/collector/config/configretry v1.34.0 // indirect
go.opentelemetry.io/collector/config/configoptional v1.48.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect
go.opentelemetry.io/collector/config/configretry v1.48.0 // indirect
go.opentelemetry.io/collector/exporter/exporterhelper v0.142.0 // indirect
go.opentelemetry.io/collector/pdata/xpdata v0.142.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
golang.org/x/arch v0.20.0 // indirect golang.org/x/arch v0.20.0 // indirect
golang.org/x/tools/godoc v0.1.0-deprecated // indirect
modernc.org/libc v1.66.10 // indirect modernc.org/libc v1.66.10 // indirect
modernc.org/mathutil v1.7.1 // indirect modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.11.0 // indirect modernc.org/memory v1.11.0 // indirect
) )
require ( require (
cel.dev/expr v0.25.1 // indirect cel.dev/expr v0.24.0 // indirect
cloud.google.com/go/auth v0.17.0 // indirect cloud.google.com/go/auth v0.16.1 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
cloud.google.com/go/compute/metadata v0.9.0 // indirect cloud.google.com/go/compute/metadata v0.8.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/azcore v1.18.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 // indirect github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect
github.com/ClickHouse/ch-go v0.67.0 // indirect github.com/ClickHouse/ch-go v0.67.0 // indirect
github.com/Masterminds/squirrel v1.5.4 // indirect github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/Yiling-J/theine-go v0.6.2 // indirect github.com/Yiling-J/theine-go v0.6.2 // indirect
@@ -151,35 +133,35 @@ require (
github.com/andybalholm/brotli v1.2.0 // indirect github.com/andybalholm/brotli v1.2.0 // indirect
github.com/armon/go-metrics v0.4.1 // indirect github.com/armon/go-metrics v0.4.1 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aws/aws-sdk-go v1.55.8 // indirect github.com/aws/aws-sdk-go v1.55.7 // indirect
github.com/beevik/etree v1.1.0 // indirect github.com/beevik/etree v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/coder/quartz v0.1.2 // indirect github.com/coder/quartz v0.1.2 // indirect
github.com/coreos/go-systemd/v22 v22.6.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dennwc/varint v1.0.0 // indirect github.com/dennwc/varint v1.0.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/docker/go-units v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect
github.com/ebitengine/purego v0.9.1 // indirect github.com/ebitengine/purego v0.8.4 // indirect
github.com/edsrzf/mmap-go v1.2.0 // indirect github.com/edsrzf/mmap-go v1.2.0 // indirect
github.com/elastic/lunes v0.2.0 // indirect github.com/elastic/lunes v0.1.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
github.com/expr-lang/expr v1.17.7 github.com/expr-lang/expr v1.17.5
github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb // indirect github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-faster/city v1.0.1 // indirect github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.7.1 // indirect github.com/go-faster/errors v0.7.1 // indirect
github.com/go-jose/go-jose/v4 v4.1.3 // indirect github.com/go-jose/go-jose/v4 v4.1.1 // indirect
github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-openapi/analysis v0.23.0 // indirect github.com/go-openapi/analysis v0.23.0 // indirect
github.com/go-openapi/errors v0.22.3 // indirect github.com/go-openapi/errors v0.22.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/loads v0.22.0 // indirect github.com/go-openapi/loads v0.22.0 // indirect
@@ -196,19 +178,19 @@ require (
github.com/google/btree v1.1.3 // indirect github.com/google/btree v1.1.3 // indirect
github.com/google/cel-go v0.26.1 // indirect github.com/google/cel-go v0.26.1 // indirect
github.com/google/s2a-go v0.1.9 // indirect github.com/google/s2a-go v0.1.9 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.7 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
github.com/googleapis/gax-go/v2 v2.15.0 // indirect github.com/googleapis/gax-go/v2 v2.14.2 // indirect
github.com/gopherjs/gopherjs v1.17.2 // indirect github.com/gopherjs/gopherjs v1.17.2 // indirect
github.com/grafana/regexp v0.0.0-20250905093917-f7b3be9d1853 // indirect github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-msgpack/v2 v2.1.1 // indirect github.com/hashicorp/go-msgpack/v2 v2.1.1 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-sockaddr v1.0.7 // indirect github.com/hashicorp/go-sockaddr v1.0.7 // indirect
github.com/hashicorp/go-version v1.8.0 // indirect github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/memberlist v0.5.1 // indirect github.com/hashicorp/memberlist v0.5.1 // indirect
@@ -224,21 +206,21 @@ require (
github.com/josharian/intern v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect github.com/jpillora/backoff v1.0.0 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/klauspost/compress v1.18.2 // indirect github.com/klauspost/compress v1.18.0 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/leodido/go-syslog/v4 v4.3.0 // indirect github.com/leodido/go-syslog/v4 v4.2.0 // indirect
github.com/leodido/ragel-machinery v0.0.0-20190525184631-5f46317e436b // indirect github.com/leodido/ragel-machinery v0.0.0-20190525184631-5f46317e436b // indirect
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 // indirect github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 // indirect
github.com/magefile/mage v1.15.0 // indirect github.com/magefile/mage v1.15.0 // indirect
github.com/mattermost/xml-roundtrip-validator v0.1.0 // indirect github.com/mattermost/xml-roundtrip-validator v0.1.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mdlayher/socket v0.5.1 // indirect github.com/mdlayher/socket v0.4.1 // indirect
github.com/mdlayher/vsock v1.2.1 // indirect github.com/mdlayher/vsock v1.2.1 // indirect
github.com/mfridman/interpolate v0.0.2 // indirect github.com/mfridman/interpolate v0.0.2 // indirect
github.com/miekg/dns v1.1.68 // indirect github.com/miekg/dns v1.1.65 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c // indirect github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect
@@ -247,14 +229,14 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/natefinch/wrap v0.2.0 // indirect github.com/natefinch/wrap v0.2.0 // indirect
github.com/oklog/run v1.2.0 // indirect github.com/oklog/run v1.1.0 // indirect
github.com/oklog/ulid v1.3.1 // indirect github.com/oklog/ulid v1.3.1 // indirect
github.com/oklog/ulid/v2 v2.1.1 github.com/oklog/ulid/v2 v2.1.1
github.com/open-feature/go-sdk v1.17.0 github.com/open-feature/go-sdk v1.17.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.142.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.128.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/exp/metrics v0.142.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/exp/metrics v0.128.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.142.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.128.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor v0.142.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor v0.128.0 // indirect
github.com/openfga/openfga v1.10.1 github.com/openfga/openfga v1.10.1
github.com/paulmach/orb v0.11.1 // indirect github.com/paulmach/orb v0.11.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect
@@ -264,10 +246,10 @@ require (
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/pressly/goose/v3 v3.25.0 // indirect github.com/pressly/goose/v3 v3.25.0 // indirect
github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/exporter-toolkit v0.15.0 // indirect github.com/prometheus/exporter-toolkit v0.14.0 // indirect
github.com/prometheus/otlptranslator v1.0.0 // indirect github.com/prometheus/otlptranslator v0.0.0-20250320144820-d800c8b0eb07 // indirect
github.com/prometheus/procfs v0.19.2 // indirect github.com/prometheus/procfs v0.16.1 // indirect
github.com/prometheus/sigv4 v0.3.0 // indirect github.com/prometheus/sigv4 v0.1.2 // indirect
github.com/puzpuzpuz/xsync/v3 v3.5.1 // indirect github.com/puzpuzpuz/xsync/v3 v3.5.1 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/sagikazarmark/locafero v0.9.0 // indirect github.com/sagikazarmark/locafero v0.9.0 // indirect
@@ -275,7 +257,7 @@ require (
github.com/segmentio/asm v1.2.0 // indirect github.com/segmentio/asm v1.2.0 // indirect
github.com/segmentio/backo-go v1.0.1 // indirect github.com/segmentio/backo-go v1.0.1 // indirect
github.com/sethvargo/go-retry v0.3.0 // indirect github.com/sethvargo/go-retry v0.3.0 // indirect
github.com/shirou/gopsutil/v4 v4.25.11 // indirect github.com/shirou/gopsutil/v4 v4.25.5 // indirect
github.com/shopspring/decimal v1.4.0 // indirect github.com/shopspring/decimal v1.4.0 // indirect
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c // indirect github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c // indirect
github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92 // indirect github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92 // indirect
@@ -290,9 +272,9 @@ require (
github.com/subosito/gotenv v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect
github.com/swaggest/openapi-go v0.2.60 github.com/swaggest/openapi-go v0.2.60
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.0 // indirect
github.com/tklauser/go-sysconf v0.3.16 // indirect github.com/tklauser/go-sysconf v0.3.15 // indirect
github.com/tklauser/numcpus v0.11.0 // indirect github.com/tklauser/numcpus v0.10.0 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
github.com/trivago/tgo v1.0.7 // indirect github.com/trivago/tgo v1.0.7 // indirect
github.com/valyala/fastjson v1.6.4 // indirect github.com/valyala/fastjson v1.6.4 // indirect
@@ -301,82 +283,83 @@ require (
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect github.com/zeebo/xxh3 v1.0.2 // indirect
go.mongodb.org/mongo-driver v1.17.4 // indirect go.mongodb.org/mongo-driver v1.17.1 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/collector/component v1.48.0 // indirect go.opentelemetry.io/collector/component v1.34.0 // indirect
go.opentelemetry.io/collector/component/componentstatus v0.142.0 // indirect go.opentelemetry.io/collector/component/componentstatus v0.128.0 // indirect
go.opentelemetry.io/collector/component/componenttest v0.142.0 // indirect go.opentelemetry.io/collector/component/componenttest v0.128.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.142.0 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.128.0 // indirect
go.opentelemetry.io/collector/confmap/provider/envprovider v1.48.0 // indirect go.opentelemetry.io/collector/confmap/provider/envprovider v1.34.0 // indirect
go.opentelemetry.io/collector/confmap/provider/fileprovider v1.48.0 // indirect go.opentelemetry.io/collector/confmap/provider/fileprovider v1.34.0 // indirect
go.opentelemetry.io/collector/confmap/xconfmap v0.142.0 // indirect go.opentelemetry.io/collector/confmap/xconfmap v0.128.0 // indirect
go.opentelemetry.io/collector/connector v0.142.0 // indirect go.opentelemetry.io/collector/connector v0.128.0 // indirect
go.opentelemetry.io/collector/connector/connectortest v0.142.0 // indirect go.opentelemetry.io/collector/connector/connectortest v0.128.0 // indirect
go.opentelemetry.io/collector/connector/xconnector v0.142.0 // indirect go.opentelemetry.io/collector/connector/xconnector v0.128.0 // indirect
go.opentelemetry.io/collector/consumer v1.48.0 // indirect go.opentelemetry.io/collector/consumer v1.34.0 // indirect
go.opentelemetry.io/collector/consumer/consumererror v0.142.0 // indirect go.opentelemetry.io/collector/consumer/consumererror v0.128.0 // indirect
go.opentelemetry.io/collector/consumer/consumertest v0.142.0 // indirect go.opentelemetry.io/collector/consumer/consumertest v0.128.0 // indirect
go.opentelemetry.io/collector/consumer/xconsumer v0.142.0 // indirect go.opentelemetry.io/collector/consumer/xconsumer v0.128.0 // indirect
go.opentelemetry.io/collector/exporter v1.48.0 // indirect go.opentelemetry.io/collector/exporter v0.128.0 // indirect
go.opentelemetry.io/collector/exporter/exportertest v0.142.0 // indirect go.opentelemetry.io/collector/exporter/exportertest v0.128.0 // indirect
go.opentelemetry.io/collector/exporter/xexporter v0.142.0 // indirect go.opentelemetry.io/collector/exporter/xexporter v0.128.0 // indirect
go.opentelemetry.io/collector/extension v1.48.0 // indirect go.opentelemetry.io/collector/extension v1.34.0 // indirect
go.opentelemetry.io/collector/extension/extensioncapabilities v0.142.0 // indirect go.opentelemetry.io/collector/extension/extensioncapabilities v0.128.0 // indirect
go.opentelemetry.io/collector/extension/extensiontest v0.142.0 // indirect go.opentelemetry.io/collector/extension/extensiontest v0.128.0 // indirect
go.opentelemetry.io/collector/extension/xextension v0.142.0 // indirect go.opentelemetry.io/collector/extension/xextension v0.128.0 // indirect
go.opentelemetry.io/collector/featuregate v1.48.0 // indirect go.opentelemetry.io/collector/featuregate v1.34.0 // indirect
go.opentelemetry.io/collector/internal/fanoutconsumer v0.142.0 // indirect go.opentelemetry.io/collector/internal/fanoutconsumer v0.128.0 // indirect
go.opentelemetry.io/collector/internal/telemetry v0.142.0 // indirect go.opentelemetry.io/collector/internal/telemetry v0.128.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.142.0 // indirect go.opentelemetry.io/collector/pdata/pprofile v0.128.0 // indirect
go.opentelemetry.io/collector/pdata/testdata v0.142.0 // indirect go.opentelemetry.io/collector/pdata/testdata v0.128.0 // indirect
go.opentelemetry.io/collector/pipeline v1.48.0 // indirect go.opentelemetry.io/collector/pipeline v0.128.0 // indirect
go.opentelemetry.io/collector/pipeline/xpipeline v0.142.0 // indirect go.opentelemetry.io/collector/pipeline/xpipeline v0.128.0 // indirect
go.opentelemetry.io/collector/processor v1.48.0 // indirect go.opentelemetry.io/collector/processor v1.34.0 // indirect
go.opentelemetry.io/collector/processor/processorhelper v0.142.0 // indirect go.opentelemetry.io/collector/processor/processorhelper v0.128.0 // indirect
go.opentelemetry.io/collector/processor/processortest v0.142.0 // indirect go.opentelemetry.io/collector/processor/processortest v0.128.0 // indirect
go.opentelemetry.io/collector/processor/xprocessor v0.142.0 // indirect go.opentelemetry.io/collector/processor/xprocessor v0.128.0 // indirect
go.opentelemetry.io/collector/receiver v1.48.0 // indirect go.opentelemetry.io/collector/receiver v1.34.0 // indirect
go.opentelemetry.io/collector/receiver/receiverhelper v0.142.0 // indirect go.opentelemetry.io/collector/receiver/receiverhelper v0.128.0 // indirect
go.opentelemetry.io/collector/receiver/receivertest v0.142.0 // indirect go.opentelemetry.io/collector/receiver/receivertest v0.128.0 // indirect
go.opentelemetry.io/collector/receiver/xreceiver v0.142.0 // indirect go.opentelemetry.io/collector/receiver/xreceiver v0.128.0 // indirect
go.opentelemetry.io/collector/semconv v0.128.1-0.20250610090210-188191247685 go.opentelemetry.io/collector/semconv v0.128.0
go.opentelemetry.io/collector/service v0.142.0 // indirect go.opentelemetry.io/collector/service v0.128.0 // indirect
go.opentelemetry.io/collector/service/hostcapabilities v0.142.0 // indirect go.opentelemetry.io/collector/service/hostcapabilities v0.128.0 // indirect
go.opentelemetry.io/contrib/bridges/otelzap v0.13.0 // indirect go.opentelemetry.io/contrib/bridges/otelzap v0.11.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0 // indirect
go.opentelemetry.io/contrib/otelconf v0.18.0 // indirect go.opentelemetry.io/contrib/otelconf v0.16.0 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.39.0 // indirect go.opentelemetry.io/contrib/propagators/b3 v1.36.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.12.2 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.12.2 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.39.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.36.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.39.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.36.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.39.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.36.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.60.0 go.opentelemetry.io/otel/exporters/prometheus v0.58.0
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.14.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.12.2 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.39.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.36.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.39.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0 // indirect
go.opentelemetry.io/otel/log v0.15.0 // indirect go.opentelemetry.io/otel/log v0.12.2 // indirect
go.opentelemetry.io/otel/sdk/log v0.14.0 // indirect go.opentelemetry.io/otel/sdk/log v0.12.2 // indirect
go.opentelemetry.io/otel/sdk/metric v1.39.0 go.opentelemetry.io/otel/sdk/metric v1.38.0
go.opentelemetry.io/proto/otlp v1.9.0 // indirect go.opentelemetry.io/proto/otlp v1.8.0 // indirect
go.uber.org/atomic v1.11.0 // indirect go.uber.org/atomic v1.11.0 // indirect
go.uber.org/mock v0.6.0 // indirect go.uber.org/mock v0.6.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/mod v0.30.0 // indirect golang.org/x/mod v0.30.0 // indirect
golang.org/x/sys v0.39.0 // indirect golang.org/x/sys v0.39.0 // indirect
golang.org/x/time v0.14.0 // indirect golang.org/x/time v0.11.0 // indirect
golang.org/x/tools v0.39.0 // indirect golang.org/x/tools v0.39.0 // indirect
gonum.org/v1/gonum v0.16.0 // indirect gonum.org/v1/gonum v0.16.0 // indirect
google.golang.org/api v0.257.0 google.golang.org/api v0.236.0
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect
google.golang.org/grpc v1.77.0 // indirect google.golang.org/grpc v1.75.1 // indirect
gopkg.in/telebot.v3 v3.3.8 // indirect gopkg.in/telebot.v3 v3.3.8 // indirect
k8s.io/client-go v0.34.2 // indirect k8s.io/client-go v0.34.0 // indirect
k8s.io/klog/v2 v2.130.1 // indirect k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
) )
replace github.com/expr-lang/expr => github.com/SigNoz/expr v1.17.7-beta replace github.com/expr-lang/expr => github.com/SigNoz/expr v1.17.7-beta

731
go.sum

File diff suppressed because it is too large Load Diff

View File

@@ -26,5 +26,22 @@ func (provider *provider) addAuthzRoutes(router *mux.Router) error {
return err return err
} }
if err := router.Handle("/api/v1/authz/resources", handler.New(provider.authZ.OpenAccess(provider.authzHandler.GetResources), handler.OpenAPIDef{
ID: "AuthzResources",
Tags: []string{"authz"},
Summary: "Get resources",
Description: "Gets all the available resources",
Request: nil,
RequestContentType: "",
Response: new(authtypes.GettableResources),
ResponseContentType: "application/json",
SuccessStatusCode: http.StatusOK,
ErrorStatusCodes: []int{},
Deprecated: false,
SecuritySchemes: nil,
})).Methods(http.MethodGet).GetError(); err != nil {
return err
}
return nil return nil
} }

View File

@@ -55,7 +55,7 @@ func (provider *provider) addGatewayRoutes(router *mux.Router) error {
RequestContentType: "application/json", RequestContentType: "application/json",
Response: new(gatewaytypes.GettableCreatedIngestionKey), Response: new(gatewaytypes.GettableCreatedIngestionKey),
ResponseContentType: "application/json", ResponseContentType: "application/json",
SuccessStatusCode: http.StatusOK, SuccessStatusCode: http.StatusCreated,
ErrorStatusCodes: []int{}, ErrorStatusCodes: []int{},
Deprecated: false, Deprecated: false,
SecuritySchemes: newSecuritySchemes(types.RoleAdmin), SecuritySchemes: newSecuritySchemes(types.RoleAdmin),

View File

@@ -81,7 +81,7 @@ func (provider *provider) addMetricsExplorerRoutes(router *mux.Router) error {
Response: new(metricsexplorertypes.MetricAttributesResponse), Response: new(metricsexplorertypes.MetricAttributesResponse),
ResponseContentType: "application/json", ResponseContentType: "application/json",
SuccessStatusCode: http.StatusOK, SuccessStatusCode: http.StatusOK,
ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusUnauthorized, http.StatusInternalServerError}, ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusUnauthorized, http.StatusNotFound, http.StatusInternalServerError},
Deprecated: false, Deprecated: false,
SecuritySchemes: newSecuritySchemes(types.RoleViewer), SecuritySchemes: newSecuritySchemes(types.RoleViewer),
})).Methods(http.MethodGet).GetError(); err != nil { })).Methods(http.MethodGet).GetError(); err != nil {
@@ -138,7 +138,7 @@ func (provider *provider) addMetricsExplorerRoutes(router *mux.Router) error {
Response: new(metricsexplorertypes.MetricHighlightsResponse), Response: new(metricsexplorertypes.MetricHighlightsResponse),
ResponseContentType: "application/json", ResponseContentType: "application/json",
SuccessStatusCode: http.StatusOK, SuccessStatusCode: http.StatusOK,
ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusUnauthorized, http.StatusInternalServerError}, ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusUnauthorized, http.StatusNotFound, http.StatusInternalServerError},
Deprecated: false, Deprecated: false,
SecuritySchemes: newSecuritySchemes(types.RoleViewer), SecuritySchemes: newSecuritySchemes(types.RoleViewer),
})).Methods(http.MethodGet).GetError(); err != nil { })).Methods(http.MethodGet).GetError(); err != nil {
@@ -157,7 +157,7 @@ func (provider *provider) addMetricsExplorerRoutes(router *mux.Router) error {
Response: new(metricsexplorertypes.MetricAlertsResponse), Response: new(metricsexplorertypes.MetricAlertsResponse),
ResponseContentType: "application/json", ResponseContentType: "application/json",
SuccessStatusCode: http.StatusOK, SuccessStatusCode: http.StatusOK,
ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusUnauthorized, http.StatusInternalServerError}, ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusUnauthorized, http.StatusNotFound, http.StatusInternalServerError},
Deprecated: false, Deprecated: false,
SecuritySchemes: newSecuritySchemes(types.RoleViewer), SecuritySchemes: newSecuritySchemes(types.RoleViewer),
})).Methods(http.MethodGet).GetError(); err != nil { })).Methods(http.MethodGet).GetError(); err != nil {
@@ -176,7 +176,7 @@ func (provider *provider) addMetricsExplorerRoutes(router *mux.Router) error {
Response: new(metricsexplorertypes.MetricDashboardsResponse), Response: new(metricsexplorertypes.MetricDashboardsResponse),
ResponseContentType: "application/json", ResponseContentType: "application/json",
SuccessStatusCode: http.StatusOK, SuccessStatusCode: http.StatusOK,
ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusUnauthorized, http.StatusInternalServerError}, ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusUnauthorized, http.StatusNotFound, http.StatusInternalServerError},
Deprecated: false, Deprecated: false,
SecuritySchemes: newSecuritySchemes(types.RoleViewer), SecuritySchemes: newSecuritySchemes(types.RoleViewer),
})).Methods(http.MethodGet).GetError(); err != nil { })).Methods(http.MethodGet).GetError(); err != nil {

View File

@@ -45,23 +45,6 @@ func (provider *provider) addRoleRoutes(router *mux.Router) error {
return err return err
} }
if err := router.Handle("/api/v1/roles/resources", handler.New(provider.authZ.AdminAccess(provider.authzHandler.GetResources), handler.OpenAPIDef{
ID: "GetResources",
Tags: []string{"role"},
Summary: "Get resources",
Description: "Gets all the available resources for role assignment",
Request: nil,
RequestContentType: "",
Response: new(roletypes.GettableResources),
ResponseContentType: "application/json",
SuccessStatusCode: http.StatusOK,
ErrorStatusCodes: []int{},
Deprecated: false,
SecuritySchemes: newSecuritySchemes(types.RoleAdmin),
})).Methods(http.MethodGet).GetError(); err != nil {
return err
}
if err := router.Handle("/api/v1/roles/{id}", handler.New(provider.authZ.AdminAccess(provider.authzHandler.Get), handler.OpenAPIDef{ if err := router.Handle("/api/v1/roles/{id}", handler.New(provider.authZ.AdminAccess(provider.authzHandler.Get), handler.OpenAPIDef{
ID: "GetRole", ID: "GetRole",
Tags: []string{"role"}, Tags: []string{"role"},
@@ -86,7 +69,7 @@ func (provider *provider) addRoleRoutes(router *mux.Router) error {
Description: "Gets all objects connected to the specified role via a given relation type", Description: "Gets all objects connected to the specified role via a given relation type",
Request: nil, Request: nil,
RequestContentType: "", RequestContentType: "",
Response: make([]*authtypes.Object, 0), Response: make([]*authtypes.GettableObjects, 0),
ResponseContentType: "application/json", ResponseContentType: "application/json",
SuccessStatusCode: http.StatusOK, SuccessStatusCode: http.StatusOK,
ErrorStatusCodes: []int{http.StatusNotFound, http.StatusNotImplemented, http.StatusUnavailableForLegalReasons}, ErrorStatusCodes: []int{http.StatusNotFound, http.StatusNotImplemented, http.StatusUnavailableForLegalReasons},
@@ -118,7 +101,7 @@ func (provider *provider) addRoleRoutes(router *mux.Router) error {
Tags: []string{"role"}, Tags: []string{"role"},
Summary: "Patch objects for a role by relation", Summary: "Patch objects for a role by relation",
Description: "Patches the objects connected to the specified role via a given relation type", Description: "Patches the objects connected to the specified role via a given relation type",
Request: new(roletypes.PatchableObjects), Request: new(authtypes.PatchableObjects),
RequestContentType: "", RequestContentType: "",
Response: nil, Response: nil,
ResponseContentType: "application/json", ResponseContentType: "application/json",

View File

@@ -190,7 +190,7 @@ func (provider *provider) GetOrCreate(_ context.Context, _ valuer.UUID, _ *rolet
} }
func (provider *provider) GetResources(_ context.Context) []*authtypes.Resource { func (provider *provider) GetResources(_ context.Context) []*authtypes.Resource {
return nil return []*authtypes.Resource{}
} }
func (provider *provider) GetObjects(ctx context.Context, orgID valuer.UUID, id valuer.UUID, relation authtypes.Relation) ([]*authtypes.Object, error) { func (provider *provider) GetObjects(ctx context.Context, orgID valuer.UUID, id valuer.UUID, relation authtypes.Relation) ([]*authtypes.Object, error) {

View File

@@ -110,13 +110,13 @@ func (handler *handler) GetObjects(rw http.ResponseWriter, r *http.Request) {
return return
} }
render.Success(rw, http.StatusOK, objects) render.Success(rw, http.StatusOK, authtypes.NewGettableObjects(objects))
} }
func (handler *handler) GetResources(rw http.ResponseWriter, r *http.Request) { func (handler *handler) GetResources(rw http.ResponseWriter, r *http.Request) {
resources := handler.authz.GetResources(r.Context()) resources := handler.authz.GetResources(r.Context())
render.Success(rw, http.StatusOK, roletypes.NewGettableResources(resources)) render.Success(rw, http.StatusOK, authtypes.NewGettableResources(resources))
} }
func (handler *handler) List(rw http.ResponseWriter, r *http.Request) { func (handler *handler) List(rw http.ResponseWriter, r *http.Request) {
@@ -197,25 +197,30 @@ func (handler *handler) PatchObjects(rw http.ResponseWriter, r *http.Request) {
return return
} }
req := new(roletypes.PatchableObjects)
if err := binding.JSON.BindBody(r.Body, req); err != nil {
render.Error(rw, err)
return
}
role, err := handler.authz.Get(ctx, valuer.MustNewUUID(claims.OrgID), id) role, err := handler.authz.Get(ctx, valuer.MustNewUUID(claims.OrgID), id)
if err != nil { if err != nil {
render.Error(rw, err) render.Error(rw, err)
return return
} }
patchableObjects, err := role.NewPatchableObjects(req.Additions, req.Deletions, relation) if err := role.ErrIfManaged(); err != nil {
render.Error(rw, err)
return
}
req := new(authtypes.PatchableObjects)
if err := binding.JSON.BindBody(r.Body, req); err != nil {
render.Error(rw, err)
return
}
additions, deletions, err := authtypes.NewPatchableObjects(req.Additions, req.Deletions, relation)
if err != nil { if err != nil {
render.Error(rw, err) render.Error(rw, err)
return return
} }
err = handler.authz.PatchObjects(ctx, valuer.MustNewUUID(claims.OrgID), role.Name, relation, patchableObjects.Additions, patchableObjects.Deletions) err = handler.authz.PatchObjects(ctx, valuer.MustNewUUID(claims.OrgID), role.Name, relation, additions, deletions)
if err != nil { if err != nil {
render.Error(rw, err) render.Error(rw, err)
return return

View File

@@ -6,8 +6,8 @@ import (
) )
type JSON struct { type JSON struct {
Code string `json:"code"` Code string `json:"code" required:"true"`
Message string `json:"message"` Message string `json:"message" required:"true"`
Url string `json:"url,omitempty"` Url string `json:"url,omitempty"`
Errors []responseerroradditional `json:"errors,omitempty"` Errors []responseerroradditional `json:"errors,omitempty"`
} }

View File

@@ -3,6 +3,7 @@ package configflagger
import ( import (
"context" "context"
"github.com/SigNoz/signoz/pkg/errors"
"github.com/SigNoz/signoz/pkg/factory" "github.com/SigNoz/signoz/pkg/factory"
"github.com/SigNoz/signoz/pkg/flagger" "github.com/SigNoz/signoz/pkg/flagger"
"github.com/SigNoz/signoz/pkg/types/featuretypes" "github.com/SigNoz/signoz/pkg/types/featuretypes"
@@ -32,6 +33,10 @@ func New(ctx context.Context, ps factory.ProviderSettings, c flagger.Config, reg
for name, value := range c.Config.Boolean { for name, value := range c.Config.Boolean {
feature, _, err := registry.GetByString(name) feature, _, err := registry.GetByString(name)
if err != nil { if err != nil {
if errors.Ast(err, errors.TypeNotFound) {
settings.Logger().WarnContext(ctx, "skipping unknown feature flag", "name", name, "kind", "boolean")
continue
}
return nil, err return nil, err
} }
@@ -46,6 +51,10 @@ func New(ctx context.Context, ps factory.ProviderSettings, c flagger.Config, reg
for name, value := range c.Config.String { for name, value := range c.Config.String {
feature, _, err := registry.GetByString(name) feature, _, err := registry.GetByString(name)
if err != nil { if err != nil {
if errors.Ast(err, errors.TypeNotFound) {
settings.Logger().WarnContext(ctx, "skipping unknown feature flag", "name", name, "kind", "string")
continue
}
return nil, err return nil, err
} }
@@ -60,6 +69,10 @@ func New(ctx context.Context, ps factory.ProviderSettings, c flagger.Config, reg
for name, value := range c.Config.Float { for name, value := range c.Config.Float {
feature, _, err := registry.GetByString(name) feature, _, err := registry.GetByString(name)
if err != nil { if err != nil {
if errors.Ast(err, errors.TypeNotFound) {
settings.Logger().WarnContext(ctx, "skipping unknown feature flag", "name", name, "kind", "float")
continue
}
return nil, err return nil, err
} }
@@ -74,6 +87,10 @@ func New(ctx context.Context, ps factory.ProviderSettings, c flagger.Config, reg
for name, value := range c.Config.Integer { for name, value := range c.Config.Integer {
feature, _, err := registry.GetByString(name) feature, _, err := registry.GetByString(name)
if err != nil { if err != nil {
if errors.Ast(err, errors.TypeNotFound) {
settings.Logger().WarnContext(ctx, "skipping unknown feature flag", "name", name, "kind", "integer")
continue
}
return nil, err return nil, err
} }
@@ -88,6 +105,10 @@ func New(ctx context.Context, ps factory.ProviderSettings, c flagger.Config, reg
for name, value := range c.Config.Object { for name, value := range c.Config.Object {
feature, _, err := registry.GetByString(name) feature, _, err := registry.GetByString(name)
if err != nil { if err != nil {
if errors.Ast(err, errors.TypeNotFound) {
settings.Logger().WarnContext(ctx, "skipping unknown feature flag", "name", name, "kind", "object")
continue
}
return nil, err return nil, err
} }

View File

@@ -5,6 +5,7 @@ import "github.com/SigNoz/signoz/pkg/types/featuretypes"
var ( var (
FeatureUseSpanMetrics = featuretypes.MustNewName("use_span_metrics") FeatureUseSpanMetrics = featuretypes.MustNewName("use_span_metrics")
FeatureKafkaSpanEval = featuretypes.MustNewName("kafka_span_eval") FeatureKafkaSpanEval = featuretypes.MustNewName("kafka_span_eval")
FeatureHideRootUser = featuretypes.MustNewName("hide_root_user")
) )
func MustNewRegistry() featuretypes.Registry { func MustNewRegistry() featuretypes.Registry {
@@ -25,6 +26,14 @@ func MustNewRegistry() featuretypes.Registry {
DefaultVariant: featuretypes.MustNewName("disabled"), DefaultVariant: featuretypes.MustNewName("disabled"),
Variants: featuretypes.NewBooleanVariants(), Variants: featuretypes.NewBooleanVariants(),
}, },
&featuretypes.Feature{
Name: FeatureHideRootUser,
Kind: featuretypes.KindBoolean,
Stage: featuretypes.StageStable,
Description: "Controls whether root admin user is hidden or not",
DefaultVariant: featuretypes.MustNewName("disabled"),
Variants: featuretypes.NewBooleanVariants(),
},
) )
if err != nil { if err != nil {
panic(err) panic(err)

View File

@@ -122,7 +122,7 @@ func (handler *handler) CreateIngestionKey(rw http.ResponseWriter, r *http.Reque
return return
} }
render.Success(rw, http.StatusOK, response) render.Success(rw, http.StatusCreated, response)
} }
func (handler *handler) UpdateIngestionKey(rw http.ResponseWriter, r *http.Request) { func (handler *handler) UpdateIngestionKey(rw http.ResponseWriter, r *http.Request) {

View File

@@ -16,13 +16,13 @@ const (
var json = jsoniter.ConfigCompatibleWithStandardLibrary var json = jsoniter.ConfigCompatibleWithStandardLibrary
type SuccessResponse struct { type SuccessResponse struct {
Status string `json:"status"` Status string `json:"status" required:"true"`
Data interface{} `json:"data,omitempty"` Data interface{} `json:"data,omitempty" required:"true"`
} }
type ErrorResponse struct { type ErrorResponse struct {
Status string `json:"status"` Status string `json:"status" required:"true"`
Error *errors.JSON `json:"error"` Error *errors.JSON `json:"error" required:"true"`
} }
func Success(rw http.ResponseWriter, httpCode int, data interface{}) { func Success(rw http.ResponseWriter, httpCode int, data interface{}) {

View File

@@ -1,6 +1,7 @@
package implmetricsexplorer package implmetricsexplorer
import ( import (
"context"
"net/http" "net/http"
"github.com/SigNoz/signoz/pkg/errors" "github.com/SigNoz/signoz/pkg/errors"
@@ -187,6 +188,12 @@ func (h *handler) GetMetricAlerts(rw http.ResponseWriter, req *http.Request) {
} }
orgID := valuer.MustNewUUID(claims.OrgID) orgID := valuer.MustNewUUID(claims.OrgID)
if err := h.checkMetricExists(req.Context(), orgID, metricName); err != nil {
render.Error(rw, err)
return
}
out, err := h.module.GetMetricAlerts(req.Context(), orgID, metricName) out, err := h.module.GetMetricAlerts(req.Context(), orgID, metricName)
if err != nil { if err != nil {
render.Error(rw, err) render.Error(rw, err)
@@ -209,6 +216,12 @@ func (h *handler) GetMetricDashboards(rw http.ResponseWriter, req *http.Request)
} }
orgID := valuer.MustNewUUID(claims.OrgID) orgID := valuer.MustNewUUID(claims.OrgID)
if err := h.checkMetricExists(req.Context(), orgID, metricName); err != nil {
render.Error(rw, err)
return
}
out, err := h.module.GetMetricDashboards(req.Context(), orgID, metricName) out, err := h.module.GetMetricDashboards(req.Context(), orgID, metricName)
if err != nil { if err != nil {
render.Error(rw, err) render.Error(rw, err)
@@ -231,6 +244,12 @@ func (h *handler) GetMetricHighlights(rw http.ResponseWriter, req *http.Request)
} }
orgID := valuer.MustNewUUID(claims.OrgID) orgID := valuer.MustNewUUID(claims.OrgID)
if err := h.checkMetricExists(req.Context(), orgID, metricName); err != nil {
render.Error(rw, err)
return
}
highlights, err := h.module.GetMetricHighlights(req.Context(), orgID, metricName) highlights, err := h.module.GetMetricHighlights(req.Context(), orgID, metricName)
if err != nil { if err != nil {
render.Error(rw, err) render.Error(rw, err)
@@ -266,6 +285,12 @@ func (h *handler) GetMetricAttributes(rw http.ResponseWriter, req *http.Request)
} }
orgID := valuer.MustNewUUID(claims.OrgID) orgID := valuer.MustNewUUID(claims.OrgID)
if err := h.checkMetricExists(req.Context(), orgID, metricName); err != nil {
render.Error(rw, err)
return
}
out, err := h.module.GetMetricAttributes(req.Context(), orgID, &in) out, err := h.module.GetMetricAttributes(req.Context(), orgID, &in)
if err != nil { if err != nil {
render.Error(rw, err) render.Error(rw, err)
@@ -274,3 +299,14 @@ func (h *handler) GetMetricAttributes(rw http.ResponseWriter, req *http.Request)
render.Success(rw, http.StatusOK, out) render.Success(rw, http.StatusOK, out)
} }
func (h *handler) checkMetricExists(ctx context.Context, orgID valuer.UUID, metricName string) error {
exists, err := h.module.CheckMetricExists(ctx, orgID, metricName)
if err != nil {
return err
}
if !exists {
return errors.NewNotFoundf(errors.CodeNotFound, "metric not found: %q", metricName)
}
return nil
}

View File

@@ -404,6 +404,26 @@ func (m *module) GetMetricAttributes(ctx context.Context, orgID valuer.UUID, req
}, nil }, nil
} }
func (m *module) CheckMetricExists(ctx context.Context, orgID valuer.UUID, metricName string) (bool, error) {
sb := sqlbuilder.NewSelectBuilder()
sb.Select("count(*) > 0 as metricExists")
sb.From(fmt.Sprintf("%s.%s", telemetrymetrics.DBName, telemetrymetrics.AttributesMetadataTableName))
sb.Where(sb.E("metric_name", metricName))
query, args := sb.BuildWithFlavor(sqlbuilder.ClickHouse)
db := m.telemetryStore.ClickhouseDB()
var exists bool
valueCtx := ctxtypes.SetClickhouseMaxThreads(ctx, m.config.TelemetryStore.Threads)
err := db.QueryRow(valueCtx, query, args...).Scan(&exists)
if err != nil {
return false, errors.WrapInternalf(err, errors.CodeInternal, "failed to check if metric exists")
}
return exists, nil
}
func (m *module) fetchMetadataFromCache(ctx context.Context, orgID valuer.UUID, metricNames []string) (map[string]*metricsexplorertypes.MetricMetadata, []string) { func (m *module) fetchMetadataFromCache(ctx context.Context, orgID valuer.UUID, metricNames []string) (map[string]*metricsexplorertypes.MetricMetadata, []string) {
hits := make(map[string]*metricsexplorertypes.MetricMetadata) hits := make(map[string]*metricsexplorertypes.MetricMetadata)
misses := make([]string, 0) misses := make([]string, 0)

View File

@@ -23,6 +23,7 @@ type Handler interface {
// Module represents the metrics module interface. // Module represents the metrics module interface.
type Module interface { type Module interface {
CheckMetricExists(ctx context.Context, orgID valuer.UUID, metricName string) (bool, error)
ListMetrics(ctx context.Context, orgID valuer.UUID, params *metricsexplorertypes.ListMetricsParams) (*metricsexplorertypes.ListMetricsResponse, error) ListMetrics(ctx context.Context, orgID valuer.UUID, params *metricsexplorertypes.ListMetricsParams) (*metricsexplorertypes.ListMetricsResponse, error)
GetStats(ctx context.Context, orgID valuer.UUID, req *metricsexplorertypes.StatsRequest) (*metricsexplorertypes.StatsResponse, error) GetStats(ctx context.Context, orgID valuer.UUID, req *metricsexplorertypes.StatsRequest) (*metricsexplorertypes.StatsResponse, error)
GetTreemap(ctx context.Context, orgID valuer.UUID, req *metricsexplorertypes.TreemapRequest) (*metricsexplorertypes.TreemapResponse, error) GetTreemap(ctx context.Context, orgID valuer.UUID, req *metricsexplorertypes.TreemapRequest) (*metricsexplorertypes.TreemapResponse, error)

View File

@@ -76,7 +76,7 @@ func (m *module) ListPromotedAndIndexedPaths(ctx context.Context) ([]promotetype
// add the paths that are not promoted but have indexes // add the paths that are not promoted but have indexes
for path, indexes := range aggr { for path, indexes := range aggr {
path := strings.TrimPrefix(path, telemetrylogs.BodyV2ColumnPrefix) path := strings.TrimPrefix(path, telemetrylogs.BodyJSONColumnPrefix)
path = telemetrytypes.BodyJSONStringSearchPrefix + path path = telemetrytypes.BodyJSONStringSearchPrefix + path
response = append(response, promotetypes.PromotePath{ response = append(response, promotetypes.PromotePath{
Path: path, Path: path,
@@ -156,7 +156,7 @@ func (m *module) PromoteAndIndexPaths(
} }
} }
if len(it.Indexes) > 0 { if len(it.Indexes) > 0 {
parentColumn := telemetrylogs.LogsV2BodyV2Column parentColumn := telemetrylogs.LogsV2BodyJSONColumn
// if the path is already promoted or is being promoted, add it to the promoted column // if the path is already promoted or is being promoted, add it to the promoted column
if _, promoted := existingPromotedPaths[it.Path]; promoted || it.Promote { if _, promoted := existingPromotedPaths[it.Path]; promoted || it.Promote {
parentColumn = telemetrylogs.LogsV2BodyPromotedColumn parentColumn = telemetrylogs.LogsV2BodyPromotedColumn

View File

@@ -120,6 +120,8 @@ func FilterResponse(results []*qbtypes.QueryRangeResponse) []*qbtypes.QueryRange
} }
} }
resultData.Rows = filteredRows resultData.Rows = filteredRows
case *qbtypes.ScalarData:
resultData.Data = filterScalarDataIPs(resultData.Columns, resultData.Data)
} }
filteredData = append(filteredData, result) filteredData = append(filteredData, result)
@@ -145,6 +147,39 @@ func shouldIncludeSeries(series *qbtypes.TimeSeries) bool {
return true return true
} }
func filterScalarDataIPs(columns []*qbtypes.ColumnDescriptor, data [][]any) [][]any {
// Find column indices for server address fields
serverColIndices := make([]int, 0)
for i, col := range columns {
if col.Name == derivedKeyHTTPHost {
serverColIndices = append(serverColIndices, i)
}
}
if len(serverColIndices) == 0 {
return data
}
filtered := make([][]any, 0, len(data))
for _, row := range data {
includeRow := true
for _, colIdx := range serverColIndices {
if colIdx < len(row) {
if strVal, ok := row[colIdx].(string); ok {
if net.ParseIP(strVal) != nil {
includeRow = false
break
}
}
}
}
if includeRow {
filtered = append(filtered, row)
}
}
return filtered
}
func shouldIncludeRow(row *qbtypes.RawRow) bool { func shouldIncludeRow(row *qbtypes.RawRow) bool {
if row.Data != nil { if row.Data != nil {
if domainVal, ok := row.Data[derivedKeyHTTPHost]; ok { if domainVal, ok := row.Data[derivedKeyHTTPHost]; ok {

View File

@@ -117,6 +117,59 @@ func TestFilterResponse(t *testing.T) {
}, },
}, },
}, },
{
name: "should filter out IP addresses from scalar data",
input: []*qbtypes.QueryRangeResponse{
{
Data: qbtypes.QueryData{
Results: []any{
&qbtypes.ScalarData{
QueryName: "endpoints",
Columns: []*qbtypes.ColumnDescriptor{
{
TelemetryFieldKey: telemetrytypes.TelemetryFieldKey{Name: derivedKeyHTTPHost},
Type: qbtypes.ColumnTypeGroup,
},
{
TelemetryFieldKey: telemetrytypes.TelemetryFieldKey{Name: "endpoints"},
Type: qbtypes.ColumnTypeAggregation,
},
},
Data: [][]any{
{"192.168.1.1", 10},
{"example.com", 20},
{"10.0.0.1", 5},
},
},
},
},
},
},
expected: []*qbtypes.QueryRangeResponse{
{
Data: qbtypes.QueryData{
Results: []any{
&qbtypes.ScalarData{
QueryName: "endpoints",
Columns: []*qbtypes.ColumnDescriptor{
{
TelemetryFieldKey: telemetrytypes.TelemetryFieldKey{Name: derivedKeyHTTPHost},
Type: qbtypes.ColumnTypeGroup,
},
{
TelemetryFieldKey: telemetrytypes.TelemetryFieldKey{Name: "endpoints"},
Type: qbtypes.ColumnTypeAggregation,
},
},
Data: [][]any{
{"example.com", 20},
},
},
},
},
},
},
},
} }
for _, tt := range tests { for _, tt := range tests {

View File

@@ -2,18 +2,22 @@ package impluser
import ( import (
"context" "context"
"slices"
"github.com/SigNoz/signoz/pkg/flagger"
"github.com/SigNoz/signoz/pkg/modules/user" "github.com/SigNoz/signoz/pkg/modules/user"
"github.com/SigNoz/signoz/pkg/types" "github.com/SigNoz/signoz/pkg/types"
"github.com/SigNoz/signoz/pkg/types/featuretypes"
"github.com/SigNoz/signoz/pkg/valuer" "github.com/SigNoz/signoz/pkg/valuer"
) )
type getter struct { type getter struct {
store types.UserStore store types.UserStore
flagger flagger.Flagger
} }
func NewGetter(store types.UserStore) user.Getter { func NewGetter(store types.UserStore, flagger flagger.Flagger) user.Getter {
return &getter{store: store} return &getter{store: store, flagger: flagger}
} }
func (module *getter) GetRootUserByOrgID(ctx context.Context, orgID valuer.UUID) (*types.User, error) { func (module *getter) GetRootUserByOrgID(ctx context.Context, orgID valuer.UUID) (*types.User, error) {
@@ -26,6 +30,14 @@ func (module *getter) ListByOrgID(ctx context.Context, orgID valuer.UUID) ([]*ty
return nil, err return nil, err
} }
// filter root users if feature flag `hide_root_users` is true
evalCtx := featuretypes.NewFlaggerEvaluationContext(orgID)
hideRootUsers := module.flagger.BooleanOrEmpty(ctx, flagger.FeatureHideRootUser, evalCtx)
if hideRootUsers {
users = slices.DeleteFunc(users, func(user *types.User) bool { return user.IsRoot })
}
return users, nil return users, nil
} }

View File

@@ -87,24 +87,6 @@ func (client *client) Read(ctx context.Context, query *prompb.Query, sortSeries
return remote.FromQueryResult(sortSeries, res), nil return remote.FromQueryResult(sortSeries, res), nil
} }
func (c *client) ReadMultiple(ctx context.Context, queries []*prompb.Query, sortSeries bool) (storage.SeriesSet, error) {
if len(queries) == 0 {
return storage.EmptySeriesSet(), nil
}
if len(queries) == 1 {
return c.Read(ctx, queries[0], sortSeries)
}
sets := make([]storage.SeriesSet, 0, len(queries))
for _, q := range queries {
ss, err := c.Read(ctx, q, sortSeries)
if err != nil {
return nil, err
}
sets = append(sets, ss)
}
return storage.NewMergeSeriesSet(sets, 0, storage.ChainedSeriesMerge), nil
}
func (client *client) queryToClickhouseQuery(_ context.Context, query *prompb.Query, metricName string, subQuery bool) (string, []any, error) { func (client *client) queryToClickhouseQuery(_ context.Context, query *prompb.Query, metricName string, subQuery bool) (string, []any, error) {
var clickHouseQuery string var clickHouseQuery string
var conditions []string var conditions []string

View File

@@ -2,7 +2,6 @@ package prometheus
import ( import (
"github.com/SigNoz/signoz/pkg/errors" "github.com/SigNoz/signoz/pkg/errors"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/promql"
) )
@@ -16,24 +15,30 @@ func RemoveExtraLabels(res *promql.Result, labelsToRemove ...string) error {
toRemove[l] = struct{}{} toRemove[l] = struct{}{}
} }
dropLabels := func(metric labels.Labels) labels.Labels {
b := labels.NewBuilder(metric)
for name := range toRemove {
b.Del(name)
}
return b.Labels()
}
switch res.Value.(type) { switch res.Value.(type) {
case promql.Vector: case promql.Vector:
value := res.Value.(promql.Vector) value := res.Value.(promql.Vector)
for i := range value { for i := range value {
(value)[i].Metric = dropLabels((value)[i].Metric) series := &(value)[i]
dst := series.Metric[:0]
for _, lbl := range series.Metric {
if _, drop := toRemove[lbl.Name]; !drop {
dst = append(dst, lbl)
}
}
series.Metric = dst
} }
case promql.Matrix: case promql.Matrix:
value := res.Value.(promql.Matrix) value := res.Value.(promql.Matrix)
for i := range value { for i := range value {
(value)[i].Metric = dropLabels((value)[i].Metric) series := &(value)[i]
dst := series.Metric[:0]
for _, lbl := range series.Metric {
if _, drop := toRemove[lbl.Name]; !drop {
dst = append(dst, lbl)
}
}
series.Metric = dst
} }
case promql.Scalar: case promql.Scalar:
return nil return nil

View File

@@ -10,9 +10,11 @@ import (
"github.com/ClickHouse/clickhouse-go/v2" "github.com/ClickHouse/clickhouse-go/v2"
"github.com/SigNoz/signoz/pkg/errors" "github.com/SigNoz/signoz/pkg/errors"
"github.com/SigNoz/signoz/pkg/telemetrylogs"
"github.com/SigNoz/signoz/pkg/telemetrystore" "github.com/SigNoz/signoz/pkg/telemetrystore"
qbtypes "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5" qbtypes "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/SigNoz/signoz/pkg/types/telemetrytypes" "github.com/SigNoz/signoz/pkg/types/telemetrytypes"
"github.com/bytedance/sonic"
) )
type builderQuery[T any] struct { type builderQuery[T any] struct {
@@ -248,6 +250,40 @@ func (q *builderQuery[T]) executeWithContext(ctx context.Context, query string,
return nil, err return nil, err
} }
// merge body_json and promoted into body
if q.spec.Signal == telemetrytypes.SignalLogs {
switch typedPayload := payload.(type) {
case *qbtypes.RawData:
for _, rr := range typedPayload.Rows {
seeder := func() error {
body, ok := rr.Data[telemetrylogs.LogsV2BodyJSONColumn].(map[string]any)
if !ok {
return nil
}
promoted, ok := rr.Data[telemetrylogs.LogsV2BodyPromotedColumn].(map[string]any)
if !ok {
return nil
}
seed(promoted, body)
str, err := sonic.MarshalString(body)
if err != nil {
return errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, "failed to marshal body")
}
rr.Data["body"] = str
return nil
}
err := seeder()
if err != nil {
return nil, err
}
delete(rr.Data, telemetrylogs.LogsV2BodyJSONColumn)
delete(rr.Data, telemetrylogs.LogsV2BodyPromotedColumn)
}
payload = typedPayload
}
}
return &qbtypes.Result{ return &qbtypes.Result{
Type: q.kind, Type: q.kind,
Value: payload, Value: payload,
@@ -375,3 +411,18 @@ func decodeCursor(cur string) (int64, error) {
} }
return strconv.ParseInt(string(b), 10, 64) return strconv.ParseInt(string(b), 10, 64)
} }
func seed(promoted map[string]any, body map[string]any) {
for key, fromValue := range promoted {
if toValue, ok := body[key]; !ok {
body[key] = fromValue
} else {
if fromValue, ok := fromValue.(map[string]any); ok {
if toValue, ok := toValue.(map[string]any); ok {
seed(fromValue, toValue)
body[key] = toValue
}
}
}
}
}

View File

@@ -14,6 +14,7 @@ import (
"github.com/ClickHouse/clickhouse-go/v2/lib/driver" "github.com/ClickHouse/clickhouse-go/v2/lib/driver"
qbtypes "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5" qbtypes "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/SigNoz/signoz/pkg/types/telemetrytypes" "github.com/SigNoz/signoz/pkg/types/telemetrytypes"
"github.com/bytedance/sonic"
) )
var ( var (
@@ -393,11 +394,17 @@ func readAsRaw(rows driver.Rows, queryName string) (*qbtypes.RawData, error) {
// de-reference the typed pointer to any // de-reference the typed pointer to any
val := reflect.ValueOf(cellPtr).Elem().Interface() val := reflect.ValueOf(cellPtr).Elem().Interface()
// Post-process JSON columns: normalize into String value
// Post-process JSON columns: normalize into structured values
if strings.HasPrefix(strings.ToUpper(colTypes[i].DatabaseTypeName()), "JSON") { if strings.HasPrefix(strings.ToUpper(colTypes[i].DatabaseTypeName()), "JSON") {
switch x := val.(type) { switch x := val.(type) {
case []byte: case []byte:
val = string(x) if len(x) > 0 {
var v any
if err := sonic.Unmarshal(x, &v); err == nil {
val = v
}
}
default: default:
// already a structured type (map[string]any, []any, etc.) // already a structured type (map[string]any, []any, etc.)
} }

View File

@@ -16,7 +16,6 @@ import (
"github.com/SigNoz/signoz/pkg/querybuilder" "github.com/SigNoz/signoz/pkg/querybuilder"
qbv5 "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5" qbv5 "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/SigNoz/signoz/pkg/types/telemetrytypes" "github.com/SigNoz/signoz/pkg/types/telemetrytypes"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/promql"
"github.com/prometheus/prometheus/promql/parser" "github.com/prometheus/prometheus/promql/parser"
) )
@@ -241,13 +240,13 @@ func (q *promqlQuery) Execute(ctx context.Context) (*qbv5.Result, error) {
var series []*qbv5.TimeSeries var series []*qbv5.TimeSeries
for _, v := range matrix { for _, v := range matrix {
var s qbv5.TimeSeries var s qbv5.TimeSeries
lbls := make([]*qbv5.Label, 0, v.Metric.Len()) lbls := make([]*qbv5.Label, 0, len(v.Metric))
v.Metric.Range(func(l labels.Label) { for name, value := range v.Metric.Copy().Map() {
lbls = append(lbls, &qbv5.Label{ lbls = append(lbls, &qbv5.Label{
Key: telemetrytypes.TelemetryFieldKey{Name: l.Name}, Key: telemetrytypes.TelemetryFieldKey{Name: name},
Value: l.Value, Value: value,
}) })
}) }
s.Labels = lbls s.Labels = lbls

View File

@@ -19,7 +19,6 @@ import (
qbtypes "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5" qbtypes "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/SigNoz/signoz/pkg/types/ruletypes" "github.com/SigNoz/signoz/pkg/types/ruletypes"
"github.com/SigNoz/signoz/pkg/valuer" "github.com/SigNoz/signoz/pkg/valuer"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/promql"
) )
@@ -462,12 +461,12 @@ func toCommonSeries(series promql.Series) v3.Series {
Points: make([]v3.Point, 0), Points: make([]v3.Point, 0),
} }
series.Metric.Range(func(l labels.Label) { for _, lbl := range series.Metric {
commonSeries.Labels[l.Name] = l.Value commonSeries.Labels[lbl.Name] = lbl.Value
commonSeries.LabelsArray = append(commonSeries.LabelsArray, map[string]string{ commonSeries.LabelsArray = append(commonSeries.LabelsArray, map[string]string{
l.Name: l.Value, lbl.Name: lbl.Value,
}) })
}) }
for _, f := range series.Floats { for _, f := range series.Floats {
commonSeries.Points = append(commonSeries.Points, v3.Point{ commonSeries.Points = append(commonSeries.Points, v3.Point{

View File

@@ -204,10 +204,7 @@ func DataTypeCollisionHandledFieldName(key *telemetrytypes.TelemetryFieldKey, va
// While we expect user not to send the mixed data types, it inevitably happens // While we expect user not to send the mixed data types, it inevitably happens
// So we handle the data type collisions here // So we handle the data type collisions here
switch key.FieldDataType { switch key.FieldDataType {
case telemetrytypes.FieldDataTypeString, telemetrytypes.FieldDataTypeArrayString, telemetrytypes.FieldDataTypeJSON: case telemetrytypes.FieldDataTypeString, telemetrytypes.FieldDataTypeArrayString:
if key.FieldDataType == telemetrytypes.FieldDataTypeJSON {
tblFieldName = fmt.Sprintf("toString(%s)", tblFieldName)
}
switch v := value.(type) { switch v := value.(type) {
case float64: case float64:
// try to convert the string value to to number // try to convert the string value to to number
@@ -222,6 +219,7 @@ func DataTypeCollisionHandledFieldName(key *telemetrytypes.TelemetryFieldKey, va
// we don't have a toBoolOrNull in ClickHouse, so we need to convert the bool to a string // we don't have a toBoolOrNull in ClickHouse, so we need to convert the bool to a string
value = fmt.Sprintf("%t", v) value = fmt.Sprintf("%t", v)
} }
case telemetrytypes.FieldDataTypeInt64, case telemetrytypes.FieldDataTypeInt64,
telemetrytypes.FieldDataTypeArrayInt64, telemetrytypes.FieldDataTypeArrayInt64,
telemetrytypes.FieldDataTypeNumber, telemetrytypes.FieldDataTypeNumber,

View File

@@ -313,30 +313,37 @@ func (v *filterExpressionVisitor) VisitPrimary(ctx *grammar.PrimaryContext) any
return "" return ""
} }
child := ctx.GetChild(0) child := ctx.GetChild(0)
var searchText string
if keyCtx, ok := child.(*grammar.KeyContext); ok { if keyCtx, ok := child.(*grammar.KeyContext); ok {
// create a full text search condition on the body field // create a full text search condition on the body field
searchText = keyCtx.GetText()
keyText := keyCtx.GetText()
cond, err := v.conditionBuilder.ConditionFor(context.Background(), v.fullTextColumn, qbtypes.FilterOperatorRegexp, FormatFullTextSearch(keyText), v.builder, v.startNs, v.endNs)
if err != nil {
v.errors = append(v.errors, fmt.Sprintf("failed to build full text search condition: %s", err.Error()))
return ""
}
return cond
} else if valCtx, ok := child.(*grammar.ValueContext); ok { } else if valCtx, ok := child.(*grammar.ValueContext); ok {
var text string
if valCtx.QUOTED_TEXT() != nil { if valCtx.QUOTED_TEXT() != nil {
searchText = trimQuotes(valCtx.QUOTED_TEXT().GetText()) text = trimQuotes(valCtx.QUOTED_TEXT().GetText())
} else if valCtx.NUMBER() != nil { } else if valCtx.NUMBER() != nil {
searchText = valCtx.NUMBER().GetText() text = valCtx.NUMBER().GetText()
} else if valCtx.BOOL() != nil { } else if valCtx.BOOL() != nil {
searchText = valCtx.BOOL().GetText() text = valCtx.BOOL().GetText()
} else if valCtx.KEY() != nil { } else if valCtx.KEY() != nil {
searchText = valCtx.KEY().GetText() text = valCtx.KEY().GetText()
} else { } else {
v.errors = append(v.errors, fmt.Sprintf("unsupported value type: %s", valCtx.GetText())) v.errors = append(v.errors, fmt.Sprintf("unsupported value type: %s", valCtx.GetText()))
return "" return ""
} }
cond, err := v.conditionBuilder.ConditionFor(context.Background(), v.fullTextColumn, qbtypes.FilterOperatorRegexp, FormatFullTextSearch(text), v.builder, v.startNs, v.endNs)
if err != nil {
v.errors = append(v.errors, fmt.Sprintf("failed to build full text search condition: %s", err.Error()))
return ""
}
return cond
} }
cond, err := v.conditionBuilder.ConditionFor(context.Background(), v.fullTextColumn, qbtypes.FilterOperatorRegexp, FormatFullTextSearch(searchText), v.builder, v.startNs, v.endNs)
if err != nil {
v.errors = append(v.errors, fmt.Sprintf("failed to build full text search condition: %s", err.Error()))
return ""
}
return cond
} }
return "" // Should not happen with valid input return "" // Should not happen with valid input
@@ -376,7 +383,6 @@ func (v *filterExpressionVisitor) VisitComparison(ctx *grammar.ComparisonContext
for _, key := range keys { for _, key := range keys {
condition, err := v.conditionBuilder.ConditionFor(context.Background(), key, op, nil, v.builder, v.startNs, v.endNs) condition, err := v.conditionBuilder.ConditionFor(context.Background(), key, op, nil, v.builder, v.startNs, v.endNs)
if err != nil { if err != nil {
v.errors = append(v.errors, fmt.Sprintf("failed to build condition: %s", err.Error()))
return "" return ""
} }
conds = append(conds, condition) conds = append(conds, condition)
@@ -642,6 +648,7 @@ func (v *filterExpressionVisitor) VisitValueList(ctx *grammar.ValueListContext)
// VisitFullText handles standalone quoted strings for full-text search // VisitFullText handles standalone quoted strings for full-text search
func (v *filterExpressionVisitor) VisitFullText(ctx *grammar.FullTextContext) any { func (v *filterExpressionVisitor) VisitFullText(ctx *grammar.FullTextContext) any {
if v.skipFullTextFilter { if v.skipFullTextFilter {
return "" return ""
} }
@@ -663,7 +670,6 @@ func (v *filterExpressionVisitor) VisitFullText(ctx *grammar.FullTextContext) an
v.errors = append(v.errors, fmt.Sprintf("failed to build full text search condition: %s", err.Error())) v.errors = append(v.errors, fmt.Sprintf("failed to build full text search condition: %s", err.Error()))
return "" return ""
} }
return cond return cond
} }

View File

@@ -11,8 +11,11 @@ import (
"github.com/SigNoz/signoz/pkg/alertmanager/signozalertmanager" "github.com/SigNoz/signoz/pkg/alertmanager/signozalertmanager"
"github.com/SigNoz/signoz/pkg/emailing/emailingtest" "github.com/SigNoz/signoz/pkg/emailing/emailingtest"
"github.com/SigNoz/signoz/pkg/factory/factorytest" "github.com/SigNoz/signoz/pkg/factory/factorytest"
"github.com/SigNoz/signoz/pkg/flagger"
"github.com/SigNoz/signoz/pkg/instrumentation/instrumentationtest"
"github.com/SigNoz/signoz/pkg/modules/dashboard/impldashboard" "github.com/SigNoz/signoz/pkg/modules/dashboard/impldashboard"
"github.com/SigNoz/signoz/pkg/modules/organization/implorganization" "github.com/SigNoz/signoz/pkg/modules/organization/implorganization"
"github.com/SigNoz/signoz/pkg/modules/user/impluser"
"github.com/SigNoz/signoz/pkg/querier" "github.com/SigNoz/signoz/pkg/querier"
"github.com/SigNoz/signoz/pkg/queryparser" "github.com/SigNoz/signoz/pkg/queryparser"
"github.com/SigNoz/signoz/pkg/sharder" "github.com/SigNoz/signoz/pkg/sharder"
@@ -41,7 +44,13 @@ func TestNewHandlers(t *testing.T) {
queryParser := queryparser.New(providerSettings) queryParser := queryparser.New(providerSettings)
require.NoError(t, err) require.NoError(t, err)
dashboardModule := impldashboard.NewModule(impldashboard.NewStore(sqlstore), providerSettings, nil, orgGetter, queryParser) dashboardModule := impldashboard.NewModule(impldashboard.NewStore(sqlstore), providerSettings, nil, orgGetter, queryParser)
modules := NewModules(sqlstore, tokenizer, emailing, providerSettings, orgGetter, alertmanager, nil, nil, nil, nil, nil, nil, nil, queryParser, Config{}, dashboardModule)
flagger, err := flagger.New(context.Background(), instrumentationtest.New().ToProviderSettings(), flagger.Config{}, flagger.MustNewRegistry())
require.NoError(t, err)
userGetter := impluser.NewGetter(impluser.NewStore(sqlstore, providerSettings), flagger)
modules := NewModules(sqlstore, tokenizer, emailing, providerSettings, orgGetter, alertmanager, nil, nil, nil, nil, nil, nil, nil, queryParser, Config{}, dashboardModule, userGetter)
querierHandler := querier.NewHandler(providerSettings, nil, nil) querierHandler := querier.NewHandler(providerSettings, nil, nil)
handlers := NewHandlers(modules, providerSettings, nil, querierHandler, nil, nil, nil, nil, nil, nil, nil) handlers := NewHandlers(modules, providerSettings, nil, querierHandler, nil, nil, nil, nil, nil, nil, nil)

View File

@@ -85,11 +85,11 @@ func NewModules(
queryParser queryparser.QueryParser, queryParser queryparser.QueryParser,
config Config, config Config,
dashboard dashboard.Module, dashboard dashboard.Module,
userGetter user.Getter,
) Modules { ) Modules {
quickfilter := implquickfilter.NewModule(implquickfilter.NewStore(sqlstore)) quickfilter := implquickfilter.NewModule(implquickfilter.NewStore(sqlstore))
orgSetter := implorganization.NewSetter(implorganization.NewStore(sqlstore), alertmanager, quickfilter) orgSetter := implorganization.NewSetter(implorganization.NewStore(sqlstore), alertmanager, quickfilter)
user := impluser.NewModule(impluser.NewStore(sqlstore, providerSettings), tokenizer, emailing, providerSettings, orgSetter, authz, analytics, config.User) user := impluser.NewModule(impluser.NewStore(sqlstore, providerSettings), tokenizer, emailing, providerSettings, orgSetter, authz, analytics, config.User)
userGetter := impluser.NewGetter(impluser.NewStore(sqlstore, providerSettings))
ruleStore := sqlrulestore.NewRuleStore(sqlstore, queryParser, providerSettings) ruleStore := sqlrulestore.NewRuleStore(sqlstore, queryParser, providerSettings)
return Modules{ return Modules{

View File

@@ -11,8 +11,11 @@ import (
"github.com/SigNoz/signoz/pkg/alertmanager/signozalertmanager" "github.com/SigNoz/signoz/pkg/alertmanager/signozalertmanager"
"github.com/SigNoz/signoz/pkg/emailing/emailingtest" "github.com/SigNoz/signoz/pkg/emailing/emailingtest"
"github.com/SigNoz/signoz/pkg/factory/factorytest" "github.com/SigNoz/signoz/pkg/factory/factorytest"
"github.com/SigNoz/signoz/pkg/flagger"
"github.com/SigNoz/signoz/pkg/instrumentation/instrumentationtest"
"github.com/SigNoz/signoz/pkg/modules/dashboard/impldashboard" "github.com/SigNoz/signoz/pkg/modules/dashboard/impldashboard"
"github.com/SigNoz/signoz/pkg/modules/organization/implorganization" "github.com/SigNoz/signoz/pkg/modules/organization/implorganization"
"github.com/SigNoz/signoz/pkg/modules/user/impluser"
"github.com/SigNoz/signoz/pkg/queryparser" "github.com/SigNoz/signoz/pkg/queryparser"
"github.com/SigNoz/signoz/pkg/sharder" "github.com/SigNoz/signoz/pkg/sharder"
"github.com/SigNoz/signoz/pkg/sharder/noopsharder" "github.com/SigNoz/signoz/pkg/sharder/noopsharder"
@@ -40,7 +43,13 @@ func TestNewModules(t *testing.T) {
queryParser := queryparser.New(providerSettings) queryParser := queryparser.New(providerSettings)
require.NoError(t, err) require.NoError(t, err)
dashboardModule := impldashboard.NewModule(impldashboard.NewStore(sqlstore), providerSettings, nil, orgGetter, queryParser) dashboardModule := impldashboard.NewModule(impldashboard.NewStore(sqlstore), providerSettings, nil, orgGetter, queryParser)
modules := NewModules(sqlstore, tokenizer, emailing, providerSettings, orgGetter, alertmanager, nil, nil, nil, nil, nil, nil, nil, queryParser, Config{}, dashboardModule)
flagger, err := flagger.New(context.Background(), instrumentationtest.New().ToProviderSettings(), flagger.Config{}, flagger.MustNewRegistry())
require.NoError(t, err)
userGetter := impluser.NewGetter(impluser.NewStore(sqlstore, providerSettings), flagger)
modules := NewModules(sqlstore, tokenizer, emailing, providerSettings, orgGetter, alertmanager, nil, nil, nil, nil, nil, nil, nil, queryParser, Config{}, dashboardModule, userGetter)
reflectVal := reflect.ValueOf(modules) reflectVal := reflect.ValueOf(modules)
for i := 0; i < reflectVal.NumField(); i++ { for i := 0; i < reflectVal.NumField(); i++ {

View File

@@ -1,11 +1,13 @@
package signoz package signoz
import ( import (
"context"
"testing" "testing"
"github.com/DATA-DOG/go-sqlmock" "github.com/DATA-DOG/go-sqlmock"
"github.com/SigNoz/signoz/pkg/alertmanager/nfmanager/nfmanagertest" "github.com/SigNoz/signoz/pkg/alertmanager/nfmanager/nfmanagertest"
"github.com/SigNoz/signoz/pkg/analytics" "github.com/SigNoz/signoz/pkg/analytics"
"github.com/SigNoz/signoz/pkg/flagger"
"github.com/SigNoz/signoz/pkg/instrumentation/instrumentationtest" "github.com/SigNoz/signoz/pkg/instrumentation/instrumentationtest"
"github.com/SigNoz/signoz/pkg/modules/organization/implorganization" "github.com/SigNoz/signoz/pkg/modules/organization/implorganization"
"github.com/SigNoz/signoz/pkg/modules/user/impluser" "github.com/SigNoz/signoz/pkg/modules/user/impluser"
@@ -75,7 +77,12 @@ func TestNewProviderFactories(t *testing.T) {
}) })
assert.NotPanics(t, func() { assert.NotPanics(t, func() {
userGetter := impluser.NewGetter(impluser.NewStore(sqlstoretest.New(sqlstore.Config{Provider: "sqlite"}, sqlmock.QueryMatcherEqual), instrumentationtest.New().ToProviderSettings())) flagger, err := flagger.New(context.Background(), instrumentationtest.New().ToProviderSettings(), flagger.Config{}, flagger.MustNewRegistry())
if err != nil {
panic(err)
}
userGetter := impluser.NewGetter(impluser.NewStore(sqlstoretest.New(sqlstore.Config{Provider: "sqlite"}, sqlmock.QueryMatcherEqual), instrumentationtest.New().ToProviderSettings()), flagger)
orgGetter := implorganization.NewGetter(implorganization.NewStore(sqlstoretest.New(sqlstore.Config{Provider: "sqlite"}, sqlmock.QueryMatcherEqual)), nil) orgGetter := implorganization.NewGetter(implorganization.NewStore(sqlstoretest.New(sqlstore.Config{Provider: "sqlite"}, sqlmock.QueryMatcherEqual)), nil)
telemetryStore := telemetrystoretest.New(telemetrystore.Config{Provider: "clickhouse"}, sqlmock.QueryMatcherEqual) telemetryStore := telemetrystoretest.New(telemetrystore.Config{Provider: "clickhouse"}, sqlmock.QueryMatcherEqual)
NewStatsReporterProviderFactories(telemetryStore, []statsreporter.StatsCollector{}, orgGetter, userGetter, tokenizertest.NewMockTokenizer(t), version.Build{}, analytics.Config{Enabled: true}) NewStatsReporterProviderFactories(telemetryStore, []statsreporter.StatsCollector{}, orgGetter, userGetter, tokenizertest.NewMockTokenizer(t), version.Build{}, analytics.Config{Enabled: true})

View File

@@ -280,7 +280,7 @@ func New(
} }
// Initialize user getter // Initialize user getter
userGetter := impluser.NewGetter(impluser.NewStore(sqlstore, providerSettings)) userGetter := impluser.NewGetter(impluser.NewStore(sqlstore, providerSettings), flagger)
licensingProviderFactory := licenseProviderFactory(sqlstore, zeus, orgGetter, analytics) licensingProviderFactory := licenseProviderFactory(sqlstore, zeus, orgGetter, analytics)
licensing, err := licensingProviderFactory.New( licensing, err := licensingProviderFactory.New(
@@ -388,7 +388,7 @@ func New(
} }
// Initialize all modules // Initialize all modules
modules := NewModules(sqlstore, tokenizer, emailing, providerSettings, orgGetter, alertmanager, analytics, querier, telemetrystore, telemetryMetadataStore, authNs, authz, cache, queryParser, config, dashboard) modules := NewModules(sqlstore, tokenizer, emailing, providerSettings, orgGetter, alertmanager, analytics, querier, telemetrystore, telemetryMetadataStore, authNs, authz, cache, queryParser, config, dashboard, userGetter)
userService := impluser.NewService(providerSettings, impluser.NewStore(sqlstore, providerSettings), modules.User, orgGetter, authz, config.User.Root) userService := impluser.NewService(providerSettings, impluser.NewStore(sqlstore, providerSettings), modules.User, orgGetter, authz, config.User.Root)

View File

@@ -35,7 +35,7 @@ func (c *conditionBuilder) conditionFor(
return "", err return "", err
} }
if column.Type.GetType() == schema.ColumnTypeEnumJSON && querybuilder.BodyJSONQueryEnabled { if column.IsJSONColumn() && querybuilder.BodyJSONQueryEnabled {
valueType, value := InferDataType(value, operator, key) valueType, value := InferDataType(value, operator, key)
cond, err := NewJSONConditionBuilder(key, valueType).buildJSONCondition(operator, value, sb) cond, err := NewJSONConditionBuilder(key, valueType).buildJSONCondition(operator, value, sb)
if err != nil { if err != nil {
@@ -108,6 +108,7 @@ func (c *conditionBuilder) conditionFor(
return sb.ILike(tblFieldName, fmt.Sprintf("%%%s%%", value)), nil return sb.ILike(tblFieldName, fmt.Sprintf("%%%s%%", value)), nil
case qbtypes.FilterOperatorNotContains: case qbtypes.FilterOperatorNotContains:
return sb.NotILike(tblFieldName, fmt.Sprintf("%%%s%%", value)), nil return sb.NotILike(tblFieldName, fmt.Sprintf("%%%s%%", value)), nil
case qbtypes.FilterOperatorRegexp: case qbtypes.FilterOperatorRegexp:
// Note: Escape $$ to $$$$ to avoid sqlbuilder interpreting materialized $ signs // Note: Escape $$ to $$$$ to avoid sqlbuilder interpreting materialized $ signs
// Only needed because we are using sprintf instead of sb.Match (not implemented in sqlbuilder) // Only needed because we are using sprintf instead of sb.Match (not implemented in sqlbuilder)
@@ -175,16 +176,9 @@ func (c *conditionBuilder) conditionFor(
var value any var value any
switch column.Type.GetType() { switch column.Type.GetType() {
case schema.ColumnTypeEnumJSON: case schema.ColumnTypeEnumJSON:
switch key.FieldDataType { if operator == qbtypes.FilterOperatorExists {
case telemetrytypes.FieldDataTypeJSON: return sb.IsNotNull(tblFieldName), nil
if operator == qbtypes.FilterOperatorExists { } else {
return sb.EQ(fmt.Sprintf("empty(%s)", tblFieldName), false), nil
}
return sb.EQ(fmt.Sprintf("empty(%s)", tblFieldName), true), nil
default:
if operator == qbtypes.FilterOperatorExists {
return sb.IsNotNull(tblFieldName), nil
}
return sb.IsNull(tblFieldName), nil return sb.IsNull(tblFieldName), nil
} }
case schema.ColumnTypeEnumLowCardinality: case schema.ColumnTypeEnumLowCardinality:

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