mirror of
https://github.com/SigNoz/signoz.git
synced 2026-02-26 10:22:35 +00:00
Compare commits
39 Commits
fix/remove
...
test-gener
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d53ee5053 | ||
|
|
c62b4d9141 | ||
|
|
5720fcb654 | ||
|
|
d32911b0fd | ||
|
|
22fcb7e9fb | ||
|
|
e8d009d225 | ||
|
|
25b143d21a | ||
|
|
4487050375 | ||
|
|
f3732611ca | ||
|
|
989ca522f8 | ||
|
|
9a2e9d76b5 | ||
|
|
2be42deecd | ||
|
|
95cad880cc | ||
|
|
cfef1091b3 | ||
|
|
4504c364f2 | ||
|
|
1a006870e1 | ||
|
|
e7a27a1cfb | ||
|
|
1e7323ead2 | ||
|
|
af4c6c5b52 | ||
|
|
02262ba245 | ||
|
|
df7c9e1339 | ||
|
|
ac5e52479f | ||
|
|
de56477bbb | ||
|
|
fddd8a27fa | ||
|
|
2aa4f8e237 | ||
|
|
74006a214b | ||
|
|
ed2cbacadc | ||
|
|
3cbd529843 | ||
|
|
78b481e895 | ||
|
|
215098ec0d | ||
|
|
5a4ef2e4ce | ||
|
|
b1f33c4f7f | ||
|
|
713c84b1e4 | ||
|
|
c3daf9e428 | ||
|
|
70a908deb1 | ||
|
|
cc9cdded3c | ||
|
|
77067cd614 | ||
|
|
ab703d9a65 | ||
|
|
611e8fbf9e |
@@ -41,23 +41,31 @@ services:
|
|||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
telemetrystore-migrator:
|
schema-migrator-sync:
|
||||||
image: signoz/signoz-otel-collector:v0.142.0
|
image: signoz/signoz-schema-migrator:v0.142.0
|
||||||
container_name: telemetrystore-migrator
|
container_name: schema-migrator-sync
|
||||||
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:
|
||||||
- -c
|
- sync
|
||||||
- |
|
- --cluster-name=cluster
|
||||||
/signoz-otel-collector migrate bootstrap &&
|
- --dsn=tcp://clickhouse:9000
|
||||||
/signoz-otel-collector migrate sync up &&
|
- --replication=true
|
||||||
/signoz-otel-collector migrate async up
|
- --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
|
||||||
|
|||||||
@@ -1,23 +1,14 @@
|
|||||||
services:
|
services:
|
||||||
signoz-otel-collector:
|
signoz-otel-collector:
|
||||||
image: signoz/signoz-otel-collector:v0.142.0
|
image: signoz/signoz-otel-collector:v0.129.6
|
||||||
container_name: signoz-otel-collector-dev
|
container_name: signoz-otel-collector-dev
|
||||||
entrypoint:
|
|
||||||
- /bin/sh
|
|
||||||
command:
|
command:
|
||||||
- -c
|
- --config=/etc/otel-collector-config.yaml
|
||||||
- |
|
|
||||||
/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
|
||||||
|
|||||||
6
.github/CODEOWNERS
vendored
6
.github/CODEOWNERS
vendored
@@ -43,12 +43,6 @@
|
|||||||
/pkg/analytics/ @vikrantgupta25
|
/pkg/analytics/ @vikrantgupta25
|
||||||
/pkg/statsreporter/ @vikrantgupta25
|
/pkg/statsreporter/ @vikrantgupta25
|
||||||
|
|
||||||
# Emailing Owners
|
|
||||||
|
|
||||||
/pkg/emailing/ @vikrantgupta25
|
|
||||||
/pkg/types/emailtypes/ @vikrantgupta25
|
|
||||||
/templates/email/ @vikrantgupta25
|
|
||||||
|
|
||||||
# Querier Owners
|
# Querier Owners
|
||||||
|
|
||||||
/pkg/querier/ @srikanthccv
|
/pkg/querier/ @srikanthccv
|
||||||
|
|||||||
5
.github/workflows/integrationci.yaml
vendored
5
.github/workflows/integrationci.yaml
vendored
@@ -48,15 +48,14 @@ 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.12.5
|
- 25.10.1
|
||||||
schema-migrator-version:
|
schema-migrator-version:
|
||||||
- v0.142.0
|
- v0.129.7
|
||||||
postgres-version:
|
postgres-version:
|
||||||
- 15
|
- 15
|
||||||
if: |
|
if: |
|
||||||
|
|||||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,11 +1,8 @@
|
|||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
# editor
|
|
||||||
.vscode
|
.vscode
|
||||||
!.vscode/settings.json
|
!.vscode/settings.json
|
||||||
.zed
|
|
||||||
.idea
|
|
||||||
|
|
||||||
deploy/docker/environment_tiny/common_test
|
deploy/docker/environment_tiny/common_test
|
||||||
frontend/node_modules
|
frontend/node_modules
|
||||||
@@ -34,6 +31,8 @@ frontend/yarn-debug.log*
|
|||||||
frontend/yarn-error.log*
|
frontend/yarn-error.log*
|
||||||
frontend/src/constants/env.ts
|
frontend/src/constants/env.ts
|
||||||
|
|
||||||
|
.idea
|
||||||
|
|
||||||
**/build
|
**/build
|
||||||
**/storage
|
**/storage
|
||||||
**/locust-scripts/__pycache__/
|
**/locust-scripts/__pycache__/
|
||||||
@@ -230,3 +229,5 @@ cython_debug/
|
|||||||
pyrightconfig.json
|
pyrightconfig.json
|
||||||
|
|
||||||
|
|
||||||
|
# cursor files
|
||||||
|
frontend/.cursor/
|
||||||
|
|||||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -14,8 +14,5 @@
|
|||||||
},
|
},
|
||||||
"[sql]": {
|
"[sql]": {
|
||||||
"editor.defaultFormatter": "adpyke.vscode-sql-formatter"
|
"editor.defaultFormatter": "adpyke.vscode-sql-formatter"
|
||||||
},
|
|
||||||
"[html]": {
|
|
||||||
"editor.defaultFormatter": "vscode.html-language-features"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,6 +176,25 @@ Wir haben Benchmarks veröffentlicht, die Loki mit SigNoz vergleichen. Schauen S
|
|||||||
Wir ❤️ Beiträge zum Projekt, egal ob große oder kleine. Bitte lies dir zuerst die [CONTRIBUTING.md](CONTRIBUTING.md), durch, bevor du anfängst, Beiträge zu SigNoz zu machen.
|
Wir ❤️ Beiträge zum Projekt, egal ob große oder kleine. Bitte lies dir zuerst die [CONTRIBUTING.md](CONTRIBUTING.md), durch, bevor du anfängst, Beiträge zu SigNoz zu machen.
|
||||||
Du bist dir nicht sicher, wie du anfangen sollst? Schreib uns einfach auf dem #contributing Kanal in unserer [slack community](https://signoz.io/slack)
|
Du bist dir nicht sicher, wie du anfangen sollst? Schreib uns einfach auf dem #contributing Kanal in unserer [slack community](https://signoz.io/slack)
|
||||||
|
|
||||||
|
### Unsere Projektbetreuer
|
||||||
|
|
||||||
|
#### Backend
|
||||||
|
|
||||||
|
- [Ankit Nayan](https://github.com/ankitnayan)
|
||||||
|
- [Nityananda Gohain](https://github.com/nityanandagohain)
|
||||||
|
- [Srikanth Chekuri](https://github.com/srikanthccv)
|
||||||
|
- [Vishal Sharma](https://github.com/makeavish)
|
||||||
|
|
||||||
|
#### Frontend
|
||||||
|
|
||||||
|
- [Palash Gupta](https://github.com/palashgdev)
|
||||||
|
- [Yunus M](https://github.com/YounixM)
|
||||||
|
- [Rajat Dabade](https://github.com/Rajat-Dabade)
|
||||||
|
|
||||||
|
#### DevOps
|
||||||
|
|
||||||
|
- [Prashant Shahi](https://github.com/prashant-shahi)
|
||||||
|
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
||||||
## Dokumentation
|
## Dokumentation
|
||||||
|
|||||||
28
README.md
28
README.md
@@ -221,6 +221,34 @@ We ❤️ contributions big or small. Please read [CONTRIBUTING.md](CONTRIBUTING
|
|||||||
|
|
||||||
Not sure how to get started? Just ping us on `#contributing` in our [slack community](https://signoz.io/slack)
|
Not sure how to get started? Just ping us on `#contributing` in our [slack community](https://signoz.io/slack)
|
||||||
|
|
||||||
|
### Project maintainers
|
||||||
|
|
||||||
|
#### Backend
|
||||||
|
|
||||||
|
- [Ankit Nayan](https://github.com/ankitnayan)
|
||||||
|
- [Nityananda Gohain](https://github.com/nityanandagohain)
|
||||||
|
- [Srikanth Chekuri](https://github.com/srikanthccv)
|
||||||
|
- [Vishal Sharma](https://github.com/makeavish)
|
||||||
|
- [Shivanshu Raj Shrivastava](https://github.com/shivanshuraj1333)
|
||||||
|
- [Ekansh Gupta](https://github.com/eKuG)
|
||||||
|
- [Aniket Agarwal](https://github.com/aniketio-ctrl)
|
||||||
|
|
||||||
|
#### Frontend
|
||||||
|
|
||||||
|
- [Yunus M](https://github.com/YounixM)
|
||||||
|
- [Vikrant Gupta](https://github.com/vikrantgupta25)
|
||||||
|
- [Sagar Rajput](https://github.com/SagarRajput-7)
|
||||||
|
- [Shaheer Kochai](https://github.com/ahmadshaheer)
|
||||||
|
- [Amlan Kumar Nandy](https://github.com/amlannandy)
|
||||||
|
- [Sahil Khan](https://github.com/sawhil)
|
||||||
|
- [Aditya Singh](https://github.com/aks07)
|
||||||
|
- [Abhi Kumar](https://github.com/ahrefabhi)
|
||||||
|
|
||||||
|
#### DevOps
|
||||||
|
|
||||||
|
- [Prashant Shahi](https://github.com/prashant-shahi)
|
||||||
|
- [Vibhu Pandey](https://github.com/therealpandey)
|
||||||
|
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -187,6 +187,25 @@ Jaeger 仅仅是一个分布式追踪系统。 但是 SigNoz 可以提供 metric
|
|||||||
|
|
||||||
如果你不知道如何开始? 只需要在 [slack 社区](https://signoz.io/slack) 通过 `#contributing` 频道联系我们。
|
如果你不知道如何开始? 只需要在 [slack 社区](https://signoz.io/slack) 通过 `#contributing` 频道联系我们。
|
||||||
|
|
||||||
|
### 项目维护人员
|
||||||
|
|
||||||
|
#### 后端
|
||||||
|
|
||||||
|
- [Ankit Nayan](https://github.com/ankitnayan)
|
||||||
|
- [Nityananda Gohain](https://github.com/nityanandagohain)
|
||||||
|
- [Srikanth Chekuri](https://github.com/srikanthccv)
|
||||||
|
- [Vishal Sharma](https://github.com/makeavish)
|
||||||
|
|
||||||
|
#### 前端
|
||||||
|
|
||||||
|
- [Palash Gupta](https://github.com/palashgdev)
|
||||||
|
- [Yunus M](https://github.com/YounixM)
|
||||||
|
- [Rajat Dabade](https://github.com/Rajat-Dabade)
|
||||||
|
|
||||||
|
#### 运维开发
|
||||||
|
|
||||||
|
- [Prashant Shahi](https://github.com/prashant-shahi)
|
||||||
|
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
||||||
## 文档
|
## 文档
|
||||||
|
|||||||
@@ -85,9 +85,6 @@ func runServer(ctx context.Context, config signoz.Config, logger *slog.Logger) e
|
|||||||
func(_ licensing.Licensing) factory.ProviderFactory[gateway.Gateway, gateway.Config] {
|
func(_ licensing.Licensing) factory.ProviderFactory[gateway.Gateway, gateway.Config] {
|
||||||
return noopgateway.NewProviderFactory()
|
return noopgateway.NewProviderFactory()
|
||||||
},
|
},
|
||||||
func(ps factory.ProviderSettings, q querier.Querier, a analytics.Analytics) querier.Handler {
|
|
||||||
return querier.NewHandler(ps, q, a)
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.ErrorContext(ctx, "failed to create signoz", "error", err)
|
logger.ErrorContext(ctx, "failed to create signoz", "error", err)
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import (
|
|||||||
"github.com/SigNoz/signoz/ee/authn/callbackauthn/oidccallbackauthn"
|
"github.com/SigNoz/signoz/ee/authn/callbackauthn/oidccallbackauthn"
|
||||||
"github.com/SigNoz/signoz/ee/authn/callbackauthn/samlcallbackauthn"
|
"github.com/SigNoz/signoz/ee/authn/callbackauthn/samlcallbackauthn"
|
||||||
"github.com/SigNoz/signoz/ee/authz/openfgaauthz"
|
"github.com/SigNoz/signoz/ee/authz/openfgaauthz"
|
||||||
eequerier "github.com/SigNoz/signoz/ee/querier"
|
|
||||||
"github.com/SigNoz/signoz/ee/authz/openfgaschema"
|
"github.com/SigNoz/signoz/ee/authz/openfgaschema"
|
||||||
"github.com/SigNoz/signoz/ee/gateway/httpgateway"
|
"github.com/SigNoz/signoz/ee/gateway/httpgateway"
|
||||||
enterpriselicensing "github.com/SigNoz/signoz/ee/licensing"
|
enterpriselicensing "github.com/SigNoz/signoz/ee/licensing"
|
||||||
@@ -125,10 +124,6 @@ func runServer(ctx context.Context, config signoz.Config, logger *slog.Logger) e
|
|||||||
func(licensing licensing.Licensing) factory.ProviderFactory[gateway.Gateway, gateway.Config] {
|
func(licensing licensing.Licensing) factory.ProviderFactory[gateway.Gateway, gateway.Config] {
|
||||||
return httpgateway.NewProviderFactory(licensing)
|
return httpgateway.NewProviderFactory(licensing)
|
||||||
},
|
},
|
||||||
func(ps factory.ProviderSettings, q querier.Querier, a analytics.Analytics) querier.Handler {
|
|
||||||
communityHandler := querier.NewHandler(ps, q, a)
|
|
||||||
return eequerier.NewHandler(ps, q, communityHandler)
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -193,15 +193,6 @@ emailing:
|
|||||||
templates:
|
templates:
|
||||||
# The directory containing the email templates. This directory should contain a list of files defined at pkg/types/emailtypes/template.go.
|
# The directory containing the email templates. This directory should contain a list of files defined at pkg/types/emailtypes/template.go.
|
||||||
directory: /opt/signoz/conf/templates/email
|
directory: /opt/signoz/conf/templates/email
|
||||||
format:
|
|
||||||
header:
|
|
||||||
enabled: false
|
|
||||||
logo_url: ""
|
|
||||||
help:
|
|
||||||
enabled: false
|
|
||||||
email: ""
|
|
||||||
footer:
|
|
||||||
enabled: false
|
|
||||||
smtp:
|
smtp:
|
||||||
# The SMTP server address.
|
# The SMTP server address.
|
||||||
address: localhost:25
|
address: localhost:25
|
||||||
@@ -294,6 +285,7 @@ flagger:
|
|||||||
config:
|
config:
|
||||||
boolean:
|
boolean:
|
||||||
use_span_metrics: true
|
use_span_metrics: true
|
||||||
|
interpolation_enabled: false
|
||||||
kafka_span_eval: false
|
kafka_span_eval: false
|
||||||
string:
|
string:
|
||||||
float:
|
float:
|
||||||
@@ -308,15 +300,3 @@ user:
|
|||||||
allow_self: true
|
allow_self: true
|
||||||
# The duration within which a user can reset their password.
|
# The duration within which a user can reset their password.
|
||||||
max_token_lifetime: 6h
|
max_token_lifetime: 6h
|
||||||
root:
|
|
||||||
# Whether to enable the root user. When enabled, a root user is provisioned
|
|
||||||
# on startup using the email and password below. The root user cannot be
|
|
||||||
# deleted, updated, or have their password changed through the UI.
|
|
||||||
enabled: false
|
|
||||||
# The email address of the root user.
|
|
||||||
email: ""
|
|
||||||
# The password of the root user. Must meet password requirements.
|
|
||||||
password: ""
|
|
||||||
# The name of the organization to create or look up for the root user.
|
|
||||||
org:
|
|
||||||
name: default
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ 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
|
||||||
@@ -135,17 +136,12 @@ 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:
|
||||||
@@ -155,17 +151,12 @@ 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:
|
||||||
@@ -175,32 +166,37 @@ 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.1
|
image: signoz/signoz:v0.111.0
|
||||||
|
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
|
||||||
@@ -213,48 +209,40 @@ services:
|
|||||||
retries: 3
|
retries: 3
|
||||||
otel-collector:
|
otel-collector:
|
||||||
!!merge <<: *db-depend
|
!!merge <<: *db-depend
|
||||||
image: signoz/signoz-otel-collector:v0.142.1
|
image: signoz/signoz-otel-collector:v0.142.0
|
||||||
entrypoint:
|
|
||||||
- /bin/sh
|
|
||||||
command:
|
command:
|
||||||
- -c
|
- --config=/etc/otel-collector-config.yaml
|
||||||
- |
|
- --manager-config=/etc/manager-config.yaml
|
||||||
/signoz-otel-collector migrate sync check &&
|
- --copy-path=/var/tmp/collector-config.yaml
|
||||||
/signoz-otel-collector --config=/etc/otel-collector-config.yaml --manager-config=/etc/manager-config.yaml --copy-path=/var/tmp/collector-config.yaml
|
volumes:
|
||||||
configs:
|
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
|
||||||
- source: otel-collector-config
|
- ../common/signoz/otel-collector-opamp-config.yaml:/etc/manager-config.yaml
|
||||||
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
|
||||||
signoz-telemetrystore-migrator:
|
depends_on:
|
||||||
!!merge <<: *db-depend
|
- clickhouse
|
||||||
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.0}
|
- schema-migrator
|
||||||
environment:
|
- signoz
|
||||||
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_DSN=tcp://clickhouse:9000
|
schema-migrator:
|
||||||
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_CLUSTER=cluster
|
!!merge <<: *common
|
||||||
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_REPLICATION=true
|
image: signoz/signoz-schema-migrator:v0.142.0
|
||||||
- SIGNOZ_OTEL_COLLECTOR_TIMEOUT=10m
|
deploy:
|
||||||
entrypoint:
|
restart_policy:
|
||||||
- /bin/sh
|
condition: on-failure
|
||||||
|
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="
|
||||||
/signoz-otel-collector migrate bootstrap &&
|
depends_on:
|
||||||
/signoz-otel-collector migrate sync up &&
|
- clickhouse
|
||||||
/signoz-otel-collector migrate async up
|
|
||||||
networks:
|
networks:
|
||||||
signoz-net:
|
signoz-net:
|
||||||
name: signoz-net
|
name: signoz-net
|
||||||
@@ -273,16 +261,3 @@ 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
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ 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
|
||||||
@@ -113,20 +114,30 @@ 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.1
|
image: signoz/signoz:v0.111.0
|
||||||
|
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
|
||||||
- SIGNOZ_TOKENIZER_JWT_SECRET=secret
|
- DASHBOARDS_PATH=/root/config/dashboards
|
||||||
|
- STORAGE=clickhouse
|
||||||
|
- GODEBUG=netdns=go
|
||||||
|
- TELEMETRY_ENABLED=true
|
||||||
|
- DEPLOYMENT_TYPE=docker-swarm
|
||||||
|
- DOT_METRICS_ENABLED=true
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test:
|
test:
|
||||||
- CMD
|
- CMD
|
||||||
@@ -139,14 +150,11 @@ services:
|
|||||||
retries: 3
|
retries: 3
|
||||||
otel-collector:
|
otel-collector:
|
||||||
!!merge <<: *db-depend
|
!!merge <<: *db-depend
|
||||||
image: signoz/signoz-otel-collector:v0.142.1
|
image: signoz/signoz-otel-collector:v0.142.0
|
||||||
entrypoint:
|
|
||||||
- /bin/sh
|
|
||||||
command:
|
command:
|
||||||
- -c
|
- --config=/etc/otel-collector-config.yaml
|
||||||
- |
|
- --manager-config=/etc/manager-config.yaml
|
||||||
/signoz-otel-collector migrate sync check &&
|
- --copy-path=/var/tmp/collector-config.yaml
|
||||||
/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
|
||||||
@@ -155,32 +163,29 @@ 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
|
||||||
signoz-telemetrystore-migrator:
|
depends_on:
|
||||||
!!merge <<: *db-depend
|
- clickhouse
|
||||||
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.0}
|
- schema-migrator
|
||||||
environment:
|
- signoz
|
||||||
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_DSN=tcp://clickhouse:9000
|
schema-migrator:
|
||||||
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_CLUSTER=cluster
|
!!merge <<: *common
|
||||||
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_REPLICATION=true
|
image: signoz/signoz-schema-migrator:v0.142.0
|
||||||
- SIGNOZ_OTEL_COLLECTOR_TIMEOUT=10m
|
deploy:
|
||||||
entrypoint:
|
restart_policy:
|
||||||
- /bin/sh
|
condition: on-failure
|
||||||
|
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="
|
||||||
/signoz-otel-collector migrate bootstrap &&
|
depends_on:
|
||||||
/signoz-otel-collector migrate sync up &&
|
- clickhouse
|
||||||
/signoz-otel-collector migrate async up
|
|
||||||
networks:
|
networks:
|
||||||
signoz-net:
|
signoz-net:
|
||||||
name: signoz-net
|
name: signoz-net
|
||||||
@@ -200,6 +205,14 @@ 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:
|
||||||
|
|||||||
@@ -62,10 +62,8 @@ x-db-depend: &db-depend
|
|||||||
depends_on:
|
depends_on:
|
||||||
clickhouse:
|
clickhouse:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
clickhouse-2:
|
schema-migrator-sync:
|
||||||
condition: service_healthy
|
condition: service_completed_successfully
|
||||||
clickhouse-3:
|
|
||||||
condition: service_healthy
|
|
||||||
services:
|
services:
|
||||||
init-clickhouse:
|
init-clickhouse:
|
||||||
!!merge <<: *common
|
!!merge <<: *common
|
||||||
@@ -181,17 +179,27 @@ 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.1}
|
image: signoz/signoz:${VERSION:-v0.111.0}
|
||||||
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
|
||||||
- SIGNOZ_TOKENIZER_JWT_SECRET=secret
|
- DASHBOARDS_PATH=/root/config/dashboards
|
||||||
|
- STORAGE=clickhouse
|
||||||
|
- GODEBUG=netdns=go
|
||||||
|
- TELEMETRY_ENABLED=true
|
||||||
|
- DEPLOYMENT_TYPE=docker-standalone-amd
|
||||||
|
- DOT_METRICS_ENABLED=true
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test:
|
test:
|
||||||
- CMD
|
- CMD
|
||||||
@@ -202,48 +210,51 @@ 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.1}
|
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.0}
|
||||||
container_name: signoz-otel-collector
|
container_name: signoz-otel-collector
|
||||||
entrypoint:
|
|
||||||
- /bin/sh
|
|
||||||
command:
|
command:
|
||||||
- -c
|
- --config=/etc/otel-collector-config.yaml
|
||||||
- |
|
- --manager-config=/etc/manager-config.yaml
|
||||||
/signoz-otel-collector migrate sync check &&
|
- --copy-path=/var/tmp/collector-config.yaml
|
||||||
/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
|
||||||
signoz-telemetrystore-migrator:
|
depends_on:
|
||||||
!!merge <<: *db-depend
|
clickhouse:
|
||||||
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.0}
|
condition: service_healthy
|
||||||
container_name: signoz-telemetrystore-migrator
|
schema-migrator-sync:
|
||||||
environment:
|
condition: service_completed_successfully
|
||||||
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_DSN=tcp://clickhouse:9000
|
signoz:
|
||||||
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_CLUSTER=cluster
|
condition: service_healthy
|
||||||
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_REPLICATION=true
|
schema-migrator-sync:
|
||||||
- SIGNOZ_OTEL_COLLECTOR_TIMEOUT=10m
|
!!merge <<: *common
|
||||||
entrypoint:
|
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-v0.142.0}
|
||||||
- /bin/sh
|
container_name: schema-migrator-sync
|
||||||
command:
|
command:
|
||||||
- -c
|
- sync
|
||||||
- |
|
- --dsn=tcp://clickhouse:9000
|
||||||
/signoz-otel-collector migrate bootstrap &&
|
- --up=
|
||||||
/signoz-otel-collector migrate sync up &&
|
depends_on:
|
||||||
/signoz-otel-collector migrate async up
|
clickhouse:
|
||||||
|
condition: service_healthy
|
||||||
|
schema-migrator-async:
|
||||||
|
!!merge <<: *db-depend
|
||||||
|
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-v0.142.0}
|
||||||
|
container_name: schema-migrator-async
|
||||||
|
command:
|
||||||
|
- async
|
||||||
|
- --dsn=tcp://clickhouse:9000
|
||||||
|
- --up=
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
networks:
|
networks:
|
||||||
signoz-net:
|
signoz-net:
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ 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
|
||||||
@@ -109,17 +111,27 @@ 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.1}
|
image: signoz/signoz:${VERSION:-v0.111.0}
|
||||||
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
|
||||||
- SIGNOZ_TOKENIZER_JWT_SECRET=secret
|
- DASHBOARDS_PATH=/root/config/dashboards
|
||||||
|
- STORAGE=clickhouse
|
||||||
|
- GODEBUG=netdns=go
|
||||||
|
- TELEMETRY_ENABLED=true
|
||||||
|
- DEPLOYMENT_TYPE=docker-standalone-amd
|
||||||
|
- DOT_METRICS_ENABLED=true
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test:
|
test:
|
||||||
- CMD
|
- CMD
|
||||||
@@ -132,46 +144,45 @@ services:
|
|||||||
retries: 3
|
retries: 3
|
||||||
otel-collector:
|
otel-collector:
|
||||||
!!merge <<: *db-depend
|
!!merge <<: *db-depend
|
||||||
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.1}
|
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.0}
|
||||||
container_name: signoz-otel-collector
|
container_name: signoz-otel-collector
|
||||||
entrypoint:
|
|
||||||
- /bin/sh
|
|
||||||
command:
|
command:
|
||||||
- -c
|
- --config=/etc/otel-collector-config.yaml
|
||||||
- |
|
- --manager-config=/etc/manager-config.yaml
|
||||||
/signoz-otel-collector migrate sync check &&
|
- --copy-path=/var/tmp/collector-config.yaml
|
||||||
/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
|
||||||
signoz-telemetrystore-migrator:
|
depends_on:
|
||||||
!!merge <<: *db-depend
|
signoz:
|
||||||
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-v0.142.0}
|
condition: service_healthy
|
||||||
container_name: signoz-telemetrystore-migrator
|
schema-migrator-sync:
|
||||||
environment:
|
!!merge <<: *common
|
||||||
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_DSN=tcp://clickhouse:9000
|
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-v0.142.0}
|
||||||
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_CLUSTER=cluster
|
container_name: schema-migrator-sync
|
||||||
- SIGNOZ_OTEL_COLLECTOR_CLICKHOUSE_REPLICATION=true
|
|
||||||
- SIGNOZ_OTEL_COLLECTOR_TIMEOUT=10m
|
|
||||||
entrypoint:
|
|
||||||
- /bin/sh
|
|
||||||
command:
|
command:
|
||||||
- -c
|
- sync
|
||||||
- |
|
- --dsn=tcp://clickhouse:9000
|
||||||
/signoz-otel-collector migrate bootstrap &&
|
- --up=
|
||||||
/signoz-otel-collector migrate sync up &&
|
depends_on:
|
||||||
/signoz-otel-collector migrate async up
|
clickhouse:
|
||||||
|
condition: service_healthy
|
||||||
|
restart: on-failure
|
||||||
|
schema-migrator-async:
|
||||||
|
!!merge <<: *db-depend
|
||||||
|
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-v0.142.0}
|
||||||
|
container_name: schema-migrator-async
|
||||||
|
command:
|
||||||
|
- async
|
||||||
|
- --dsn=tcp://clickhouse:9000
|
||||||
|
- --up=
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
networks:
|
networks:
|
||||||
signoz-net:
|
signoz-net:
|
||||||
|
|||||||
9282
docs/api/openapi.yml
9282
docs/api/openapi.yml
File diff suppressed because it is too large
Load Diff
@@ -155,7 +155,6 @@ The `handler.New` function ties the HTTP handler to OpenAPI metadata via `OpenAP
|
|||||||
- **Request / RequestContentType**:
|
- **Request / RequestContentType**:
|
||||||
- `Request` is a Go type that describes the request body or form.
|
- `Request` is a Go type that describes the request body or form.
|
||||||
- `RequestContentType` is usually `"application/json"` or `"application/x-www-form-urlencoded"` (for callbacks like SAML).
|
- `RequestContentType` is usually `"application/json"` or `"application/x-www-form-urlencoded"` (for callbacks like SAML).
|
||||||
- **RequestExamples**: An array of `handler.OpenAPIExample` that provide concrete request payloads in the generated spec. See [Adding request examples](#adding-request-examples) below.
|
|
||||||
- **Response / ResponseContentType**:
|
- **Response / ResponseContentType**:
|
||||||
- `Response` is the Go type for the successful response payload.
|
- `Response` is the Go type for the successful response payload.
|
||||||
- `ResponseContentType` is usually `"application/json"`; use `""` for responses without a body.
|
- `ResponseContentType` is usually `"application/json"`; use `""` for responses without a body.
|
||||||
@@ -173,170 +172,8 @@ See existing examples in:
|
|||||||
- `addUserRoutes` (for typical JSON request/response)
|
- `addUserRoutes` (for typical JSON request/response)
|
||||||
- `addSessionRoutes` (for form-encoded and redirect flows)
|
- `addSessionRoutes` (for form-encoded and redirect flows)
|
||||||
|
|
||||||
## OpenAPI schema details for request/response types
|
|
||||||
|
|
||||||
The OpenAPI spec is generated from the Go types you pass as `Request` and `Response` in `OpenAPIDef`. The following struct tags and interfaces control how those types appear in the generated schema.
|
|
||||||
|
|
||||||
### Adding request examples
|
|
||||||
|
|
||||||
Use the `RequestExamples` field in `OpenAPIDef` to provide concrete request payloads. Each example is a `handler.OpenAPIExample`:
|
|
||||||
|
|
||||||
```go
|
|
||||||
type OpenAPIExample struct {
|
|
||||||
Name string // unique key for the example (e.g. "traces_time_series")
|
|
||||||
Summary string // short description shown in docs (e.g. "Time series: count spans grouped by service")
|
|
||||||
Description string // optional longer description
|
|
||||||
Value any // the example payload, typically map[string]any
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
For reference, see `pkg/apiserver/signozapiserver/querier.go` which defines examples inline for the `/api/v5/query_range` endpoint:
|
|
||||||
|
|
||||||
```go
|
|
||||||
if err := router.Handle("/api/v5/query_range", handler.New(provider.authZ.ViewAccess(provider.querierHandler.QueryRange), handler.OpenAPIDef{
|
|
||||||
ID: "QueryRangeV5",
|
|
||||||
Tags: []string{"querier"},
|
|
||||||
Summary: "Query range",
|
|
||||||
Description: "Execute a composite query over a time range.",
|
|
||||||
Request: new(qbtypes.QueryRangeRequest),
|
|
||||||
RequestContentType: "application/json",
|
|
||||||
RequestExamples: []handler.OpenAPIExample{
|
|
||||||
{
|
|
||||||
Name: "traces_time_series",
|
|
||||||
Summary: "Time series: count spans grouped by service",
|
|
||||||
Value: map[string]any{
|
|
||||||
"schemaVersion": "v1",
|
|
||||||
"start": 1640995200000,
|
|
||||||
"end": 1640998800000,
|
|
||||||
"requestType": "time_series",
|
|
||||||
"compositeQuery": map[string]any{
|
|
||||||
"queries": []any{
|
|
||||||
map[string]any{
|
|
||||||
"type": "builder_query",
|
|
||||||
"spec": map[string]any{
|
|
||||||
"name": "A",
|
|
||||||
"signal": "traces",
|
|
||||||
// ...
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// ... more examples
|
|
||||||
},
|
|
||||||
// ...
|
|
||||||
})).Methods(http.MethodPost).GetError(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### `required` tag
|
|
||||||
|
|
||||||
Use `required:"true"` on struct fields where the property is expected to be **present** in the JSON payload. This is different from the zero value, a field can have its zero value (e.g. `0`, `""`, `false`) and still be required. The `required` tag means the key itself must exist in the JSON object.
|
|
||||||
|
|
||||||
```go
|
|
||||||
type ListItem struct {
|
|
||||||
...
|
|
||||||
}
|
|
||||||
|
|
||||||
type ListResponse struct {
|
|
||||||
List []ListItem `json:"list" required:"true" nullable:"true"`
|
|
||||||
Total uint64 `json:"total" required:"true"`
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
In this example, a response like `{"list": null, "total": 0}` is valid. Both keys are present (satisfying `required`), `total` has its zero value, and `list` is null (allowed by `nullable`). But `{"total": 0}` would violate the schema because the `list` key is missing.
|
|
||||||
|
|
||||||
### `nullable` tag
|
|
||||||
|
|
||||||
Use `nullable:"true"` on struct fields that can be `null` in the JSON payload. This is especially important for **slice and map fields** because in Go, the zero value for these types is `nil`, which serializes to `null` in JSON (not `[]` or `{}`).
|
|
||||||
|
|
||||||
Be explicit about the distinction:
|
|
||||||
|
|
||||||
- **Nullable list** (`nullable:"true"`): the field can be `null`. Use this when the Go code may return `nil` for the slice.
|
|
||||||
- **Non-nullable list** (no `nullable` tag): the field is always an array, never `null`. Ensure the Go code initializes it to an empty slice (e.g. `make([]T, 0)`) before serializing.
|
|
||||||
|
|
||||||
```go
|
|
||||||
// Non-nullable: Go code must ensure this is always an initialized slice.
|
|
||||||
type NonNullableExample struct {
|
|
||||||
Items []Item `json:"items" required:"true"`
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
When defining your types, ask yourself: "Can this field be `null` in the JSON response, or is it always an array/object?" If the Go code ever returns a `nil` slice or map, mark it `nullable:"true"`.
|
|
||||||
|
|
||||||
### `Enum()` method
|
|
||||||
|
|
||||||
For types that have a fixed set of acceptable values, implement the `Enum() []any` method. This generates an `enum` constraint in the JSON schema so the OpenAPI spec accurately restricts the values.
|
|
||||||
|
|
||||||
```go
|
|
||||||
type Signal struct {
|
|
||||||
valuer.String
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
SignalTraces = Signal{valuer.NewString("traces")}
|
|
||||||
SignalLogs = Signal{valuer.NewString("logs")}
|
|
||||||
SignalMetrics = Signal{valuer.NewString("metrics")}
|
|
||||||
)
|
|
||||||
|
|
||||||
func (Signal) Enum() []any {
|
|
||||||
return []any{
|
|
||||||
SignalTraces,
|
|
||||||
SignalLogs,
|
|
||||||
SignalMetrics,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
This produces the following in the generated OpenAPI spec:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Signal:
|
|
||||||
enum:
|
|
||||||
- traces
|
|
||||||
- logs
|
|
||||||
- metrics
|
|
||||||
type: string
|
|
||||||
```
|
|
||||||
|
|
||||||
Every type with a known set of values **must** implement `Enum()`. Without it, the JSON schema will only show the base type (e.g. `string`) with no value constraints.
|
|
||||||
|
|
||||||
### `JSONSchema()` method (custom schema)
|
|
||||||
|
|
||||||
For types that need a completely custom JSON schema (for example, a field that accepts either a string or a number), implement the `jsonschema.Exposer` interface:
|
|
||||||
|
|
||||||
```go
|
|
||||||
var _ jsonschema.Exposer = Step{}
|
|
||||||
|
|
||||||
func (Step) JSONSchema() (jsonschema.Schema, error) {
|
|
||||||
s := jsonschema.Schema{}
|
|
||||||
s.WithDescription("Step interval. Accepts a duration string or seconds.")
|
|
||||||
|
|
||||||
strSchema := jsonschema.Schema{}
|
|
||||||
strSchema.WithType(jsonschema.String.Type())
|
|
||||||
strSchema.WithExamples("60s", "5m", "1h")
|
|
||||||
|
|
||||||
numSchema := jsonschema.Schema{}
|
|
||||||
numSchema.WithType(jsonschema.Number.Type())
|
|
||||||
numSchema.WithExamples(60, 300, 3600)
|
|
||||||
|
|
||||||
s.OneOf = []jsonschema.SchemaOrBool{
|
|
||||||
strSchema.ToSchemaOrBool(),
|
|
||||||
numSchema.ToSchemaOrBool(),
|
|
||||||
}
|
|
||||||
return s, nil
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## What should I remember?
|
## What should I remember?
|
||||||
|
|
||||||
- **Keep handlers thin**: focus on HTTP concerns and delegate logic to modules/services.
|
- **Keep handlers thin**: focus on HTTP concerns and delegate logic to modules/services.
|
||||||
- **Always register routes through `signozapiserver`** using `handler.New` and a complete `OpenAPIDef`.
|
- **Always register routes through `signozapiserver`** using `handler.New` and a complete `OpenAPIDef`.
|
||||||
- **Choose accurate request/response types** from the `types` packages so OpenAPI schemas are correct.
|
- **Choose accurate request/response types** from the `types` packages so OpenAPI schemas are correct.
|
||||||
- **Add `required:"true"`** on fields where the key must be present in the JSON (this is about key presence, not about the zero value).
|
|
||||||
- **Add `nullable:"true"`** on fields that can be `null`. Pay special attention to slices and maps -- in Go these default to `nil` which serializes to `null`. If the field should always be an array, initialize it and do not mark it nullable.
|
|
||||||
- **Implement `Enum()`** on every type that has a fixed set of acceptable values so the JSON schema generates proper `enum` constraints.
|
|
||||||
- **Add request examples** via `RequestExamples` in `OpenAPIDef` for any non-trivial endpoint. See `pkg/apiserver/signozapiserver/querier.go` for reference.
|
|
||||||
|
|||||||
@@ -62,6 +62,10 @@ func (provider *provider) Stop(ctx context.Context) error {
|
|||||||
return provider.openfgaServer.Stop(ctx)
|
return provider.openfgaServer.Stop(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (provider *provider) Check(ctx context.Context, tuple *openfgav1.TupleKey) error {
|
||||||
|
return provider.openfgaServer.Check(ctx, tuple)
|
||||||
|
}
|
||||||
|
|
||||||
func (provider *provider) CheckWithTupleCreation(ctx context.Context, claims authtypes.Claims, orgID valuer.UUID, relation authtypes.Relation, typeable authtypes.Typeable, selectors []authtypes.Selector, roleSelectors []authtypes.Selector) error {
|
func (provider *provider) CheckWithTupleCreation(ctx context.Context, claims authtypes.Claims, orgID valuer.UUID, relation authtypes.Relation, typeable authtypes.Typeable, selectors []authtypes.Selector, roleSelectors []authtypes.Selector) error {
|
||||||
return provider.openfgaServer.CheckWithTupleCreation(ctx, claims, orgID, relation, typeable, selectors, roleSelectors)
|
return provider.openfgaServer.CheckWithTupleCreation(ctx, claims, orgID, relation, typeable, selectors, roleSelectors)
|
||||||
}
|
}
|
||||||
@@ -70,8 +74,8 @@ func (provider *provider) CheckWithTupleCreationWithoutClaims(ctx context.Contex
|
|||||||
return provider.openfgaServer.CheckWithTupleCreationWithoutClaims(ctx, orgID, relation, typeable, selectors, roleSelectors)
|
return provider.openfgaServer.CheckWithTupleCreationWithoutClaims(ctx, orgID, relation, typeable, selectors, roleSelectors)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provider *provider) BatchCheck(ctx context.Context, tupleReq map[string]*openfgav1.TupleKey) (map[string]*authtypes.TupleKeyAuthorization, error) {
|
func (provider *provider) BatchCheck(ctx context.Context, tuples []*openfgav1.TupleKey) error {
|
||||||
return provider.openfgaServer.BatchCheck(ctx, tupleReq)
|
return provider.openfgaServer.BatchCheck(ctx, tuples)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provider *provider) ListObjects(ctx context.Context, subject string, relation authtypes.Relation, typeable authtypes.Typeable) ([]*authtypes.Object, error) {
|
func (provider *provider) ListObjects(ctx context.Context, subject string, relation authtypes.Relation, typeable authtypes.Typeable) ([]*authtypes.Object, error) {
|
||||||
@@ -171,6 +175,8 @@ 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 {
|
||||||
@@ -181,11 +187,6 @@ func (provider *provider) GetResources(_ context.Context) []*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) {
|
||||||
_, err := provider.licensing.GetActive(ctx, orgID)
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.New(errors.TypeLicenseUnavailable, errors.CodeLicenseUnavailable, "a valid license is not available").WithAdditional("this feature requires a valid license").WithAdditional(err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
storableRole, err := provider.store.Get(ctx, orgID, id)
|
storableRole, err := provider.store.Get(ctx, orgID, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -197,7 +198,7 @@ func (provider *provider) GetObjects(ctx context.Context, orgID valuer.UUID, id
|
|||||||
resourceObjects, err := provider.
|
resourceObjects, err := provider.
|
||||||
ListObjects(
|
ListObjects(
|
||||||
ctx,
|
ctx,
|
||||||
authtypes.MustNewSubject(authtypes.TypeableRole, storableRole.Name, orgID, &authtypes.RelationAssignee),
|
authtypes.MustNewSubject(authtypes.TypeableRole, storableRole.ID.String(), orgID, &authtypes.RelationAssignee),
|
||||||
relation,
|
relation,
|
||||||
authtypes.MustNewTypeableFromType(resource.Type, resource.Name),
|
authtypes.MustNewTypeableFromType(resource.Type, resource.Name),
|
||||||
)
|
)
|
||||||
@@ -257,7 +258,7 @@ func (provider *provider) Delete(ctx context.Context, orgID valuer.UUID, id valu
|
|||||||
}
|
}
|
||||||
|
|
||||||
role := roletypes.NewRoleFromStorableRole(storableRole)
|
role := roletypes.NewRoleFromStorableRole(storableRole)
|
||||||
err = role.ErrIfManaged()
|
err = role.CanEditDelete()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ package openfgaserver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/SigNoz/signoz/pkg/authz"
|
"github.com/SigNoz/signoz/pkg/authz"
|
||||||
"github.com/SigNoz/signoz/pkg/errors"
|
|
||||||
"github.com/SigNoz/signoz/pkg/types/authtypes"
|
"github.com/SigNoz/signoz/pkg/types/authtypes"
|
||||||
"github.com/SigNoz/signoz/pkg/valuer"
|
"github.com/SigNoz/signoz/pkg/valuer"
|
||||||
openfgav1 "github.com/openfga/api/proto/openfga/v1"
|
openfgav1 "github.com/openfga/api/proto/openfga/v1"
|
||||||
@@ -30,34 +28,27 @@ func (server *Server) Stop(ctx context.Context) error {
|
|||||||
return server.pkgAuthzService.Stop(ctx)
|
return server.pkgAuthzService.Stop(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (server *Server) Check(ctx context.Context, tuple *openfgav1.TupleKey) error {
|
||||||
|
return server.pkgAuthzService.Check(ctx, tuple)
|
||||||
|
}
|
||||||
|
|
||||||
func (server *Server) CheckWithTupleCreation(ctx context.Context, claims authtypes.Claims, orgID valuer.UUID, relation authtypes.Relation, typeable authtypes.Typeable, selectors []authtypes.Selector, _ []authtypes.Selector) error {
|
func (server *Server) CheckWithTupleCreation(ctx context.Context, claims authtypes.Claims, orgID valuer.UUID, relation authtypes.Relation, typeable authtypes.Typeable, selectors []authtypes.Selector, _ []authtypes.Selector) error {
|
||||||
subject, err := authtypes.NewSubject(authtypes.TypeableUser, claims.UserID, orgID, nil)
|
subject, err := authtypes.NewSubject(authtypes.TypeableUser, claims.UserID, orgID, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
tupleSlice, err := typeable.Tuples(subject, relation, selectors, orgID)
|
tuples, err := typeable.Tuples(subject, relation, selectors, orgID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
tuples := make(map[string]*openfgav1.TupleKey, len(tupleSlice))
|
err = server.BatchCheck(ctx, tuples)
|
||||||
for idx, tuple := range tupleSlice {
|
|
||||||
tuples[strconv.Itoa(idx)] = tuple
|
|
||||||
}
|
|
||||||
|
|
||||||
response, err := server.BatchCheck(ctx, tuples)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, resp := range response {
|
return nil
|
||||||
if resp.Authorized {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return errors.Newf(errors.TypeForbidden, authtypes.ErrCodeAuthZForbidden, "subjects are not authorized for requested access")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (server *Server) CheckWithTupleCreationWithoutClaims(ctx context.Context, orgID valuer.UUID, relation authtypes.Relation, typeable authtypes.Typeable, selectors []authtypes.Selector, _ []authtypes.Selector) error {
|
func (server *Server) CheckWithTupleCreationWithoutClaims(ctx context.Context, orgID valuer.UUID, relation authtypes.Relation, typeable authtypes.Typeable, selectors []authtypes.Selector, _ []authtypes.Selector) error {
|
||||||
@@ -66,32 +57,21 @@ func (server *Server) CheckWithTupleCreationWithoutClaims(ctx context.Context, o
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
tupleSlice, err := typeable.Tuples(subject, relation, selectors, orgID)
|
tuples, err := typeable.Tuples(subject, relation, selectors, orgID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
tuples := make(map[string]*openfgav1.TupleKey, len(tupleSlice))
|
err = server.BatchCheck(ctx, tuples)
|
||||||
for idx, tuple := range tupleSlice {
|
|
||||||
tuples[strconv.Itoa(idx)] = tuple
|
|
||||||
}
|
|
||||||
|
|
||||||
response, err := server.BatchCheck(ctx, tuples)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, resp := range response {
|
return nil
|
||||||
if resp.Authorized {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return errors.Newf(errors.TypeForbidden, authtypes.ErrCodeAuthZForbidden, "subjects are not authorized for requested access")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (server *Server) BatchCheck(ctx context.Context, tupleReq map[string]*openfgav1.TupleKey) (map[string]*authtypes.TupleKeyAuthorization, error) {
|
func (server *Server) BatchCheck(ctx context.Context, tuples []*openfgav1.TupleKey) error {
|
||||||
return server.pkgAuthzService.BatchCheck(ctx, tupleReq)
|
return server.pkgAuthzService.BatchCheck(ctx, tuples)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (server *Server) ListObjects(ctx context.Context, subject string, relation authtypes.Relation, typeable authtypes.Typeable) ([]*authtypes.Object, error) {
|
func (server *Server) ListObjects(ctx context.Context, subject string, relation authtypes.Relation, typeable authtypes.Typeable) ([]*authtypes.Object, error) {
|
||||||
|
|||||||
@@ -220,7 +220,6 @@ func (module *module) MustGetManagedRoleTransactions() map[string][]*authtypes.T
|
|||||||
return map[string][]*authtypes.Transaction{
|
return map[string][]*authtypes.Transaction{
|
||||||
roletypes.SigNozAnonymousRoleName: {
|
roletypes.SigNozAnonymousRoleName: {
|
||||||
{
|
{
|
||||||
ID: valuer.GenerateUUID(),
|
|
||||||
Relation: authtypes.RelationRead,
|
Relation: authtypes.RelationRead,
|
||||||
Object: *authtypes.MustNewObject(
|
Object: *authtypes.MustNewObject(
|
||||||
authtypes.Resource{
|
authtypes.Resource{
|
||||||
|
|||||||
@@ -1,178 +0,0 @@
|
|||||||
package querier
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"context"
|
|
||||||
"encoding/json"
|
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
"runtime/debug"
|
|
||||||
|
|
||||||
anomalyV2 "github.com/SigNoz/signoz/ee/anomaly"
|
|
||||||
"github.com/SigNoz/signoz/pkg/errors"
|
|
||||||
"github.com/SigNoz/signoz/pkg/factory"
|
|
||||||
"github.com/SigNoz/signoz/pkg/http/render"
|
|
||||||
"github.com/SigNoz/signoz/pkg/querier"
|
|
||||||
"github.com/SigNoz/signoz/pkg/types/authtypes"
|
|
||||||
qbtypes "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5"
|
|
||||||
"github.com/SigNoz/signoz/pkg/valuer"
|
|
||||||
)
|
|
||||||
|
|
||||||
type handler struct {
|
|
||||||
set factory.ProviderSettings
|
|
||||||
querier querier.Querier
|
|
||||||
community querier.Handler
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewHandler(set factory.ProviderSettings, querier querier.Querier, community querier.Handler) querier.Handler {
|
|
||||||
return &handler{
|
|
||||||
set: set,
|
|
||||||
querier: querier,
|
|
||||||
community: community,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *handler) QueryRange(rw http.ResponseWriter, req *http.Request) {
|
|
||||||
bodyBytes, err := io.ReadAll(req.Body)
|
|
||||||
if err != nil {
|
|
||||||
render.Error(rw, errors.NewInvalidInputf(errors.CodeInvalidInput, "failed to read request body: %v", err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
req.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
|
|
||||||
|
|
||||||
ctx := req.Context()
|
|
||||||
|
|
||||||
claims, err := authtypes.ClaimsFromContext(ctx)
|
|
||||||
if err != nil {
|
|
||||||
render.Error(rw, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var queryRangeRequest qbtypes.QueryRangeRequest
|
|
||||||
if err := json.NewDecoder(req.Body).Decode(&queryRangeRequest); err != nil {
|
|
||||||
render.Error(rw, errors.NewInvalidInputf(errors.CodeInvalidInput, "failed to decode request body: %v", err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
stackTrace := string(debug.Stack())
|
|
||||||
|
|
||||||
queryJSON, _ := json.Marshal(queryRangeRequest)
|
|
||||||
|
|
||||||
h.set.Logger.ErrorContext(ctx, "panic in QueryRange",
|
|
||||||
"error", r,
|
|
||||||
"user", claims.UserID,
|
|
||||||
"payload", string(queryJSON),
|
|
||||||
"stacktrace", stackTrace,
|
|
||||||
)
|
|
||||||
|
|
||||||
render.Error(rw, errors.NewInternalf(
|
|
||||||
errors.CodeInternal,
|
|
||||||
"Something went wrong on our end. It's not you, it's us. Our team is notified about it. Reach out to support if issue persists.",
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
if err := queryRangeRequest.Validate(); err != nil {
|
|
||||||
render.Error(rw, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
orgID, err := valuer.NewUUID(claims.OrgID)
|
|
||||||
if err != nil {
|
|
||||||
render.Error(rw, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if anomalyQuery, ok := queryRangeRequest.IsAnomalyRequest(); ok {
|
|
||||||
anomalies, err := h.handleAnomalyQuery(ctx, orgID, anomalyQuery, queryRangeRequest)
|
|
||||||
if err != nil {
|
|
||||||
render.Error(rw, errors.NewInternalf(errors.CodeInternal, "failed to get anomalies: %v", err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
results := []any{}
|
|
||||||
for _, item := range anomalies.Results {
|
|
||||||
results = append(results, item)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build step intervals from the anomaly query
|
|
||||||
stepIntervals := make(map[string]uint64)
|
|
||||||
if anomalyQuery.StepInterval.Duration > 0 {
|
|
||||||
stepIntervals[anomalyQuery.Name] = uint64(anomalyQuery.StepInterval.Duration.Seconds())
|
|
||||||
}
|
|
||||||
|
|
||||||
finalResp := &qbtypes.QueryRangeResponse{
|
|
||||||
Type: queryRangeRequest.RequestType,
|
|
||||||
Data: qbtypes.QueryData{
|
|
||||||
Results: results,
|
|
||||||
},
|
|
||||||
Meta: qbtypes.ExecStats{
|
|
||||||
StepIntervals: stepIntervals,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
render.Success(rw, http.StatusOK, finalResp)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// regular query range request, delegate to community handler
|
|
||||||
req.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
|
|
||||||
h.community.QueryRange(rw, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *handler) QueryRawStream(rw http.ResponseWriter, req *http.Request) {
|
|
||||||
h.community.QueryRawStream(rw, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *handler) ReplaceVariables(rw http.ResponseWriter, req *http.Request) {
|
|
||||||
h.community.ReplaceVariables(rw, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
func extractSeasonality(anomalyQuery *qbtypes.QueryBuilderQuery[qbtypes.MetricAggregation]) anomalyV2.Seasonality {
|
|
||||||
for _, fn := range anomalyQuery.Functions {
|
|
||||||
if fn.Name == qbtypes.FunctionNameAnomaly {
|
|
||||||
for _, arg := range fn.Args {
|
|
||||||
if arg.Name == "seasonality" {
|
|
||||||
if seasonalityStr, ok := arg.Value.(string); ok {
|
|
||||||
switch seasonalityStr {
|
|
||||||
case "weekly":
|
|
||||||
return anomalyV2.SeasonalityWeekly
|
|
||||||
case "hourly":
|
|
||||||
return anomalyV2.SeasonalityHourly
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return anomalyV2.SeasonalityDaily // default
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *handler) createAnomalyProvider(seasonality anomalyV2.Seasonality) anomalyV2.Provider {
|
|
||||||
switch seasonality {
|
|
||||||
case anomalyV2.SeasonalityWeekly:
|
|
||||||
return anomalyV2.NewWeeklyProvider(
|
|
||||||
anomalyV2.WithQuerier[*anomalyV2.WeeklyProvider](h.querier),
|
|
||||||
anomalyV2.WithLogger[*anomalyV2.WeeklyProvider](h.set.Logger),
|
|
||||||
)
|
|
||||||
case anomalyV2.SeasonalityHourly:
|
|
||||||
return anomalyV2.NewHourlyProvider(
|
|
||||||
anomalyV2.WithQuerier[*anomalyV2.HourlyProvider](h.querier),
|
|
||||||
anomalyV2.WithLogger[*anomalyV2.HourlyProvider](h.set.Logger),
|
|
||||||
)
|
|
||||||
default:
|
|
||||||
return anomalyV2.NewDailyProvider(
|
|
||||||
anomalyV2.WithQuerier[*anomalyV2.DailyProvider](h.querier),
|
|
||||||
anomalyV2.WithLogger[*anomalyV2.DailyProvider](h.set.Logger),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *handler) handleAnomalyQuery(ctx context.Context, orgID valuer.UUID, anomalyQuery *qbtypes.QueryBuilderQuery[qbtypes.MetricAggregation], queryRangeRequest qbtypes.QueryRangeRequest) (*anomalyV2.AnomaliesResponse, error) {
|
|
||||||
seasonality := extractSeasonality(anomalyQuery)
|
|
||||||
provider := h.createAnomalyProvider(seasonality)
|
|
||||||
|
|
||||||
return provider.GetAnomalies(ctx, orgID, &anomalyV2.AnomaliesRequest{Params: queryRangeRequest})
|
|
||||||
}
|
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/http/httputil"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/SigNoz/signoz/ee/licensing/httplicensing"
|
"github.com/SigNoz/signoz/ee/licensing/httplicensing"
|
||||||
|
"github.com/SigNoz/signoz/ee/query-service/integrations/gateway"
|
||||||
"github.com/SigNoz/signoz/ee/query-service/usage"
|
"github.com/SigNoz/signoz/ee/query-service/usage"
|
||||||
"github.com/SigNoz/signoz/pkg/alertmanager"
|
"github.com/SigNoz/signoz/pkg/alertmanager"
|
||||||
"github.com/SigNoz/signoz/pkg/global"
|
"github.com/SigNoz/signoz/pkg/global"
|
||||||
"github.com/SigNoz/signoz/pkg/http/middleware"
|
"github.com/SigNoz/signoz/pkg/http/middleware"
|
||||||
|
querierAPI "github.com/SigNoz/signoz/pkg/querier"
|
||||||
baseapp "github.com/SigNoz/signoz/pkg/query-service/app"
|
baseapp "github.com/SigNoz/signoz/pkg/query-service/app"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/app/cloudintegrations"
|
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/app/integrations"
|
"github.com/SigNoz/signoz/pkg/query-service/app/integrations"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/app/logparsingpipeline"
|
"github.com/SigNoz/signoz/pkg/query-service/app/logparsingpipeline"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/interfaces"
|
"github.com/SigNoz/signoz/pkg/query-service/interfaces"
|
||||||
@@ -27,12 +30,13 @@ type APIHandlerOptions struct {
|
|||||||
RulesManager *rules.Manager
|
RulesManager *rules.Manager
|
||||||
UsageManager *usage.Manager
|
UsageManager *usage.Manager
|
||||||
IntegrationsController *integrations.Controller
|
IntegrationsController *integrations.Controller
|
||||||
CloudIntegrationsController *cloudintegrations.Controller
|
|
||||||
LogsParsingPipelineController *logparsingpipeline.LogParsingPipelineController
|
LogsParsingPipelineController *logparsingpipeline.LogParsingPipelineController
|
||||||
|
Gateway *httputil.ReverseProxy
|
||||||
GatewayUrl string
|
GatewayUrl string
|
||||||
// Querier Influx Interval
|
// Querier Influx Interval
|
||||||
FluxInterval time.Duration
|
FluxInterval time.Duration
|
||||||
GlobalConfig global.Config
|
GlobalConfig global.Config
|
||||||
|
Logger *slog.Logger // this is present in Signoz.Instrumentation but adding for quick access
|
||||||
}
|
}
|
||||||
|
|
||||||
type APIHandler struct {
|
type APIHandler struct {
|
||||||
@@ -41,19 +45,20 @@ type APIHandler struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewAPIHandler returns an APIHandler
|
// NewAPIHandler returns an APIHandler
|
||||||
func NewAPIHandler(opts APIHandlerOptions, signoz *signoz.SigNoz, config signoz.Config) (*APIHandler, error) {
|
func NewAPIHandler(opts APIHandlerOptions, signoz *signoz.SigNoz) (*APIHandler, error) {
|
||||||
baseHandler, err := baseapp.NewAPIHandler(baseapp.APIHandlerOpts{
|
baseHandler, err := baseapp.NewAPIHandler(baseapp.APIHandlerOpts{
|
||||||
Reader: opts.DataConnector,
|
Reader: opts.DataConnector,
|
||||||
RuleManager: opts.RulesManager,
|
RuleManager: opts.RulesManager,
|
||||||
IntegrationsController: opts.IntegrationsController,
|
IntegrationsController: opts.IntegrationsController,
|
||||||
CloudIntegrationsController: opts.CloudIntegrationsController,
|
|
||||||
LogsParsingPipelineController: opts.LogsParsingPipelineController,
|
LogsParsingPipelineController: opts.LogsParsingPipelineController,
|
||||||
FluxInterval: opts.FluxInterval,
|
FluxInterval: opts.FluxInterval,
|
||||||
AlertmanagerAPI: alertmanager.NewAPI(signoz.Alertmanager),
|
AlertmanagerAPI: alertmanager.NewAPI(signoz.Alertmanager),
|
||||||
LicensingAPI: httplicensing.NewLicensingAPI(signoz.Licensing),
|
LicensingAPI: httplicensing.NewLicensingAPI(signoz.Licensing),
|
||||||
Signoz: signoz,
|
Signoz: signoz,
|
||||||
|
QuerierAPI: querierAPI.NewAPI(signoz.Instrumentation.ToProviderSettings(), signoz.Querier, signoz.Analytics),
|
||||||
QueryParserAPI: queryparser.NewAPI(signoz.Instrumentation.ToProviderSettings(), signoz.QueryParser),
|
QueryParserAPI: queryparser.NewAPI(signoz.Instrumentation.ToProviderSettings(), signoz.QueryParser),
|
||||||
}, config)
|
Logger: opts.Logger,
|
||||||
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -74,6 +79,10 @@ func (ah *APIHandler) UM() *usage.Manager {
|
|||||||
return ah.opts.UsageManager
|
return ah.opts.UsageManager
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ah *APIHandler) Gateway() *httputil.ReverseProxy {
|
||||||
|
return ah.opts.Gateway
|
||||||
|
}
|
||||||
|
|
||||||
// RegisterRoutes registers routes for this handler on the given router
|
// RegisterRoutes registers routes for this handler on the given router
|
||||||
func (ah *APIHandler) RegisterRoutes(router *mux.Router, am *middleware.AuthZ) {
|
func (ah *APIHandler) RegisterRoutes(router *mux.Router, am *middleware.AuthZ) {
|
||||||
// note: add ee override methods first
|
// note: add ee override methods first
|
||||||
@@ -96,19 +105,25 @@ func (ah *APIHandler) RegisterRoutes(router *mux.Router, am *middleware.AuthZ) {
|
|||||||
// v4
|
// v4
|
||||||
router.HandleFunc("/api/v4/query_range", am.ViewAccess(ah.queryRangeV4)).Methods(http.MethodPost)
|
router.HandleFunc("/api/v4/query_range", am.ViewAccess(ah.queryRangeV4)).Methods(http.MethodPost)
|
||||||
|
|
||||||
|
// v5
|
||||||
|
router.HandleFunc("/api/v5/query_range", am.ViewAccess(ah.queryRangeV5)).Methods(http.MethodPost)
|
||||||
|
|
||||||
|
router.HandleFunc("/api/v5/substitute_vars", am.ViewAccess(ah.QuerierAPI.ReplaceVariables)).Methods(http.MethodPost)
|
||||||
|
|
||||||
|
// Gateway
|
||||||
|
router.PathPrefix(gateway.RoutePrefix).HandlerFunc(am.EditAccess(ah.ServeGatewayHTTP))
|
||||||
|
|
||||||
ah.APIHandler.RegisterRoutes(router, am)
|
ah.APIHandler.RegisterRoutes(router, am)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ah *APIHandler) RegisterCloudIntegrationsRoutes(router *mux.Router, am *middleware.AuthZ) {
|
func (ah *APIHandler) RegisterCloudIntegrationsRoutes(router *mux.Router, am *middleware.AuthZ) {
|
||||||
|
|
||||||
ah.APIHandler.RegisterCloudIntegrationsRoutes(router, am)
|
ah.APIHandler.RegisterCloudIntegrationsRoutes(router, am)
|
||||||
|
|
||||||
router.HandleFunc(
|
router.HandleFunc(
|
||||||
"/api/v1/cloud-integrations/{cloudProvider}/accounts/generate-connection-params",
|
"/api/v1/cloud-integrations/{cloudProvider}/accounts/generate-connection-params",
|
||||||
am.EditAccess(ah.CloudIntegrationsGenerateConnectionParams),
|
am.EditAccess(ah.CloudIntegrationsGenerateConnectionParams),
|
||||||
).Methods(http.MethodGet)
|
).Methods(http.MethodGet)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ah *APIHandler) getVersion(w http.ResponseWriter, r *http.Request) {
|
func (ah *APIHandler) getVersion(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -13,20 +14,14 @@ import (
|
|||||||
"github.com/SigNoz/signoz/pkg/errors"
|
"github.com/SigNoz/signoz/pkg/errors"
|
||||||
"github.com/SigNoz/signoz/pkg/http/render"
|
"github.com/SigNoz/signoz/pkg/http/render"
|
||||||
"github.com/SigNoz/signoz/pkg/modules/user"
|
"github.com/SigNoz/signoz/pkg/modules/user"
|
||||||
basemodel "github.com/SigNoz/signoz/pkg/query-service/model"
|
|
||||||
"github.com/SigNoz/signoz/pkg/types"
|
"github.com/SigNoz/signoz/pkg/types"
|
||||||
"github.com/SigNoz/signoz/pkg/types/authtypes"
|
"github.com/SigNoz/signoz/pkg/types/authtypes"
|
||||||
|
"github.com/SigNoz/signoz/pkg/types/integrationstypes"
|
||||||
"github.com/SigNoz/signoz/pkg/valuer"
|
"github.com/SigNoz/signoz/pkg/valuer"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"go.uber.org/zap"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CloudIntegrationConnectionParamsResponse struct {
|
// TODO: move this file with other cloud integration related code
|
||||||
IngestionUrl string `json:"ingestion_url,omitempty"`
|
|
||||||
IngestionKey string `json:"ingestion_key,omitempty"`
|
|
||||||
SigNozAPIUrl string `json:"signoz_api_url,omitempty"`
|
|
||||||
SigNozAPIKey string `json:"signoz_api_key,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ah *APIHandler) CloudIntegrationsGenerateConnectionParams(w http.ResponseWriter, r *http.Request) {
|
func (ah *APIHandler) CloudIntegrationsGenerateConnectionParams(w http.ResponseWriter, r *http.Request) {
|
||||||
claims, err := authtypes.ClaimsFromContext(r.Context())
|
claims, err := authtypes.ClaimsFromContext(r.Context())
|
||||||
@@ -41,23 +36,21 @@ func (ah *APIHandler) CloudIntegrationsGenerateConnectionParams(w http.ResponseW
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
cloudProvider := mux.Vars(r)["cloudProvider"]
|
cloudProviderString := mux.Vars(r)["cloudProvider"]
|
||||||
if cloudProvider != "aws" {
|
|
||||||
RespondError(w, basemodel.BadRequest(fmt.Errorf(
|
cloudProvider, err := integrationstypes.NewCloudProvider(cloudProviderString)
|
||||||
"cloud provider not supported: %s", cloudProvider,
|
if err != nil {
|
||||||
)), nil)
|
render.Error(w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
apiKey, apiErr := ah.getOrCreateCloudIntegrationPAT(r.Context(), claims.OrgID, cloudProvider)
|
apiKey, err := ah.getOrCreateCloudIntegrationPAT(r.Context(), claims.OrgID, cloudProvider)
|
||||||
if apiErr != nil {
|
if err != nil {
|
||||||
RespondError(w, basemodel.WrapApiError(
|
render.Error(w, err)
|
||||||
apiErr, "couldn't provision PAT for cloud integration:",
|
|
||||||
), nil)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
result := CloudIntegrationConnectionParamsResponse{
|
result := integrationstypes.GettableCloudIntegrationConnectionParams{
|
||||||
SigNozAPIKey: apiKey,
|
SigNozAPIKey: apiKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,16 +64,17 @@ func (ah *APIHandler) CloudIntegrationsGenerateConnectionParams(w http.ResponseW
|
|||||||
// Return the API Key (PAT) even if the rest of the params can not be deduced.
|
// Return the API Key (PAT) even if the rest of the params can not be deduced.
|
||||||
// Params not returned from here will be requested from the user via form inputs.
|
// Params not returned from here will be requested from the user via form inputs.
|
||||||
// This enables gracefully degraded but working experience even for non-cloud deployments.
|
// This enables gracefully degraded but working experience even for non-cloud deployments.
|
||||||
zap.L().Info("ingestion params and signoz api url can not be deduced since no license was found")
|
ah.opts.Logger.InfoContext(
|
||||||
ah.Respond(w, result)
|
r.Context(),
|
||||||
|
"ingestion params and signoz api url can not be deduced since no license was found",
|
||||||
|
)
|
||||||
|
render.Success(w, http.StatusOK, result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
signozApiUrl, apiErr := ah.getIngestionUrlAndSigNozAPIUrl(r.Context(), license.Key)
|
signozApiUrl, err := ah.getIngestionUrlAndSigNozAPIUrl(r.Context(), license.Key)
|
||||||
if apiErr != nil {
|
if err != nil {
|
||||||
RespondError(w, basemodel.WrapApiError(
|
render.Error(w, err)
|
||||||
apiErr, "couldn't deduce ingestion url and signoz api url",
|
|
||||||
), nil)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,48 +83,41 @@ func (ah *APIHandler) CloudIntegrationsGenerateConnectionParams(w http.ResponseW
|
|||||||
|
|
||||||
gatewayUrl := ah.opts.GatewayUrl
|
gatewayUrl := ah.opts.GatewayUrl
|
||||||
if len(gatewayUrl) > 0 {
|
if len(gatewayUrl) > 0 {
|
||||||
|
ingestionKeyString, err := ah.getOrCreateCloudProviderIngestionKey(
|
||||||
ingestionKey, apiErr := getOrCreateCloudProviderIngestionKey(
|
|
||||||
r.Context(), gatewayUrl, license.Key, cloudProvider,
|
r.Context(), gatewayUrl, license.Key, cloudProvider,
|
||||||
)
|
)
|
||||||
if apiErr != nil {
|
if err != nil {
|
||||||
RespondError(w, basemodel.WrapApiError(
|
render.Error(w, err)
|
||||||
apiErr, "couldn't get or create ingestion key",
|
|
||||||
), nil)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
result.IngestionKey = ingestionKey
|
result.IngestionKey = ingestionKeyString
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
zap.L().Info("ingestion key can't be deduced since no gateway url has been configured")
|
ah.opts.Logger.InfoContext(
|
||||||
|
r.Context(),
|
||||||
|
"ingestion key can't be deduced since no gateway url has been configured",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
ah.Respond(w, result)
|
render.Success(w, http.StatusOK, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ah *APIHandler) getOrCreateCloudIntegrationPAT(ctx context.Context, orgId string, cloudProvider string) (
|
func (ah *APIHandler) getOrCreateCloudIntegrationPAT(ctx context.Context, orgId string, cloudProvider valuer.String) (string, error) {
|
||||||
string, *basemodel.ApiError,
|
|
||||||
) {
|
|
||||||
integrationPATName := fmt.Sprintf("%s integration", cloudProvider)
|
integrationPATName := fmt.Sprintf("%s integration", cloudProvider)
|
||||||
|
|
||||||
integrationUser, apiErr := ah.getOrCreateCloudIntegrationUser(ctx, orgId, cloudProvider)
|
integrationUser, err := ah.getOrCreateCloudIntegrationUser(ctx, orgId, cloudProvider)
|
||||||
if apiErr != nil {
|
if err != nil {
|
||||||
return "", apiErr
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
orgIdUUID, err := valuer.NewUUID(orgId)
|
orgIdUUID, err := valuer.NewUUID(orgId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", basemodel.InternalError(fmt.Errorf(
|
return "", err
|
||||||
"couldn't parse orgId: %w", err,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
allPats, err := ah.Signoz.Modules.User.ListAPIKeys(ctx, orgIdUUID)
|
allPats, err := ah.Signoz.Modules.User.ListAPIKeys(ctx, orgIdUUID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", basemodel.InternalError(fmt.Errorf(
|
return "", err
|
||||||
"couldn't list PATs: %w", err,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
for _, p := range allPats {
|
for _, p := range allPats {
|
||||||
if p.UserID == integrationUser.ID && p.Name == integrationPATName {
|
if p.UserID == integrationUser.ID && p.Name == integrationPATName {
|
||||||
@@ -138,9 +125,10 @@ func (ah *APIHandler) getOrCreateCloudIntegrationPAT(ctx context.Context, orgId
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
zap.L().Info(
|
ah.opts.Logger.InfoContext(
|
||||||
|
ctx,
|
||||||
"no PAT found for cloud integration, creating a new one",
|
"no PAT found for cloud integration, creating a new one",
|
||||||
zap.String("cloudProvider", cloudProvider),
|
slog.String("cloudProvider", cloudProvider.String()),
|
||||||
)
|
)
|
||||||
|
|
||||||
newPAT, err := types.NewStorableAPIKey(
|
newPAT, err := types.NewStorableAPIKey(
|
||||||
@@ -150,68 +138,48 @@ func (ah *APIHandler) getOrCreateCloudIntegrationPAT(ctx context.Context, orgId
|
|||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", basemodel.InternalError(fmt.Errorf(
|
return "", err
|
||||||
"couldn't create cloud integration PAT: %w", err,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ah.Signoz.Modules.User.CreateAPIKey(ctx, newPAT)
|
err = ah.Signoz.Modules.User.CreateAPIKey(ctx, newPAT)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", basemodel.InternalError(fmt.Errorf(
|
return "", err
|
||||||
"couldn't create cloud integration PAT: %w", err,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
return newPAT.Token, nil
|
return newPAT.Token, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ah *APIHandler) getOrCreateCloudIntegrationUser(
|
// TODO: move this function out of handler and use proper module structure
|
||||||
ctx context.Context, orgId string, cloudProvider string,
|
func (ah *APIHandler) getOrCreateCloudIntegrationUser(ctx context.Context, orgId string, cloudProvider valuer.String) (*types.User, error) {
|
||||||
) (*types.User, *basemodel.ApiError) {
|
cloudIntegrationUserName := fmt.Sprintf("%s-integration", cloudProvider.String())
|
||||||
cloudIntegrationUserName := fmt.Sprintf("%s-integration", cloudProvider)
|
|
||||||
email := valuer.MustNewEmail(fmt.Sprintf("%s@signoz.io", cloudIntegrationUserName))
|
email := valuer.MustNewEmail(fmt.Sprintf("%s@signoz.io", cloudIntegrationUserName))
|
||||||
|
|
||||||
cloudIntegrationUser, err := types.NewUser(cloudIntegrationUserName, email, types.RoleViewer, valuer.MustNewUUID(orgId))
|
cloudIntegrationUser, err := types.NewUser(cloudIntegrationUserName, email, types.RoleViewer, valuer.MustNewUUID(orgId))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, basemodel.InternalError(fmt.Errorf("couldn't create cloud integration user: %w", err))
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
password := types.MustGenerateFactorPassword(cloudIntegrationUser.ID.StringValue())
|
password := types.MustGenerateFactorPassword(cloudIntegrationUser.ID.StringValue())
|
||||||
|
|
||||||
cloudIntegrationUser, err = ah.Signoz.Modules.User.GetOrCreateUser(ctx, cloudIntegrationUser, user.WithFactorPassword(password))
|
cloudIntegrationUser, err = ah.Signoz.Modules.User.GetOrCreateUser(ctx, cloudIntegrationUser, user.WithFactorPassword(password))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, basemodel.InternalError(fmt.Errorf("couldn't look for integration user: %w", err))
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cloudIntegrationUser, nil
|
return cloudIntegrationUser, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ah *APIHandler) getIngestionUrlAndSigNozAPIUrl(ctx context.Context, licenseKey string) (
|
// TODO: move this function out of handler and use proper module structure
|
||||||
string, *basemodel.ApiError,
|
func (ah *APIHandler) getIngestionUrlAndSigNozAPIUrl(ctx context.Context, licenseKey string) (string, error) {
|
||||||
) {
|
|
||||||
// TODO: remove this struct from here
|
|
||||||
type deploymentResponse struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
ClusterInfo struct {
|
|
||||||
Region struct {
|
|
||||||
DNS string `json:"dns"`
|
|
||||||
} `json:"region"`
|
|
||||||
} `json:"cluster"`
|
|
||||||
}
|
|
||||||
|
|
||||||
respBytes, err := ah.Signoz.Zeus.GetDeployment(ctx, licenseKey)
|
respBytes, err := ah.Signoz.Zeus.GetDeployment(ctx, licenseKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", basemodel.InternalError(fmt.Errorf(
|
return "", errors.WrapInternalf(err, errors.CodeInternal, "couldn't query for deployment info: error")
|
||||||
"couldn't query for deployment info: error: %w", err,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := new(deploymentResponse)
|
resp := new(integrationstypes.GettableDeployment)
|
||||||
|
|
||||||
err = json.Unmarshal(respBytes, resp)
|
err = json.Unmarshal(respBytes, resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", basemodel.InternalError(fmt.Errorf(
|
return "", errors.WrapInternalf(err, errors.CodeInternal, "couldn't unmarshal deployment info response")
|
||||||
"couldn't unmarshal deployment info response: error: %w", err,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
regionDns := resp.ClusterInfo.Region.DNS
|
regionDns := resp.ClusterInfo.Region.DNS
|
||||||
@@ -219,9 +187,11 @@ func (ah *APIHandler) getIngestionUrlAndSigNozAPIUrl(ctx context.Context, licens
|
|||||||
|
|
||||||
if len(regionDns) < 1 || len(deploymentName) < 1 {
|
if len(regionDns) < 1 || len(deploymentName) < 1 {
|
||||||
// Fail early if actual response structure and expectation here ever diverge
|
// Fail early if actual response structure and expectation here ever diverge
|
||||||
return "", basemodel.InternalError(fmt.Errorf(
|
return "", errors.WrapInternalf(
|
||||||
|
err,
|
||||||
|
errors.CodeInternal,
|
||||||
"deployment info response not in expected shape. couldn't determine region dns and deployment name",
|
"deployment info response not in expected shape. couldn't determine region dns and deployment name",
|
||||||
))
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
signozApiUrl := fmt.Sprintf("https://%s.%s", deploymentName, regionDns)
|
signozApiUrl := fmt.Sprintf("https://%s.%s", deploymentName, regionDns)
|
||||||
@@ -229,102 +199,85 @@ func (ah *APIHandler) getIngestionUrlAndSigNozAPIUrl(ctx context.Context, licens
|
|||||||
return signozApiUrl, nil
|
return signozApiUrl, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type ingestionKey struct {
|
func (ah *APIHandler) getOrCreateCloudProviderIngestionKey(
|
||||||
Name string `json:"name"`
|
ctx context.Context, gatewayUrl string, licenseKey string, cloudProvider valuer.String,
|
||||||
Value string `json:"value"`
|
) (string, error) {
|
||||||
// other attributes from gateway response not included here since they are not being used.
|
|
||||||
}
|
|
||||||
|
|
||||||
type ingestionKeysSearchResponse struct {
|
|
||||||
Status string `json:"status"`
|
|
||||||
Data []ingestionKey `json:"data"`
|
|
||||||
Error string `json:"error"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type createIngestionKeyResponse struct {
|
|
||||||
Status string `json:"status"`
|
|
||||||
Data ingestionKey `json:"data"`
|
|
||||||
Error string `json:"error"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func getOrCreateCloudProviderIngestionKey(
|
|
||||||
ctx context.Context, gatewayUrl string, licenseKey string, cloudProvider string,
|
|
||||||
) (string, *basemodel.ApiError) {
|
|
||||||
cloudProviderKeyName := fmt.Sprintf("%s-integration", cloudProvider)
|
cloudProviderKeyName := fmt.Sprintf("%s-integration", cloudProvider)
|
||||||
|
|
||||||
// see if the key already exists
|
// see if the key already exists
|
||||||
searchResult, apiErr := requestGateway[ingestionKeysSearchResponse](
|
searchResult, err := requestGateway[integrationstypes.GettableIngestionKeysSearch](
|
||||||
ctx,
|
ctx,
|
||||||
gatewayUrl,
|
gatewayUrl,
|
||||||
licenseKey,
|
licenseKey,
|
||||||
fmt.Sprintf("/v1/workspaces/me/keys/search?name=%s", cloudProviderKeyName),
|
fmt.Sprintf("/v1/workspaces/me/keys/search?name=%s", cloudProviderKeyName),
|
||||||
nil,
|
nil,
|
||||||
|
ah.opts.Logger,
|
||||||
)
|
)
|
||||||
|
if err != nil {
|
||||||
if apiErr != nil {
|
return "", err
|
||||||
return "", basemodel.WrapApiError(
|
|
||||||
apiErr, "couldn't search for cloudprovider ingestion key",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if searchResult.Status != "success" {
|
if searchResult.Status != "success" {
|
||||||
return "", basemodel.InternalError(fmt.Errorf(
|
return "", errors.NewInternalf(
|
||||||
"couldn't search for cloudprovider ingestion key: status: %s, error: %s",
|
errors.CodeInternal,
|
||||||
|
"couldn't search for cloud provider ingestion key: status: %s, error: %s",
|
||||||
searchResult.Status, searchResult.Error,
|
searchResult.Status, searchResult.Error,
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, k := range searchResult.Data {
|
|
||||||
if k.Name == cloudProviderKeyName {
|
|
||||||
if len(k.Value) < 1 {
|
|
||||||
// Fail early if actual response structure and expectation here ever diverge
|
|
||||||
return "", basemodel.InternalError(fmt.Errorf(
|
|
||||||
"ingestion keys search response not as expected",
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
return k.Value, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
zap.L().Info(
|
|
||||||
"no existing ingestion key found for cloud integration, creating a new one",
|
|
||||||
zap.String("cloudProvider", cloudProvider),
|
|
||||||
)
|
|
||||||
createKeyResult, apiErr := requestGateway[createIngestionKeyResponse](
|
|
||||||
ctx, gatewayUrl, licenseKey, "/v1/workspaces/me/keys",
|
|
||||||
map[string]any{
|
|
||||||
"name": cloudProviderKeyName,
|
|
||||||
"tags": []string{"integration", cloudProvider},
|
|
||||||
},
|
|
||||||
)
|
|
||||||
if apiErr != nil {
|
|
||||||
return "", basemodel.WrapApiError(
|
|
||||||
apiErr, "couldn't create cloudprovider ingestion key",
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, k := range searchResult.Data {
|
||||||
|
if k.Name != cloudProviderKeyName {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(k.Value) < 1 {
|
||||||
|
// Fail early if actual response structure and expectation here ever diverge
|
||||||
|
return "", errors.NewInternalf(errors.CodeInternal, "ingestion keys search response not as expected")
|
||||||
|
}
|
||||||
|
|
||||||
|
return k.Value, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
ah.opts.Logger.InfoContext(
|
||||||
|
ctx,
|
||||||
|
"no existing ingestion key found for cloud integration, creating a new one",
|
||||||
|
slog.String("cloudProvider", cloudProvider.String()),
|
||||||
|
)
|
||||||
|
|
||||||
|
createKeyResult, err := requestGateway[integrationstypes.GettableCreateIngestionKey](
|
||||||
|
ctx, gatewayUrl, licenseKey, "/v1/workspaces/me/keys",
|
||||||
|
map[string]any{
|
||||||
|
"name": cloudProviderKeyName,
|
||||||
|
"tags": []string{"integration", cloudProvider.String()},
|
||||||
|
},
|
||||||
|
ah.opts.Logger,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
if createKeyResult.Status != "success" {
|
if createKeyResult.Status != "success" {
|
||||||
return "", basemodel.InternalError(fmt.Errorf(
|
return "", errors.NewInternalf(
|
||||||
"couldn't create cloudprovider ingestion key: status: %s, error: %s",
|
errors.CodeInternal,
|
||||||
|
"couldn't create cloud provider ingestion key: status: %s, error: %s",
|
||||||
createKeyResult.Status, createKeyResult.Error,
|
createKeyResult.Status, createKeyResult.Error,
|
||||||
))
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
ingestionKey := createKeyResult.Data.Value
|
ingestionKeyString := createKeyResult.Data.Value
|
||||||
if len(ingestionKey) < 1 {
|
if len(ingestionKeyString) < 1 {
|
||||||
// Fail early if actual response structure and expectation here ever diverge
|
// Fail early if actual response structure and expectation here ever diverge
|
||||||
return "", basemodel.InternalError(fmt.Errorf(
|
return "", errors.NewInternalf(errors.CodeInternal,
|
||||||
"ingestion key creation response not as expected",
|
"ingestion key creation response not as expected",
|
||||||
))
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ingestionKey, nil
|
return ingestionKeyString, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func requestGateway[ResponseType any](
|
func requestGateway[ResponseType any](
|
||||||
ctx context.Context, gatewayUrl string, licenseKey string, path string, payload any,
|
ctx context.Context, gatewayUrl, licenseKey, path string, payload any, logger *slog.Logger,
|
||||||
) (*ResponseType, *basemodel.ApiError) {
|
) (*ResponseType, error) {
|
||||||
|
|
||||||
baseUrl := strings.TrimSuffix(gatewayUrl, "/")
|
baseUrl := strings.TrimSuffix(gatewayUrl, "/")
|
||||||
reqUrl := fmt.Sprintf("%s%s", baseUrl, path)
|
reqUrl := fmt.Sprintf("%s%s", baseUrl, path)
|
||||||
@@ -335,13 +288,12 @@ func requestGateway[ResponseType any](
|
|||||||
"X-Consumer-Groups": "ns:default",
|
"X-Consumer-Groups": "ns:default",
|
||||||
}
|
}
|
||||||
|
|
||||||
return requestAndParseResponse[ResponseType](ctx, reqUrl, headers, payload)
|
return requestAndParseResponse[ResponseType](ctx, reqUrl, headers, payload, logger)
|
||||||
}
|
}
|
||||||
|
|
||||||
func requestAndParseResponse[ResponseType any](
|
func requestAndParseResponse[ResponseType any](
|
||||||
ctx context.Context, url string, headers map[string]string, payload any,
|
ctx context.Context, url string, headers map[string]string, payload any, logger *slog.Logger,
|
||||||
) (*ResponseType, *basemodel.ApiError) {
|
) (*ResponseType, error) {
|
||||||
|
|
||||||
reqMethod := http.MethodGet
|
reqMethod := http.MethodGet
|
||||||
var reqBody io.Reader
|
var reqBody io.Reader
|
||||||
if payload != nil {
|
if payload != nil {
|
||||||
@@ -349,18 +301,14 @@ func requestAndParseResponse[ResponseType any](
|
|||||||
|
|
||||||
bodyJson, err := json.Marshal(payload)
|
bodyJson, err := json.Marshal(payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, basemodel.InternalError(fmt.Errorf(
|
return nil, errors.WrapInternalf(err, errors.CodeInternal, "couldn't marshal payload")
|
||||||
"couldn't serialize request payload to JSON: %w", err,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
reqBody = bytes.NewBuffer([]byte(bodyJson))
|
reqBody = bytes.NewBuffer(bodyJson)
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, reqMethod, url, reqBody)
|
req, err := http.NewRequestWithContext(ctx, reqMethod, url, reqBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, basemodel.InternalError(fmt.Errorf(
|
return nil, errors.WrapInternalf(err, errors.CodeInternal, "couldn't create req")
|
||||||
"couldn't prepare request: %w", err,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range headers {
|
for k, v := range headers {
|
||||||
@@ -373,23 +321,26 @@ func requestAndParseResponse[ResponseType any](
|
|||||||
|
|
||||||
response, err := client.Do(req)
|
response, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, basemodel.InternalError(fmt.Errorf("couldn't make request: %w", err))
|
return nil, errors.WrapInternalf(err, errors.CodeInternal, "couldn't make req")
|
||||||
}
|
}
|
||||||
|
|
||||||
defer response.Body.Close()
|
defer func() {
|
||||||
|
err = response.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
logger.ErrorContext(ctx, "couldn't close response body", "error", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
respBody, err := io.ReadAll(response.Body)
|
respBody, err := io.ReadAll(response.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, basemodel.InternalError(fmt.Errorf("couldn't read response: %w", err))
|
return nil, errors.WrapInternalf(err, errors.CodeInternal, "couldn't read response body")
|
||||||
}
|
}
|
||||||
|
|
||||||
var resp ResponseType
|
var resp ResponseType
|
||||||
|
|
||||||
err = json.Unmarshal(respBody, &resp)
|
err = json.Unmarshal(respBody, &resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, basemodel.InternalError(fmt.Errorf(
|
return nil, errors.WrapInternalf(err, errors.CodeInternal, "couldn't unmarshal response body")
|
||||||
"couldn't unmarshal gateway response into %T", resp,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &resp, nil
|
return &resp, nil
|
||||||
|
|||||||
58
ee/query-service/app/api/gateway.go
Normal file
58
ee/query-service/app/api/gateway.go
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/SigNoz/signoz/ee/query-service/integrations/gateway"
|
||||||
|
"github.com/SigNoz/signoz/pkg/errors"
|
||||||
|
"github.com/SigNoz/signoz/pkg/http/render"
|
||||||
|
"github.com/SigNoz/signoz/pkg/types/authtypes"
|
||||||
|
"github.com/SigNoz/signoz/pkg/valuer"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (ah *APIHandler) ServeGatewayHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||||
|
ctx := req.Context()
|
||||||
|
claims, err := authtypes.ClaimsFromContext(ctx)
|
||||||
|
if err != nil {
|
||||||
|
render.Error(rw, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
orgID, err := valuer.NewUUID(claims.OrgID)
|
||||||
|
if err != nil {
|
||||||
|
render.Error(rw, errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "orgId is invalid"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
validPath := false
|
||||||
|
for _, allowedPrefix := range gateway.AllowedPrefix {
|
||||||
|
if strings.HasPrefix(req.URL.Path, gateway.RoutePrefix+allowedPrefix) {
|
||||||
|
validPath = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !validPath {
|
||||||
|
rw.WriteHeader(http.StatusNotFound)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
license, err := ah.Signoz.Licensing.GetActive(ctx, orgID)
|
||||||
|
if err != nil {
|
||||||
|
render.Error(rw, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create headers
|
||||||
|
var licenseKey string
|
||||||
|
if license != nil {
|
||||||
|
licenseKey = license.Key
|
||||||
|
}
|
||||||
|
|
||||||
|
req.Header.Set("X-Signoz-Cloud-Api-Key", licenseKey)
|
||||||
|
req.Header.Set("X-Consumer-Username", "lid:00000000-0000-0000-0000-000000000000")
|
||||||
|
req.Header.Set("X-Consumer-Groups", "ns:default")
|
||||||
|
|
||||||
|
ah.Gateway().ServeHTTP(rw, req)
|
||||||
|
}
|
||||||
@@ -2,11 +2,16 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"runtime/debug"
|
||||||
|
|
||||||
|
anomalyV2 "github.com/SigNoz/signoz/ee/anomaly"
|
||||||
"github.com/SigNoz/signoz/ee/query-service/anomaly"
|
"github.com/SigNoz/signoz/ee/query-service/anomaly"
|
||||||
|
"github.com/SigNoz/signoz/pkg/errors"
|
||||||
"github.com/SigNoz/signoz/pkg/http/render"
|
"github.com/SigNoz/signoz/pkg/http/render"
|
||||||
baseapp "github.com/SigNoz/signoz/pkg/query-service/app"
|
baseapp "github.com/SigNoz/signoz/pkg/query-service/app"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/app/queryBuilder"
|
"github.com/SigNoz/signoz/pkg/query-service/app/queryBuilder"
|
||||||
@@ -15,6 +20,8 @@ import (
|
|||||||
"github.com/SigNoz/signoz/pkg/types/authtypes"
|
"github.com/SigNoz/signoz/pkg/types/authtypes"
|
||||||
"github.com/SigNoz/signoz/pkg/valuer"
|
"github.com/SigNoz/signoz/pkg/valuer"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
|
qbtypes "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (aH *APIHandler) queryRangeV4(w http.ResponseWriter, r *http.Request) {
|
func (aH *APIHandler) queryRangeV4(w http.ResponseWriter, r *http.Request) {
|
||||||
@@ -137,3 +144,140 @@ func (aH *APIHandler) queryRangeV4(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func extractSeasonality(anomalyQuery *qbtypes.QueryBuilderQuery[qbtypes.MetricAggregation]) anomalyV2.Seasonality {
|
||||||
|
for _, fn := range anomalyQuery.Functions {
|
||||||
|
if fn.Name == qbtypes.FunctionNameAnomaly {
|
||||||
|
for _, arg := range fn.Args {
|
||||||
|
if arg.Name == "seasonality" {
|
||||||
|
if seasonalityStr, ok := arg.Value.(string); ok {
|
||||||
|
switch seasonalityStr {
|
||||||
|
case "weekly":
|
||||||
|
return anomalyV2.SeasonalityWeekly
|
||||||
|
case "hourly":
|
||||||
|
return anomalyV2.SeasonalityHourly
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return anomalyV2.SeasonalityDaily // default
|
||||||
|
}
|
||||||
|
|
||||||
|
func createAnomalyProvider(aH *APIHandler, seasonality anomalyV2.Seasonality) anomalyV2.Provider {
|
||||||
|
switch seasonality {
|
||||||
|
case anomalyV2.SeasonalityWeekly:
|
||||||
|
return anomalyV2.NewWeeklyProvider(
|
||||||
|
anomalyV2.WithQuerier[*anomalyV2.WeeklyProvider](aH.Signoz.Querier),
|
||||||
|
anomalyV2.WithLogger[*anomalyV2.WeeklyProvider](aH.Signoz.Instrumentation.Logger()),
|
||||||
|
)
|
||||||
|
case anomalyV2.SeasonalityHourly:
|
||||||
|
return anomalyV2.NewHourlyProvider(
|
||||||
|
anomalyV2.WithQuerier[*anomalyV2.HourlyProvider](aH.Signoz.Querier),
|
||||||
|
anomalyV2.WithLogger[*anomalyV2.HourlyProvider](aH.Signoz.Instrumentation.Logger()),
|
||||||
|
)
|
||||||
|
default:
|
||||||
|
return anomalyV2.NewDailyProvider(
|
||||||
|
anomalyV2.WithQuerier[*anomalyV2.DailyProvider](aH.Signoz.Querier),
|
||||||
|
anomalyV2.WithLogger[*anomalyV2.DailyProvider](aH.Signoz.Instrumentation.Logger()),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (aH *APIHandler) handleAnomalyQuery(ctx context.Context, orgID valuer.UUID, anomalyQuery *qbtypes.QueryBuilderQuery[qbtypes.MetricAggregation], queryRangeRequest qbtypes.QueryRangeRequest) (*anomalyV2.AnomaliesResponse, error) {
|
||||||
|
seasonality := extractSeasonality(anomalyQuery)
|
||||||
|
provider := createAnomalyProvider(aH, seasonality)
|
||||||
|
|
||||||
|
return provider.GetAnomalies(ctx, orgID, &anomalyV2.AnomaliesRequest{Params: queryRangeRequest})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (aH *APIHandler) queryRangeV5(rw http.ResponseWriter, req *http.Request) {
|
||||||
|
|
||||||
|
bodyBytes, err := io.ReadAll(req.Body)
|
||||||
|
if err != nil {
|
||||||
|
render.Error(rw, errors.NewInvalidInputf(errors.CodeInvalidInput, "failed to read request body: %v", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
req.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
|
||||||
|
|
||||||
|
ctx := req.Context()
|
||||||
|
|
||||||
|
claims, err := authtypes.ClaimsFromContext(ctx)
|
||||||
|
if err != nil {
|
||||||
|
render.Error(rw, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var queryRangeRequest qbtypes.QueryRangeRequest
|
||||||
|
if err := json.NewDecoder(req.Body).Decode(&queryRangeRequest); err != nil {
|
||||||
|
render.Error(rw, errors.NewInvalidInputf(errors.CodeInvalidInput, "failed to decode request body: %v", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
stackTrace := string(debug.Stack())
|
||||||
|
|
||||||
|
queryJSON, _ := json.Marshal(queryRangeRequest)
|
||||||
|
|
||||||
|
aH.Signoz.Instrumentation.Logger().ErrorContext(ctx, "panic in QueryRange",
|
||||||
|
"error", r,
|
||||||
|
"user", claims.UserID,
|
||||||
|
"payload", string(queryJSON),
|
||||||
|
"stacktrace", stackTrace,
|
||||||
|
)
|
||||||
|
|
||||||
|
render.Error(rw, errors.NewInternalf(
|
||||||
|
errors.CodeInternal,
|
||||||
|
"Something went wrong on our end. It's not you, it's us. Our team is notified about it. Reach out to support if issue persists.",
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
if err := queryRangeRequest.Validate(); err != nil {
|
||||||
|
render.Error(rw, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
orgID, err := valuer.NewUUID(claims.OrgID)
|
||||||
|
if err != nil {
|
||||||
|
render.Error(rw, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if anomalyQuery, ok := queryRangeRequest.IsAnomalyRequest(); ok {
|
||||||
|
anomalies, err := aH.handleAnomalyQuery(ctx, orgID, anomalyQuery, queryRangeRequest)
|
||||||
|
if err != nil {
|
||||||
|
render.Error(rw, errors.NewInternalf(errors.CodeInternal, "failed to get anomalies: %v", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
results := []any{}
|
||||||
|
for _, item := range anomalies.Results {
|
||||||
|
results = append(results, item)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build step intervals from the anomaly query
|
||||||
|
stepIntervals := make(map[string]uint64)
|
||||||
|
if anomalyQuery.StepInterval.Duration > 0 {
|
||||||
|
stepIntervals[anomalyQuery.Name] = uint64(anomalyQuery.StepInterval.Duration.Seconds())
|
||||||
|
}
|
||||||
|
|
||||||
|
finalResp := &qbtypes.QueryRangeResponse{
|
||||||
|
Type: queryRangeRequest.RequestType,
|
||||||
|
Data: qbtypes.QueryData{
|
||||||
|
Results: results,
|
||||||
|
},
|
||||||
|
Meta: qbtypes.ExecStats{
|
||||||
|
StepIntervals: stepIntervals,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
render.Success(rw, http.StatusOK, finalResp)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
// regular query range request, let the querier handle it
|
||||||
|
req.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
|
||||||
|
aH.QuerierAPI.QueryRange(rw, req)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import (
|
|||||||
"github.com/gorilla/handlers"
|
"github.com/gorilla/handlers"
|
||||||
|
|
||||||
"github.com/SigNoz/signoz/ee/query-service/app/api"
|
"github.com/SigNoz/signoz/ee/query-service/app/api"
|
||||||
|
"github.com/SigNoz/signoz/ee/query-service/integrations/gateway"
|
||||||
"github.com/SigNoz/signoz/ee/query-service/rules"
|
"github.com/SigNoz/signoz/ee/query-service/rules"
|
||||||
"github.com/SigNoz/signoz/ee/query-service/usage"
|
"github.com/SigNoz/signoz/ee/query-service/usage"
|
||||||
"github.com/SigNoz/signoz/pkg/alertmanager"
|
"github.com/SigNoz/signoz/pkg/alertmanager"
|
||||||
@@ -37,7 +38,6 @@ import (
|
|||||||
"github.com/SigNoz/signoz/pkg/query-service/agentConf"
|
"github.com/SigNoz/signoz/pkg/query-service/agentConf"
|
||||||
baseapp "github.com/SigNoz/signoz/pkg/query-service/app"
|
baseapp "github.com/SigNoz/signoz/pkg/query-service/app"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/app/clickhouseReader"
|
"github.com/SigNoz/signoz/pkg/query-service/app/clickhouseReader"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/app/cloudintegrations"
|
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/app/integrations"
|
"github.com/SigNoz/signoz/pkg/query-service/app/integrations"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/app/logparsingpipeline"
|
"github.com/SigNoz/signoz/pkg/query-service/app/logparsingpipeline"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/app/opamp"
|
"github.com/SigNoz/signoz/pkg/query-service/app/opamp"
|
||||||
@@ -71,6 +71,11 @@ type Server struct {
|
|||||||
|
|
||||||
// NewServer creates and initializes Server
|
// NewServer creates and initializes Server
|
||||||
func NewServer(config signoz.Config, signoz *signoz.SigNoz) (*Server, error) {
|
func NewServer(config signoz.Config, signoz *signoz.SigNoz) (*Server, error) {
|
||||||
|
gatewayProxy, err := gateway.NewProxy(config.Gateway.URL.String(), gateway.RoutePrefix)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
cacheForTraceDetail, err := memorycache.New(context.TODO(), signoz.Instrumentation.ToProviderSettings(), cache.Config{
|
cacheForTraceDetail, err := memorycache.New(context.TODO(), signoz.Instrumentation.ToProviderSettings(), cache.Config{
|
||||||
Provider: "memory",
|
Provider: "memory",
|
||||||
Memory: cache.Memory{
|
Memory: cache.Memory{
|
||||||
@@ -121,13 +126,6 @@ func NewServer(config signoz.Config, signoz *signoz.SigNoz) (*Server, error) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
cloudIntegrationsController, err := cloudintegrations.NewController(signoz.SQLStore)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf(
|
|
||||||
"couldn't create cloud provider integrations controller: %w", err,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ingestion pipelines manager
|
// ingestion pipelines manager
|
||||||
logParsingPipelineController, err := logparsingpipeline.NewLogParsingPipelinesController(
|
logParsingPipelineController, err := logparsingpipeline.NewLogParsingPipelinesController(
|
||||||
signoz.SQLStore,
|
signoz.SQLStore,
|
||||||
@@ -161,14 +159,15 @@ func NewServer(config signoz.Config, signoz *signoz.SigNoz) (*Server, error) {
|
|||||||
RulesManager: rm,
|
RulesManager: rm,
|
||||||
UsageManager: usageManager,
|
UsageManager: usageManager,
|
||||||
IntegrationsController: integrationsController,
|
IntegrationsController: integrationsController,
|
||||||
CloudIntegrationsController: cloudIntegrationsController,
|
|
||||||
LogsParsingPipelineController: logParsingPipelineController,
|
LogsParsingPipelineController: logParsingPipelineController,
|
||||||
FluxInterval: config.Querier.FluxInterval,
|
FluxInterval: config.Querier.FluxInterval,
|
||||||
|
Gateway: gatewayProxy,
|
||||||
GatewayUrl: config.Gateway.URL.String(),
|
GatewayUrl: config.Gateway.URL.String(),
|
||||||
GlobalConfig: config.Global,
|
GlobalConfig: config.Global,
|
||||||
|
Logger: signoz.Instrumentation.Logger(),
|
||||||
}
|
}
|
||||||
|
|
||||||
apiHandler, err := api.NewAPIHandler(apiOpts, signoz, config)
|
apiHandler, err := api.NewAPIHandler(apiOpts, signoz)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -233,6 +232,7 @@ func (s *Server) createPublicServer(apiHandler *api.APIHandler, web web.Web) (*h
|
|||||||
apiHandler.RegisterQueryRangeV3Routes(r, am)
|
apiHandler.RegisterQueryRangeV3Routes(r, am)
|
||||||
apiHandler.RegisterInfraMetricsRoutes(r, am)
|
apiHandler.RegisterInfraMetricsRoutes(r, am)
|
||||||
apiHandler.RegisterQueryRangeV4Routes(r, am)
|
apiHandler.RegisterQueryRangeV4Routes(r, am)
|
||||||
|
apiHandler.RegisterQueryRangeV5Routes(r, am)
|
||||||
apiHandler.RegisterWebSocketPaths(r, am)
|
apiHandler.RegisterWebSocketPaths(r, am)
|
||||||
apiHandler.RegisterMessagingQueuesRoutes(r, am)
|
apiHandler.RegisterMessagingQueuesRoutes(r, am)
|
||||||
apiHandler.RegisterThirdPartyApiRoutes(r, am)
|
apiHandler.RegisterThirdPartyApiRoutes(r, am)
|
||||||
|
|||||||
9
ee/query-service/integrations/gateway/noop.go
Normal file
9
ee/query-service/integrations/gateway/noop.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package gateway
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http/httputil"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewNoopProxy() (*httputil.ReverseProxy, error) {
|
||||||
|
return &httputil.ReverseProxy{}, nil
|
||||||
|
}
|
||||||
66
ee/query-service/integrations/gateway/proxy.go
Normal file
66
ee/query-service/integrations/gateway/proxy.go
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
package gateway
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"net/http/httputil"
|
||||||
|
"net/url"
|
||||||
|
"path"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
RoutePrefix string = "/api/gateway"
|
||||||
|
AllowedPrefix []string = []string{"/v1/workspaces/me", "/v2/profiles/me", "/v2/deployments/me"}
|
||||||
|
)
|
||||||
|
|
||||||
|
type proxy struct {
|
||||||
|
url *url.URL
|
||||||
|
stripPath string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewProxy(u string, stripPath string) (*httputil.ReverseProxy, error) {
|
||||||
|
url, err := url.Parse(u)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
proxy := &proxy{url: url, stripPath: stripPath}
|
||||||
|
|
||||||
|
return &httputil.ReverseProxy{
|
||||||
|
Rewrite: proxy.rewrite,
|
||||||
|
ModifyResponse: proxy.modifyResponse,
|
||||||
|
ErrorHandler: proxy.errorHandler,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *proxy) rewrite(pr *httputil.ProxyRequest) {
|
||||||
|
pr.SetURL(p.url)
|
||||||
|
pr.SetXForwarded()
|
||||||
|
pr.Out.URL.Path = cleanPath(strings.ReplaceAll(pr.Out.URL.Path, p.stripPath, ""))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *proxy) modifyResponse(res *http.Response) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *proxy) errorHandler(rw http.ResponseWriter, req *http.Request, err error) {
|
||||||
|
rw.WriteHeader(http.StatusBadGateway)
|
||||||
|
}
|
||||||
|
|
||||||
|
func cleanPath(p string) string {
|
||||||
|
if p == "" {
|
||||||
|
return "/"
|
||||||
|
}
|
||||||
|
if p[0] != '/' {
|
||||||
|
p = "/" + p
|
||||||
|
}
|
||||||
|
np := path.Clean(p)
|
||||||
|
if p[len(p)-1] == '/' && np != "/" {
|
||||||
|
if len(p) == len(np)+1 && strings.HasPrefix(p, np) {
|
||||||
|
np = p
|
||||||
|
} else {
|
||||||
|
np += "/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return np
|
||||||
|
}
|
||||||
61
ee/query-service/integrations/gateway/proxy_test.go
Normal file
61
ee/query-service/integrations/gateway/proxy_test.go
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
package gateway
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"net/http/httputil"
|
||||||
|
"net/url"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestProxyRewrite(t *testing.T) {
|
||||||
|
testCases := []struct {
|
||||||
|
name string
|
||||||
|
url *url.URL
|
||||||
|
stripPath string
|
||||||
|
in *url.URL
|
||||||
|
expected *url.URL
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "SamePathAdded",
|
||||||
|
url: &url.URL{Scheme: "http", Host: "backend", Path: "/path1"},
|
||||||
|
stripPath: "/strip",
|
||||||
|
in: &url.URL{Scheme: "http", Host: "localhost", Path: "/strip/path1"},
|
||||||
|
expected: &url.URL{Scheme: "http", Host: "backend", Path: "/path1/path1"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "NoStripPathInput",
|
||||||
|
url: &url.URL{Scheme: "http", Host: "backend"},
|
||||||
|
stripPath: "",
|
||||||
|
in: &url.URL{Scheme: "http", Host: "localhost", Path: "/strip/path1"},
|
||||||
|
expected: &url.URL{Scheme: "http", Host: "backend", Path: "/strip/path1"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "NoStripPathPresentInReq",
|
||||||
|
url: &url.URL{Scheme: "http", Host: "backend"},
|
||||||
|
stripPath: "/not-found",
|
||||||
|
in: &url.URL{Scheme: "http", Host: "localhost", Path: "/strip/path1"},
|
||||||
|
expected: &url.URL{Scheme: "http", Host: "backend", Path: "/strip/path1"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range testCases {
|
||||||
|
proxy, err := NewProxy(tc.url.String(), tc.stripPath)
|
||||||
|
require.NoError(t, err)
|
||||||
|
inReq, err := http.NewRequest(http.MethodGet, tc.in.String(), nil)
|
||||||
|
require.NoError(t, err)
|
||||||
|
proxyReq := &httputil.ProxyRequest{
|
||||||
|
In: inReq,
|
||||||
|
Out: inReq.Clone(context.Background()),
|
||||||
|
}
|
||||||
|
proxy.Rewrite(proxyReq)
|
||||||
|
|
||||||
|
assert.Equal(t, tc.expected.Host, proxyReq.Out.URL.Host)
|
||||||
|
assert.Equal(t, tc.expected.Scheme, proxyReq.Out.URL.Scheme)
|
||||||
|
assert.Equal(t, tc.expected.Path, proxyReq.Out.URL.Path)
|
||||||
|
assert.Equal(t, tc.expected.Query(), proxyReq.Out.URL.Query())
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@ package httpzeus
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@@ -11,7 +10,6 @@ import (
|
|||||||
"github.com/SigNoz/signoz/pkg/errors"
|
"github.com/SigNoz/signoz/pkg/errors"
|
||||||
"github.com/SigNoz/signoz/pkg/factory"
|
"github.com/SigNoz/signoz/pkg/factory"
|
||||||
"github.com/SigNoz/signoz/pkg/http/client"
|
"github.com/SigNoz/signoz/pkg/http/client"
|
||||||
"github.com/SigNoz/signoz/pkg/types/zeustypes"
|
|
||||||
"github.com/SigNoz/signoz/pkg/zeus"
|
"github.com/SigNoz/signoz/pkg/zeus"
|
||||||
"github.com/tidwall/gjson"
|
"github.com/tidwall/gjson"
|
||||||
)
|
)
|
||||||
@@ -121,13 +119,8 @@ func (provider *Provider) PutMeters(ctx context.Context, key string, data []byte
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provider *Provider) PutProfile(ctx context.Context, key string, profile *zeustypes.PostableProfile) error {
|
func (provider *Provider) PutProfile(ctx context.Context, key string, body []byte) error {
|
||||||
body, err := json.Marshal(profile)
|
_, err := provider.do(
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = provider.do(
|
|
||||||
ctx,
|
ctx,
|
||||||
provider.config.URL.JoinPath("/v2/profiles/me"),
|
provider.config.URL.JoinPath("/v2/profiles/me"),
|
||||||
http.MethodPut,
|
http.MethodPut,
|
||||||
@@ -138,15 +131,10 @@ func (provider *Provider) PutProfile(ctx context.Context, key string, profile *z
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (provider *Provider) PutHost(ctx context.Context, key string, host *zeustypes.PostableHost) error {
|
func (provider *Provider) PutHost(ctx context.Context, key string, body []byte) error {
|
||||||
body, err := json.Marshal(host)
|
_, err := provider.do(
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = provider.do(
|
|
||||||
ctx,
|
ctx,
|
||||||
provider.config.URL.JoinPath("/v2/deployments/me/host"),
|
provider.config.URL.JoinPath("/v2/deployments/me/hosts"),
|
||||||
http.MethodPut,
|
http.MethodPut,
|
||||||
key,
|
key,
|
||||||
body,
|
body,
|
||||||
@@ -181,28 +169,21 @@ func (provider *Provider) do(ctx context.Context, url *url.URL, method string, k
|
|||||||
return body, nil
|
return body, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
errorMessage := gjson.GetBytes(body, "error").String()
|
return nil, provider.errFromStatusCode(response.StatusCode)
|
||||||
if errorMessage == "" {
|
|
||||||
errorMessage = "an unknown error occurred"
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, provider.errFromStatusCode(response.StatusCode, errorMessage)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This can be taken down to the client package
|
// This can be taken down to the client package
|
||||||
func (provider *Provider) errFromStatusCode(statusCode int, errorMessage string) error {
|
func (provider *Provider) errFromStatusCode(statusCode int) error {
|
||||||
switch statusCode {
|
switch statusCode {
|
||||||
case http.StatusBadRequest:
|
case http.StatusBadRequest:
|
||||||
return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, errorMessage)
|
return errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "bad request")
|
||||||
case http.StatusUnauthorized:
|
case http.StatusUnauthorized:
|
||||||
return errors.New(errors.TypeUnauthenticated, errors.CodeUnauthenticated, errorMessage)
|
return errors.Newf(errors.TypeUnauthenticated, errors.CodeUnauthenticated, "unauthenticated")
|
||||||
case http.StatusForbidden:
|
case http.StatusForbidden:
|
||||||
return errors.New(errors.TypeForbidden, errors.CodeForbidden, errorMessage)
|
return errors.Newf(errors.TypeForbidden, errors.CodeForbidden, "forbidden")
|
||||||
case http.StatusNotFound:
|
case http.StatusNotFound:
|
||||||
return errors.New(errors.TypeNotFound, errors.CodeNotFound, errorMessage)
|
return errors.Newf(errors.TypeNotFound, errors.CodeNotFound, "not found")
|
||||||
case http.StatusConflict:
|
|
||||||
return errors.New(errors.TypeAlreadyExists, errors.CodeAlreadyExists, errorMessage)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return errors.New(errors.TypeInternal, errors.CodeInternal, errorMessage)
|
return errors.Newf(errors.TypeInternal, errors.CodeInternal, "internal")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,74 +0,0 @@
|
|||||||
---
|
|
||||||
description: Core testing conventions - imports, rendering, MSW, interactions, queries
|
|
||||||
globs: **/*.test.{ts,tsx}
|
|
||||||
alwaysApply: false
|
|
||||||
---
|
|
||||||
|
|
||||||
# Testing Conventions
|
|
||||||
|
|
||||||
## Imports
|
|
||||||
|
|
||||||
Always import from the test harness, never directly from `@testing-library/react`:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { render, screen, userEvent, waitFor } from 'tests/test-utils';
|
|
||||||
import { server, rest } from 'mocks-server/server';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Router
|
|
||||||
|
|
||||||
Use the built-in router in `render`:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
render(<Page />, undefined, { initialRoute: '/traces-explorer' });
|
|
||||||
```
|
|
||||||
|
|
||||||
Only mock `useLocation` / `useParams` if the test depends on their values.
|
|
||||||
|
|
||||||
## MSW
|
|
||||||
|
|
||||||
Global MSW server runs automatically. Override per-test:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
server.use(
|
|
||||||
rest.get('*/api/v1/foo', (_req, res, ctx) =>
|
|
||||||
res(ctx.status(200), ctx.json({ ok: true })))
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
Keep large response fixtures in `mocks-server/__mockdata_`.
|
|
||||||
|
|
||||||
## Interactions
|
|
||||||
|
|
||||||
- Prefer `userEvent` for real user interactions (click, type, select, tab).
|
|
||||||
- Use `fireEvent` only for low-level events not covered by `userEvent` (e.g., scroll, resize). Wrap in `act(...)` if needed.
|
|
||||||
- Always `await` interactions:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
|
||||||
await user.click(screen.getByRole('button', { name: /save/i }));
|
|
||||||
```
|
|
||||||
|
|
||||||
## Timers
|
|
||||||
|
|
||||||
No global fake timers. Per-test only, for debounce/throttle:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
jest.useFakeTimers();
|
|
||||||
const user = userEvent.setup({ advanceTimers: (ms) => jest.advanceTimersByTime(ms) });
|
|
||||||
await user.type(screen.getByRole('textbox'), 'query');
|
|
||||||
jest.advanceTimersByTime(400);
|
|
||||||
jest.useRealTimers();
|
|
||||||
```
|
|
||||||
|
|
||||||
## Queries
|
|
||||||
|
|
||||||
Prefer accessible queries: `getByRole` > `findByRole` > `getByLabelText` > visible text > `data-testid` (last resort).
|
|
||||||
|
|
||||||
## Anti-patterns
|
|
||||||
|
|
||||||
- Never import from `@testing-library/react` directly
|
|
||||||
- Never use global fake timers
|
|
||||||
- Never wrap `render` in `act(...)`
|
|
||||||
- Never mock infra dependencies locally (router, react-query)
|
|
||||||
- Limit to 3-5 focused tests per file
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
---
|
|
||||||
description: When to use global vs local mocks in tests
|
|
||||||
globs: **/*.test.{ts,tsx}
|
|
||||||
alwaysApply: false
|
|
||||||
---
|
|
||||||
|
|
||||||
# Mock Strategy
|
|
||||||
|
|
||||||
## Use Global Mocks For
|
|
||||||
|
|
||||||
High-frequency dependencies (20+ test files):
|
|
||||||
- Core infrastructure: react-router-dom, react-query, antd
|
|
||||||
- Browser APIs: ResizeObserver, matchMedia, localStorage
|
|
||||||
- Utility libraries: date-fns, lodash
|
|
||||||
|
|
||||||
Available global mock files (from jest.config.ts):
|
|
||||||
- `uplot` -> `__mocks__/uplotMock.ts`
|
|
||||||
|
|
||||||
## Use Local Mocks For
|
|
||||||
|
|
||||||
- Business logic dependencies (API endpoints, custom hooks, domain components)
|
|
||||||
- Test-specific behavior (different data per test, error scenarios, loading states)
|
|
||||||
|
|
||||||
## Decision Tree
|
|
||||||
|
|
||||||
```
|
|
||||||
Used in 20+ test files?
|
|
||||||
YES -> Global mock
|
|
||||||
NO -> Business logic or test-specific?
|
|
||||||
YES -> Local mock
|
|
||||||
NO -> Consider global if usage grows
|
|
||||||
```
|
|
||||||
|
|
||||||
## Correct Usage
|
|
||||||
|
|
||||||
```ts
|
|
||||||
// Global mocks are already available - just import
|
|
||||||
import { useLocation } from 'react-router-dom';
|
|
||||||
|
|
||||||
// Local mocks for business logic
|
|
||||||
jest.mock('../api/tracesService', () => ({
|
|
||||||
getTraces: jest.fn(() => mockTracesData),
|
|
||||||
}));
|
|
||||||
```
|
|
||||||
|
|
||||||
## Anti-patterns
|
|
||||||
|
|
||||||
```ts
|
|
||||||
// Never re-mock globally mocked dependencies locally
|
|
||||||
jest.mock('react-router-dom', () => ({ ... }));
|
|
||||||
|
|
||||||
// Never put test-specific data in global mocks
|
|
||||||
jest.mock('../api/tracesService', () => ({ getTraces: jest.fn(() => specificTestData) }));
|
|
||||||
```
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
---
|
|
||||||
description: TypeScript type safety requirements for Jest tests
|
|
||||||
globs: **/*.test.{ts,tsx}
|
|
||||||
alwaysApply: false
|
|
||||||
---
|
|
||||||
|
|
||||||
# TypeScript Type Safety in Tests
|
|
||||||
|
|
||||||
All Jest tests must be fully type-safe. Never use `any`.
|
|
||||||
|
|
||||||
## Mock Function Typing
|
|
||||||
|
|
||||||
```ts
|
|
||||||
// Use jest.mocked for module mocks
|
|
||||||
import useFoo from 'hooks/useFoo';
|
|
||||||
jest.mock('hooks/useFoo');
|
|
||||||
const mockUseFoo = jest.mocked(useFoo);
|
|
||||||
|
|
||||||
// Use jest.MockedFunction for standalone mocks
|
|
||||||
const mockFetch = jest.fn() as jest.MockedFunction<(id: number) => Promise<User>>;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Mock Data
|
|
||||||
|
|
||||||
Define interfaces for all mock data:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const mockUser: User = { id: 1, name: 'John', email: 'john@example.com' };
|
|
||||||
|
|
||||||
const mockProps: ComponentProps = {
|
|
||||||
title: 'Test',
|
|
||||||
data: [mockUser],
|
|
||||||
onSelect: jest.fn() as jest.MockedFunction<(user: User) => void>,
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
## Hook Mocking Pattern
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import useFoo from 'hooks/useFoo';
|
|
||||||
jest.mock('hooks/useFoo');
|
|
||||||
const mockUseFoo = jest.mocked(useFoo);
|
|
||||||
mockUseFoo.mockReturnValue(/* minimal shape */);
|
|
||||||
```
|
|
||||||
|
|
||||||
Prefer helpers (`rqSuccess`, `rqLoading`, `rqError`) for React Query results.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
|
|
||||||
- All mock functions use `jest.MockedFunction<T>` or `jest.mocked()`
|
|
||||||
- All mock data has proper interfaces
|
|
||||||
- No `any` types in test files
|
|
||||||
- Component props are typed
|
|
||||||
- API response types are defined
|
|
||||||
484
frontend/.cursorrules
Normal file
484
frontend/.cursorrules
Normal file
@@ -0,0 +1,484 @@
|
|||||||
|
# Persona
|
||||||
|
You are an expert developer with deep knowledge of Jest, React Testing Library, MSW, and TypeScript, tasked with creating unit tests for this repository.
|
||||||
|
|
||||||
|
# Auto-detect TypeScript Usage
|
||||||
|
Check for TypeScript in the project through tsconfig.json or package.json dependencies.
|
||||||
|
Adjust syntax based on this detection.
|
||||||
|
|
||||||
|
# TypeScript Type Safety for Jest Tests
|
||||||
|
**CRITICAL**: All Jest tests MUST be fully type-safe with proper TypeScript types.
|
||||||
|
|
||||||
|
**Type Safety Requirements:**
|
||||||
|
- Use proper TypeScript interfaces for all mock data
|
||||||
|
- Type all Jest mock functions with `jest.MockedFunction<T>`
|
||||||
|
- Use generic types for React components and hooks
|
||||||
|
- Define proper return types for mock functions
|
||||||
|
- Use `as const` for literal types when needed
|
||||||
|
- Avoid `any` type – use proper typing instead
|
||||||
|
|
||||||
|
# Unit Testing Focus
|
||||||
|
Focus on critical functionality (business logic, utility functions, component behavior)
|
||||||
|
Mock dependencies (API calls, external modules) before imports
|
||||||
|
Test multiple data scenarios (valid inputs, invalid inputs, edge cases)
|
||||||
|
Write maintainable tests with descriptive names grouped in describe blocks
|
||||||
|
|
||||||
|
# Global vs Local Mocks
|
||||||
|
**Use Global Mocks for:**
|
||||||
|
- High-frequency dependencies (20+ test files)
|
||||||
|
- Core infrastructure (react-router-dom, react-query, antd)
|
||||||
|
- Standard implementations across the app
|
||||||
|
- Browser APIs (ResizeObserver, matchMedia, localStorage)
|
||||||
|
- Utility libraries (date-fns, lodash)
|
||||||
|
|
||||||
|
**Use Local Mocks for:**
|
||||||
|
- Business logic dependencies (5-15 test files)
|
||||||
|
- Test-specific behavior (different data per test)
|
||||||
|
- API endpoints with specific responses
|
||||||
|
- Domain-specific components
|
||||||
|
- Error scenarios and edge cases
|
||||||
|
|
||||||
|
**Global Mock Files Available (from jest.config.ts):**
|
||||||
|
- `uplot` → `__mocks__/uplotMock.ts`
|
||||||
|
|
||||||
|
# Repo-specific Testing Conventions
|
||||||
|
|
||||||
|
## Imports
|
||||||
|
Always import from our harness:
|
||||||
|
```ts
|
||||||
|
import { render, screen, userEvent, waitFor } from 'tests/test-utils';
|
||||||
|
```
|
||||||
|
For API mocks:
|
||||||
|
```ts
|
||||||
|
import { server, rest } from 'mocks-server/server';
|
||||||
|
```
|
||||||
|
Do not import directly from `@testing-library/react`.
|
||||||
|
|
||||||
|
## Router
|
||||||
|
Use the router built into render:
|
||||||
|
```ts
|
||||||
|
render(<Page />, undefined, { initialRoute: '/traces-explorer' });
|
||||||
|
```
|
||||||
|
Only mock `useLocation` / `useParams` if the test depends on them.
|
||||||
|
|
||||||
|
## Hook Mocks
|
||||||
|
Pattern:
|
||||||
|
```ts
|
||||||
|
import useFoo from 'hooks/useFoo';
|
||||||
|
jest.mock('hooks/useFoo');
|
||||||
|
const mockUseFoo = jest.mocked(useFoo);
|
||||||
|
mockUseFoo.mockReturnValue(/* minimal shape */ as any);
|
||||||
|
```
|
||||||
|
Prefer helpers (`rqSuccess`, `rqLoading`, `rqError`) for React Query results.
|
||||||
|
|
||||||
|
## MSW
|
||||||
|
Global MSW server runs automatically.
|
||||||
|
Override per-test:
|
||||||
|
```ts
|
||||||
|
server.use(
|
||||||
|
rest.get('*/api/v1/foo', (_req, res, ctx) => res(ctx.status(200), ctx.json({ ok: true })))
|
||||||
|
);
|
||||||
|
```
|
||||||
|
Keep large responses in `mocks-server/__mockdata_`.
|
||||||
|
|
||||||
|
## Interactions
|
||||||
|
- Prefer `userEvent` for real user interactions (click, type, select, tab).
|
||||||
|
- Use `fireEvent` only for low-level/programmatic events not covered by `userEvent` (e.g., scroll, resize, setting `element.scrollTop` for virtualization). Wrap in `act(...)` if needed.
|
||||||
|
- Always await interactions:
|
||||||
|
```ts
|
||||||
|
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||||
|
await user.click(screen.getByRole('button', { name: /save/i }));
|
||||||
|
```
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// Example: virtualized list scroll (no userEvent helper)
|
||||||
|
const scroller = container.querySelector('[data-test-id="virtuoso-scroller"]') as HTMLElement;
|
||||||
|
scroller.scrollTop = targetScrollTop;
|
||||||
|
act(() => { fireEvent.scroll(scroller); });
|
||||||
|
```
|
||||||
|
|
||||||
|
## Timers
|
||||||
|
❌ No global fake timers.
|
||||||
|
✅ Per-test only, for debounce/throttle:
|
||||||
|
```ts
|
||||||
|
jest.useFakeTimers();
|
||||||
|
const user = userEvent.setup({ advanceTimers: (ms) => jest.advanceTimersByTime(ms) });
|
||||||
|
await user.type(screen.getByRole('textbox'), 'query');
|
||||||
|
jest.advanceTimersByTime(400);
|
||||||
|
jest.useRealTimers();
|
||||||
|
```
|
||||||
|
|
||||||
|
## Queries
|
||||||
|
Prefer accessible queries (`getByRole`, `findByRole`, `getByLabelText`).
|
||||||
|
Fallback: visible text.
|
||||||
|
Last resort: `data-testid`.
|
||||||
|
|
||||||
|
# Example Test (using only configured global mocks)
|
||||||
|
```ts
|
||||||
|
import { render, screen, userEvent, waitFor } from 'tests/test-utils';
|
||||||
|
import { server, rest } from 'mocks-server/server';
|
||||||
|
import MyComponent from '../MyComponent';
|
||||||
|
|
||||||
|
describe('MyComponent', () => {
|
||||||
|
it('renders and interacts', async () => {
|
||||||
|
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||||
|
|
||||||
|
server.use(
|
||||||
|
rest.get('*/api/v1/example', (_req, res, ctx) => res(ctx.status(200), ctx.json({ value: 42 })))
|
||||||
|
);
|
||||||
|
|
||||||
|
render(<MyComponent />, undefined, { initialRoute: '/foo' });
|
||||||
|
|
||||||
|
expect(await screen.findByText(/value: 42/i)).toBeInTheDocument();
|
||||||
|
await user.click(screen.getByRole('button', { name: /refresh/i }));
|
||||||
|
await waitFor(() => expect(screen.getByText(/loading/i)).toBeInTheDocument());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
# Anti-patterns
|
||||||
|
❌ Importing RTL directly
|
||||||
|
❌ Using global fake timers
|
||||||
|
❌ Wrapping render in `act(...)`
|
||||||
|
❌ Mocking infra dependencies locally (router, react-query)
|
||||||
|
✅ Use our harness (`tests/test-utils`)
|
||||||
|
✅ Use MSW for API overrides
|
||||||
|
✅ Use userEvent + await
|
||||||
|
✅ Pin time only in tests that assert relative dates
|
||||||
|
|
||||||
|
# Best Practices
|
||||||
|
- **Critical Functionality**: Prioritize testing business logic and utilities
|
||||||
|
- **Dependency Mocking**: Global mocks for infra, local mocks for business logic
|
||||||
|
- **Data Scenarios**: Always test valid, invalid, and edge cases
|
||||||
|
- **Descriptive Names**: Make test intent clear
|
||||||
|
- **Organization**: Group related tests in describe
|
||||||
|
- **Consistency**: Match repo conventions
|
||||||
|
- **Edge Cases**: Test null, undefined, unexpected values
|
||||||
|
- **Limit Scope**: 3–5 focused tests per file
|
||||||
|
- **Use Helpers**: `rqSuccess`, `makeUser`, etc.
|
||||||
|
- **No Any**: Enforce type safety
|
||||||
|
|
||||||
|
# Example Test
|
||||||
|
```ts
|
||||||
|
import { render, screen, userEvent, waitFor } from 'tests/test-utils';
|
||||||
|
import { server, rest } from 'mocks-server/server';
|
||||||
|
import MyComponent from '../MyComponent';
|
||||||
|
|
||||||
|
describe('MyComponent', () => {
|
||||||
|
it('renders and interacts', async () => {
|
||||||
|
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||||
|
|
||||||
|
server.use(
|
||||||
|
rest.get('*/api/v1/example', (_req, res, ctx) => res(ctx.status(200), ctx.json({ value: 42 })))
|
||||||
|
);
|
||||||
|
|
||||||
|
render(<MyComponent />, undefined, { initialRoute: '/foo' });
|
||||||
|
|
||||||
|
expect(await screen.findByText(/value: 42/i)).toBeInTheDocument();
|
||||||
|
await user.click(screen.getByRole('button', { name: /refresh/i }));
|
||||||
|
await waitFor(() => expect(screen.getByText(/loading/i)).toBeInTheDocument());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
# Anti-patterns
|
||||||
|
❌ Importing RTL directly
|
||||||
|
❌ Using global fake timers
|
||||||
|
❌ Wrapping render in `act(...)`
|
||||||
|
❌ Mocking infra dependencies locally (router, react-query)
|
||||||
|
✅ Use our harness (`tests/test-utils`)
|
||||||
|
✅ Use MSW for API overrides
|
||||||
|
✅ Use userEvent + await
|
||||||
|
✅ Pin time only in tests that assert relative dates
|
||||||
|
|
||||||
|
# TypeScript Type Safety Examples
|
||||||
|
|
||||||
|
## Proper Mock Typing
|
||||||
|
```ts
|
||||||
|
// ✅ GOOD - Properly typed mocks
|
||||||
|
interface User {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
email: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ApiResponse<T> {
|
||||||
|
data: T;
|
||||||
|
status: number;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type the mock functions
|
||||||
|
const mockFetchUser = jest.fn() as jest.MockedFunction<(id: number) => Promise<ApiResponse<User>>>;
|
||||||
|
const mockUpdateUser = jest.fn() as jest.MockedFunction<(user: User) => Promise<ApiResponse<User>>>;
|
||||||
|
|
||||||
|
// Mock implementation with proper typing
|
||||||
|
mockFetchUser.mockResolvedValue({
|
||||||
|
data: { id: 1, name: 'John Doe', email: 'john@example.com' },
|
||||||
|
status: 200,
|
||||||
|
message: 'Success'
|
||||||
|
});
|
||||||
|
|
||||||
|
// ❌ BAD - Using any type
|
||||||
|
const mockFetchUser = jest.fn() as any; // Don't do this
|
||||||
|
```
|
||||||
|
|
||||||
|
## React Component Testing with Types
|
||||||
|
```ts
|
||||||
|
// ✅ GOOD - Properly typed component testing
|
||||||
|
interface ComponentProps {
|
||||||
|
title: string;
|
||||||
|
data: User[];
|
||||||
|
onUserSelect: (user: User) => void;
|
||||||
|
isLoading?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TestComponent: React.FC<ComponentProps> = ({ title, data, onUserSelect, isLoading = false }) => {
|
||||||
|
// Component implementation
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('TestComponent', () => {
|
||||||
|
it('should render with proper props', () => {
|
||||||
|
// Arrange - Type the props properly
|
||||||
|
const mockProps: ComponentProps = {
|
||||||
|
title: 'Test Title',
|
||||||
|
data: [{ id: 1, name: 'John', email: 'john@example.com' }],
|
||||||
|
onUserSelect: jest.fn() as jest.MockedFunction<(user: User) => void>,
|
||||||
|
isLoading: false
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
render(<TestComponent {...mockProps} />);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(screen.getByText('Test Title')).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Hook Testing with Types
|
||||||
|
```ts
|
||||||
|
// ✅ GOOD - Properly typed hook testing
|
||||||
|
interface UseUserDataReturn {
|
||||||
|
user: User | null;
|
||||||
|
loading: boolean;
|
||||||
|
error: string | null;
|
||||||
|
refetch: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const useUserData = (id: number): UseUserDataReturn => {
|
||||||
|
// Hook implementation
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('useUserData', () => {
|
||||||
|
it('should return user data with proper typing', () => {
|
||||||
|
// Arrange
|
||||||
|
const mockUser: User = { id: 1, name: 'John', email: 'john@example.com' };
|
||||||
|
mockFetchUser.mockResolvedValue({
|
||||||
|
data: mockUser,
|
||||||
|
status: 200,
|
||||||
|
message: 'Success'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const { result } = renderHook(() => useUserData(1));
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result.current.user).toEqual(mockUser);
|
||||||
|
expect(result.current.loading).toBe(false);
|
||||||
|
expect(result.current.error).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Global Mock Type Safety
|
||||||
|
```ts
|
||||||
|
// ✅ GOOD - Type-safe global mocks
|
||||||
|
// In __mocks__/routerMock.ts
|
||||||
|
export const mockUseLocation = (overrides: Partial<Location> = {}): Location => ({
|
||||||
|
pathname: '/traces',
|
||||||
|
search: '',
|
||||||
|
hash: '',
|
||||||
|
state: null,
|
||||||
|
key: 'test-key',
|
||||||
|
...overrides,
|
||||||
|
});
|
||||||
|
|
||||||
|
// In test files
|
||||||
|
const location = useLocation(); // Properly typed from global mock
|
||||||
|
expect(location.pathname).toBe('/traces');
|
||||||
|
```
|
||||||
|
|
||||||
|
# TypeScript Configuration for Jest
|
||||||
|
|
||||||
|
## Required Jest Configuration
|
||||||
|
```json
|
||||||
|
// jest.config.ts
|
||||||
|
{
|
||||||
|
"preset": "ts-jest/presets/js-with-ts-esm",
|
||||||
|
"globals": {
|
||||||
|
"ts-jest": {
|
||||||
|
"useESM": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"tsconfig": "<rootDir>/tsconfig.jest.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extensionsToTreatAsEsm": [".ts", ".tsx"],
|
||||||
|
"moduleFileExtensions": ["ts", "tsx", "js", "json"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## TypeScript Jest Configuration
|
||||||
|
```json
|
||||||
|
// tsconfig.jest.json
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"types": ["jest", "@testing-library/jest-dom"],
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"moduleResolution": "node"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*",
|
||||||
|
"**/*.test.ts",
|
||||||
|
"**/*.test.tsx",
|
||||||
|
"__mocks__/**/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Common Type Safety Patterns
|
||||||
|
|
||||||
|
### Mock Function Typing
|
||||||
|
```ts
|
||||||
|
// ✅ GOOD - Proper mock function typing
|
||||||
|
const mockApiCall = jest.fn() as jest.MockedFunction<typeof apiCall>;
|
||||||
|
const mockEventHandler = jest.fn() as jest.MockedFunction<(event: Event) => void>;
|
||||||
|
|
||||||
|
// ❌ BAD - Using any
|
||||||
|
const mockApiCall = jest.fn() as any;
|
||||||
|
```
|
||||||
|
|
||||||
|
### Generic Mock Typing
|
||||||
|
```ts
|
||||||
|
// ✅ GOOD - Generic mock typing
|
||||||
|
interface MockApiResponse<T> {
|
||||||
|
data: T;
|
||||||
|
status: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const mockFetchData = jest.fn() as jest.MockedFunction<
|
||||||
|
<T>(endpoint: string) => Promise<MockApiResponse<T>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
// Usage
|
||||||
|
mockFetchData<User>('/users').mockResolvedValue({
|
||||||
|
data: { id: 1, name: 'John' },
|
||||||
|
status: 200
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### React Testing Library with Types
|
||||||
|
```ts
|
||||||
|
// ✅ GOOD - Typed testing utilities
|
||||||
|
import { render, screen, RenderResult } from '@testing-library/react';
|
||||||
|
import { ComponentProps } from 'react';
|
||||||
|
|
||||||
|
type TestComponentProps = ComponentProps<typeof TestComponent>;
|
||||||
|
|
||||||
|
const renderTestComponent = (props: Partial<TestComponentProps> = {}): RenderResult => {
|
||||||
|
const defaultProps: TestComponentProps = {
|
||||||
|
title: 'Test',
|
||||||
|
data: [],
|
||||||
|
onSelect: jest.fn(),
|
||||||
|
...props
|
||||||
|
};
|
||||||
|
|
||||||
|
return render(<TestComponent {...defaultProps} />);
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### Error Handling with Types
|
||||||
|
```ts
|
||||||
|
// ✅ GOOD - Typed error handling
|
||||||
|
interface ApiError {
|
||||||
|
message: string;
|
||||||
|
code: number;
|
||||||
|
details?: Record<string, unknown>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const mockApiError: ApiError = {
|
||||||
|
message: 'API Error',
|
||||||
|
code: 500,
|
||||||
|
details: { endpoint: '/users' }
|
||||||
|
};
|
||||||
|
|
||||||
|
mockFetchUser.mockRejectedValue(new Error(JSON.stringify(mockApiError)));
|
||||||
|
```
|
||||||
|
|
||||||
|
## Type Safety Checklist
|
||||||
|
- [ ] All mock functions use `jest.MockedFunction<T>`
|
||||||
|
- [ ] All mock data has proper interfaces
|
||||||
|
- [ ] No `any` types in test files
|
||||||
|
- [ ] Generic types are used where appropriate
|
||||||
|
- [ ] Error types are properly defined
|
||||||
|
- [ ] Component props are typed
|
||||||
|
- [ ] Hook return types are defined
|
||||||
|
- [ ] API response types are defined
|
||||||
|
- [ ] Global mocks are type-safe
|
||||||
|
- [ ] Test utilities are properly typed
|
||||||
|
|
||||||
|
# Mock Decision Tree
|
||||||
|
```
|
||||||
|
Is it used in 20+ test files?
|
||||||
|
├─ YES → Use Global Mock
|
||||||
|
│ ├─ react-router-dom
|
||||||
|
│ ├─ react-query
|
||||||
|
│ ├─ antd components
|
||||||
|
│ └─ browser APIs
|
||||||
|
│
|
||||||
|
└─ NO → Is it business logic?
|
||||||
|
├─ YES → Use Local Mock
|
||||||
|
│ ├─ API endpoints
|
||||||
|
│ ├─ Custom hooks
|
||||||
|
│ └─ Domain components
|
||||||
|
│
|
||||||
|
└─ NO → Is it test-specific?
|
||||||
|
├─ YES → Use Local Mock
|
||||||
|
│ ├─ Error scenarios
|
||||||
|
│ ├─ Loading states
|
||||||
|
│ └─ Specific data
|
||||||
|
│
|
||||||
|
└─ NO → Consider Global Mock
|
||||||
|
└─ If it becomes frequently used
|
||||||
|
```
|
||||||
|
|
||||||
|
# Common Anti-Patterns to Avoid
|
||||||
|
|
||||||
|
❌ **Don't mock global dependencies locally:**
|
||||||
|
```js
|
||||||
|
// BAD - This is already globally mocked
|
||||||
|
jest.mock('react-router-dom', () => ({ ... }));
|
||||||
|
```
|
||||||
|
|
||||||
|
❌ **Don't create global mocks for test-specific data:**
|
||||||
|
```js
|
||||||
|
// BAD - This should be local
|
||||||
|
jest.mock('../api/tracesService', () => ({
|
||||||
|
getTraces: jest.fn(() => specificTestData)
|
||||||
|
}));
|
||||||
|
```
|
||||||
|
|
||||||
|
✅ **Do use global mocks for infrastructure:**
|
||||||
|
```js
|
||||||
|
// GOOD - Use global mock
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
```
|
||||||
|
|
||||||
|
✅ **Do create local mocks for business logic:**
|
||||||
|
```js
|
||||||
|
// GOOD - Local mock for specific test needs
|
||||||
|
jest.mock('../api/tracesService', () => ({
|
||||||
|
getTraces: jest.fn(() => mockTracesData)
|
||||||
|
}));
|
||||||
|
```
|
||||||
@@ -12,8 +12,6 @@ export interface MockUPlotInstance {
|
|||||||
export interface MockUPlotPaths {
|
export interface MockUPlotPaths {
|
||||||
spline: jest.Mock;
|
spline: jest.Mock;
|
||||||
bars: jest.Mock;
|
bars: jest.Mock;
|
||||||
linear: jest.Mock;
|
|
||||||
stepped: jest.Mock;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create mock instance methods
|
// Create mock instance methods
|
||||||
@@ -25,23 +23,10 @@ const createMockUPlotInstance = (): MockUPlotInstance => ({
|
|||||||
setSeries: jest.fn(),
|
setSeries: jest.fn(),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Path builder: (self, seriesIdx, idx0, idx1) => paths or null
|
// Create mock paths
|
||||||
const createMockPathBuilder = (name: string): jest.Mock =>
|
const mockPaths: MockUPlotPaths = {
|
||||||
jest.fn(() => ({
|
spline: jest.fn(),
|
||||||
name, // To test if the correct pathBuilder is used
|
bars: jest.fn(),
|
||||||
stroke: jest.fn(),
|
|
||||||
fill: jest.fn(),
|
|
||||||
clip: jest.fn(),
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Create mock paths - linear, spline, stepped needed by UPlotSeriesBuilder.getPathBuilder
|
|
||||||
const mockPaths = {
|
|
||||||
spline: jest.fn(() => createMockPathBuilder('spline')),
|
|
||||||
bars: jest.fn(() => createMockPathBuilder('bars')),
|
|
||||||
linear: jest.fn(() => createMockPathBuilder('linear')),
|
|
||||||
stepped: jest.fn((opts?: { align?: number }) =>
|
|
||||||
createMockPathBuilder(`stepped-(${opts?.align ?? 0})`),
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Mock static methods
|
// Mock static methods
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ export default defineConfig({
|
|||||||
useMutation: true,
|
useMutation: true,
|
||||||
useInvalidate: true,
|
useInvalidate: true,
|
||||||
signal: true,
|
signal: true,
|
||||||
useOperationIdAsQueryKey: false,
|
useOperationIdAsQueryKey: true,
|
||||||
},
|
},
|
||||||
useDates: true,
|
useDates: true,
|
||||||
useNamedParameters: true,
|
useNamedParameters: true,
|
||||||
enumGenerationType: 'enum',
|
enumGenerationType: 'enum',
|
||||||
mutator: {
|
mutator: {
|
||||||
path: './src/api/generatedAPIInstance.ts',
|
path: './src/api/index.ts',
|
||||||
name: 'GeneratedAPIInstance',
|
name: 'GeneratedAPIInstance',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -55,10 +55,8 @@
|
|||||||
"@signozhq/icons": "0.1.0",
|
"@signozhq/icons": "0.1.0",
|
||||||
"@signozhq/input": "0.0.2",
|
"@signozhq/input": "0.0.2",
|
||||||
"@signozhq/popover": "0.0.0",
|
"@signozhq/popover": "0.0.0",
|
||||||
"@signozhq/radio-group": "0.0.2",
|
|
||||||
"@signozhq/resizable": "0.0.0",
|
"@signozhq/resizable": "0.0.0",
|
||||||
"@signozhq/sonner": "0.1.0",
|
"@signozhq/sonner": "0.1.0",
|
||||||
"@signozhq/switch": "0.0.2",
|
|
||||||
"@signozhq/table": "0.3.7",
|
"@signozhq/table": "0.3.7",
|
||||||
"@signozhq/tooltip": "0.0.2",
|
"@signozhq/tooltip": "0.0.2",
|
||||||
"@tanstack/react-table": "8.20.6",
|
"@tanstack/react-table": "8.20.6",
|
||||||
|
|||||||
@@ -12,6 +12,5 @@
|
|||||||
"pipeline": "Pipeline",
|
"pipeline": "Pipeline",
|
||||||
"pipelines": "Pipelines",
|
"pipelines": "Pipelines",
|
||||||
"archives": "Archives",
|
"archives": "Archives",
|
||||||
"logs_to_metrics": "Logs To Metrics",
|
"logs_to_metrics": "Logs To Metrics"
|
||||||
"roles": "Roles"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,5 @@
|
|||||||
"pipeline": "Pipeline",
|
"pipeline": "Pipeline",
|
||||||
"pipelines": "Pipelines",
|
"pipelines": "Pipelines",
|
||||||
"archives": "Archives",
|
"archives": "Archives",
|
||||||
"logs_to_metrics": "Logs To Metrics",
|
"logs_to_metrics": "Logs To Metrics"
|
||||||
"roles": "Roles"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,5 @@
|
|||||||
"API_MONITORING": "SigNoz | External APIs",
|
"API_MONITORING": "SigNoz | External APIs",
|
||||||
"METER_EXPLORER": "SigNoz | Meter Explorer",
|
"METER_EXPLORER": "SigNoz | Meter Explorer",
|
||||||
"METER_EXPLORER_VIEWS": "SigNoz | Meter Explorer Views",
|
"METER_EXPLORER_VIEWS": "SigNoz | Meter Explorer Views",
|
||||||
"METER": "SigNoz | Meter",
|
"METER": "SigNoz | Meter"
|
||||||
"ROLES_SETTINGS": "SigNoz | Roles"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -308,15 +308,3 @@ 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'),
|
|
||||||
);
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
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,
|
||||||
@@ -27,8 +29,6 @@ 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: MessagingQueuesMainPage,
|
component: MessagingQueues,
|
||||||
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: MessagingQueuesMainPage,
|
component: MessagingQueues,
|
||||||
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: MessagingQueuesMainPage,
|
component: MessagingQueues,
|
||||||
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: MessagingQueuesMainPage,
|
component: MessagingQueues,
|
||||||
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: MeterExplorerPage,
|
component: MeterExplorer,
|
||||||
key: 'METER',
|
key: 'METER',
|
||||||
isPrivate: true,
|
isPrivate: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ROUTES.METER_EXPLORER,
|
path: ROUTES.METER_EXPLORER,
|
||||||
exact: true,
|
exact: true,
|
||||||
component: MeterExplorerPage,
|
component: MeterExplorer,
|
||||||
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: MeterExplorerPage,
|
component: MeterExplorer,
|
||||||
key: 'METER_EXPLORER_VIEWS',
|
key: 'METER_EXPLORER_VIEWS',
|
||||||
isPrivate: true,
|
isPrivate: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
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: [],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
29
frontend/src/api/IngestionKeys/createIngestionKey.ts
Normal file
29
frontend/src/api/IngestionKeys/createIngestionKey.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { GatewayApiV1Instance } from 'api';
|
||||||
|
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
||||||
|
import { AxiosError } from 'axios';
|
||||||
|
import { ErrorResponse, SuccessResponse } from 'types/api';
|
||||||
|
import {
|
||||||
|
CreateIngestionKeyProps,
|
||||||
|
IngestionKeyProps,
|
||||||
|
} from 'types/api/ingestionKeys/types';
|
||||||
|
|
||||||
|
const createIngestionKey = async (
|
||||||
|
props: CreateIngestionKeyProps,
|
||||||
|
): Promise<SuccessResponse<IngestionKeyProps> | ErrorResponse> => {
|
||||||
|
try {
|
||||||
|
const response = await GatewayApiV1Instance.post('/workspaces/me/keys', {
|
||||||
|
...props,
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
statusCode: 200,
|
||||||
|
error: null,
|
||||||
|
message: response.data.status,
|
||||||
|
payload: response.data.data,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return ErrorResponseHandler(error as AxiosError);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default createIngestionKey;
|
||||||
26
frontend/src/api/IngestionKeys/deleteIngestionKey.ts
Normal file
26
frontend/src/api/IngestionKeys/deleteIngestionKey.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import { GatewayApiV1Instance } from 'api';
|
||||||
|
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
||||||
|
import { AxiosError } from 'axios';
|
||||||
|
import { ErrorResponse, SuccessResponse } from 'types/api';
|
||||||
|
import { AllIngestionKeyProps } from 'types/api/ingestionKeys/types';
|
||||||
|
|
||||||
|
const deleteIngestionKey = async (
|
||||||
|
id: string,
|
||||||
|
): Promise<SuccessResponse<AllIngestionKeyProps> | ErrorResponse> => {
|
||||||
|
try {
|
||||||
|
const response = await GatewayApiV1Instance.delete(
|
||||||
|
`/workspaces/me/keys/${id}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
statusCode: 200,
|
||||||
|
error: null,
|
||||||
|
message: response.data.status,
|
||||||
|
payload: response.data.data,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return ErrorResponseHandler(error as AxiosError);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default deleteIngestionKey;
|
||||||
21
frontend/src/api/IngestionKeys/getAllIngestionKeys.ts
Normal file
21
frontend/src/api/IngestionKeys/getAllIngestionKeys.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { GatewayApiV1Instance } from 'api';
|
||||||
|
import { AxiosResponse } from 'axios';
|
||||||
|
import {
|
||||||
|
AllIngestionKeyProps,
|
||||||
|
GetIngestionKeyProps,
|
||||||
|
} from 'types/api/ingestionKeys/types';
|
||||||
|
|
||||||
|
export const getAllIngestionKeys = (
|
||||||
|
props: GetIngestionKeyProps,
|
||||||
|
): Promise<AxiosResponse<AllIngestionKeyProps>> => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
|
const { search, per_page, page } = props;
|
||||||
|
|
||||||
|
const BASE_URL = '/workspaces/me/keys';
|
||||||
|
const URL_QUERY_PARAMS =
|
||||||
|
search && search.length > 0
|
||||||
|
? `/search?name=${search}&page=1&per_page=100`
|
||||||
|
: `?page=${page}&per_page=${per_page}`;
|
||||||
|
|
||||||
|
return GatewayApiV1Instance.get(`${BASE_URL}${URL_QUERY_PARAMS}`);
|
||||||
|
};
|
||||||
65
frontend/src/api/IngestionKeys/limits/createLimitsForKey.ts
Normal file
65
frontend/src/api/IngestionKeys/limits/createLimitsForKey.ts
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-throw-literal */
|
||||||
|
import { GatewayApiV1Instance } from 'api';
|
||||||
|
import axios from 'axios';
|
||||||
|
import {
|
||||||
|
AddLimitProps,
|
||||||
|
LimitSuccessProps,
|
||||||
|
} from 'types/api/ingestionKeys/limits/types';
|
||||||
|
|
||||||
|
interface SuccessResponse<T> {
|
||||||
|
statusCode: number;
|
||||||
|
error: null;
|
||||||
|
message: string;
|
||||||
|
payload: T;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ErrorResponse {
|
||||||
|
statusCode: number;
|
||||||
|
error: string;
|
||||||
|
message: string;
|
||||||
|
payload: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const createLimitForIngestionKey = async (
|
||||||
|
props: AddLimitProps,
|
||||||
|
): Promise<SuccessResponse<LimitSuccessProps> | ErrorResponse> => {
|
||||||
|
try {
|
||||||
|
const response = await GatewayApiV1Instance.post(
|
||||||
|
`/workspaces/me/keys/${props.keyID}/limits`,
|
||||||
|
{
|
||||||
|
...props,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
statusCode: 200,
|
||||||
|
error: null,
|
||||||
|
message: response.data.status,
|
||||||
|
payload: response.data.data,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
if (axios.isAxiosError(error)) {
|
||||||
|
// Axios error
|
||||||
|
const errResponse: ErrorResponse = {
|
||||||
|
statusCode: error.response?.status || 500,
|
||||||
|
error: error.response?.data?.error,
|
||||||
|
message: error.response?.data?.status || 'An error occurred',
|
||||||
|
payload: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
throw errResponse;
|
||||||
|
} else {
|
||||||
|
// Non-Axios error
|
||||||
|
const errResponse: ErrorResponse = {
|
||||||
|
statusCode: 500,
|
||||||
|
error: 'Unknown error',
|
||||||
|
message: 'An unknown error occurred',
|
||||||
|
payload: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
throw errResponse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default createLimitForIngestionKey;
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { GatewayApiV1Instance } from 'api';
|
||||||
|
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
||||||
|
import { AxiosError } from 'axios';
|
||||||
|
import { ErrorResponse, SuccessResponse } from 'types/api';
|
||||||
|
import { AllIngestionKeyProps } from 'types/api/ingestionKeys/types';
|
||||||
|
|
||||||
|
const deleteLimitsForIngestionKey = async (
|
||||||
|
id: string,
|
||||||
|
): Promise<SuccessResponse<AllIngestionKeyProps> | ErrorResponse> => {
|
||||||
|
try {
|
||||||
|
const response = await GatewayApiV1Instance.delete(
|
||||||
|
`/workspaces/me/limits/${id}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
statusCode: 200,
|
||||||
|
error: null,
|
||||||
|
message: response.data.status,
|
||||||
|
payload: response.data.data,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return ErrorResponseHandler(error as AxiosError);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default deleteLimitsForIngestionKey;
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-throw-literal */
|
||||||
|
import { GatewayApiV1Instance } from 'api';
|
||||||
|
import axios from 'axios';
|
||||||
|
import {
|
||||||
|
LimitSuccessProps,
|
||||||
|
UpdateLimitProps,
|
||||||
|
} from 'types/api/ingestionKeys/limits/types';
|
||||||
|
|
||||||
|
interface SuccessResponse<T> {
|
||||||
|
statusCode: number;
|
||||||
|
error: null;
|
||||||
|
message: string;
|
||||||
|
payload: T;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ErrorResponse {
|
||||||
|
statusCode: number;
|
||||||
|
error: string;
|
||||||
|
message: string;
|
||||||
|
payload: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateLimitForIngestionKey = async (
|
||||||
|
props: UpdateLimitProps,
|
||||||
|
): Promise<SuccessResponse<LimitSuccessProps> | ErrorResponse> => {
|
||||||
|
try {
|
||||||
|
const response = await GatewayApiV1Instance.patch(
|
||||||
|
`/workspaces/me/limits/${props.limitID}`,
|
||||||
|
{
|
||||||
|
config: props.config,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
statusCode: 200,
|
||||||
|
error: null,
|
||||||
|
message: response.data.status,
|
||||||
|
payload: response.data.data,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
if (axios.isAxiosError(error)) {
|
||||||
|
// Axios error
|
||||||
|
const errResponse: ErrorResponse = {
|
||||||
|
statusCode: error.response?.status || 500,
|
||||||
|
error: error.response?.data?.error,
|
||||||
|
message: error.response?.data?.status || 'An error occurred',
|
||||||
|
payload: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
throw errResponse;
|
||||||
|
} else {
|
||||||
|
// Non-Axios error
|
||||||
|
const errResponse: ErrorResponse = {
|
||||||
|
statusCode: 500,
|
||||||
|
error: 'Unknown error',
|
||||||
|
message: 'An unknown error occurred',
|
||||||
|
payload: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
throw errResponse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default updateLimitForIngestionKey;
|
||||||
32
frontend/src/api/IngestionKeys/updateIngestionKey.ts
Normal file
32
frontend/src/api/IngestionKeys/updateIngestionKey.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import { GatewayApiV1Instance } from 'api';
|
||||||
|
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
||||||
|
import { AxiosError } from 'axios';
|
||||||
|
import { ErrorResponse, SuccessResponse } from 'types/api';
|
||||||
|
import {
|
||||||
|
IngestionKeysPayloadProps,
|
||||||
|
UpdateIngestionKeyProps,
|
||||||
|
} from 'types/api/ingestionKeys/types';
|
||||||
|
|
||||||
|
const updateIngestionKey = async (
|
||||||
|
props: UpdateIngestionKeyProps,
|
||||||
|
): Promise<SuccessResponse<IngestionKeysPayloadProps> | ErrorResponse> => {
|
||||||
|
try {
|
||||||
|
const response = await GatewayApiV1Instance.patch(
|
||||||
|
`/workspaces/me/keys/${props.id}`,
|
||||||
|
{
|
||||||
|
...props.data,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
statusCode: 200,
|
||||||
|
error: null,
|
||||||
|
message: response.data.status,
|
||||||
|
payload: response.data.data,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return ErrorResponseHandler(error as AxiosError);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default updateIngestionKey;
|
||||||
@@ -4,6 +4,8 @@ export const apiV2 = '/api/v2/';
|
|||||||
export const apiV3 = '/api/v3/';
|
export const apiV3 = '/api/v3/';
|
||||||
export const apiV4 = '/api/v4/';
|
export const apiV4 = '/api/v4/';
|
||||||
export const apiV5 = '/api/v5/';
|
export const apiV5 = '/api/v5/';
|
||||||
|
export const gatewayApiV1 = '/api/gateway/v1/';
|
||||||
|
export const gatewayApiV2 = '/api/gateway/v2/';
|
||||||
export const apiAlertManager = '/api/alertmanager/';
|
export const apiAlertManager = '/api/alertmanager/';
|
||||||
|
|
||||||
export default apiV1;
|
export default apiV1;
|
||||||
|
|||||||
7
frontend/src/api/customDomain/getDeploymentsData.ts
Normal file
7
frontend/src/api/customDomain/getDeploymentsData.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { GatewayApiV2Instance as axios } from 'api';
|
||||||
|
import { AxiosResponse } from 'axios';
|
||||||
|
import { DeploymentsDataProps } from 'types/api/customDomain/types';
|
||||||
|
|
||||||
|
export const getDeploymentsData = (): Promise<
|
||||||
|
AxiosResponse<DeploymentsDataProps>
|
||||||
|
> => axios.get(`/deployments/me`);
|
||||||
16
frontend/src/api/customDomain/updateSubDomain.ts
Normal file
16
frontend/src/api/customDomain/updateSubDomain.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import { GatewayApiV2Instance as axios } from 'api';
|
||||||
|
import { AxiosError } from 'axios';
|
||||||
|
import { SuccessResponse } from 'types/api';
|
||||||
|
import {
|
||||||
|
PayloadProps,
|
||||||
|
UpdateCustomDomainProps,
|
||||||
|
} from 'types/api/customDomain/types';
|
||||||
|
|
||||||
|
const updateSubDomainAPI = async (
|
||||||
|
props: UpdateCustomDomainProps,
|
||||||
|
): Promise<SuccessResponse<PayloadProps> | AxiosError> =>
|
||||||
|
axios.put(`/deployments/me/host`, {
|
||||||
|
...props.data,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default updateSubDomainAPI;
|
||||||
@@ -11,7 +11,6 @@ import {
|
|||||||
|
|
||||||
const dashboardVariablesQuery = async (
|
const dashboardVariablesQuery = async (
|
||||||
props: Props,
|
props: Props,
|
||||||
signal?: AbortSignal,
|
|
||||||
): Promise<SuccessResponse<VariableResponseProps> | ErrorResponse> => {
|
): Promise<SuccessResponse<VariableResponseProps> | ErrorResponse> => {
|
||||||
try {
|
try {
|
||||||
const { globalTime } = store.getState();
|
const { globalTime } = store.getState();
|
||||||
@@ -33,7 +32,7 @@ const dashboardVariablesQuery = async (
|
|||||||
|
|
||||||
payload.variables = { ...payload.variables, ...timeVariables };
|
payload.variables = { ...payload.variables, ...timeVariables };
|
||||||
|
|
||||||
const response = await axios.post(`/variables/query`, payload, { signal });
|
const response = await axios.post(`/variables/query`, payload);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ export const getFieldValues = async (
|
|||||||
startUnixMilli?: number,
|
startUnixMilli?: number,
|
||||||
endUnixMilli?: number,
|
endUnixMilli?: number,
|
||||||
existingQuery?: string,
|
existingQuery?: string,
|
||||||
abortSignal?: AbortSignal,
|
|
||||||
): Promise<SuccessResponseV2<FieldValueResponse>> => {
|
): Promise<SuccessResponseV2<FieldValueResponse>> => {
|
||||||
const params: Record<string, string> = {};
|
const params: Record<string, string> = {};
|
||||||
|
|
||||||
@@ -48,10 +47,7 @@ export const getFieldValues = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await axios.get('/fields/values', {
|
const response = await axios.get('/fields/values', { params });
|
||||||
params,
|
|
||||||
signal: abortSignal,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Normalize values from different types (stringValues, boolValues, etc.)
|
// Normalize values from different types (stringValues, boolValues, etc.)
|
||||||
if (response.data?.data?.values) {
|
if (response.data?.data?.values) {
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ import type {
|
|||||||
} from 'react-query';
|
} from 'react-query';
|
||||||
import { useMutation, useQuery } from 'react-query';
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
|
|
||||||
import type {
|
import type {
|
||||||
AuthtypesPostableAuthDomainDTO,
|
AuthtypesPostableAuthDomainDTO,
|
||||||
AuthtypesUpdateableAuthDomainDTO,
|
AuthtypesUpdateableAuthDomainDTO,
|
||||||
@@ -46,12 +45,12 @@ export const listAuthDomains = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getListAuthDomainsQueryKey = () => {
|
export const getListAuthDomainsQueryKey = () => {
|
||||||
return [`/api/v1/domains`] as const;
|
return ['listAuthDomains'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getListAuthDomainsQueryOptions = <
|
export const getListAuthDomainsQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof listAuthDomains>>,
|
TData = Awaited<ReturnType<typeof listAuthDomains>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof listAuthDomains>>,
|
Awaited<ReturnType<typeof listAuthDomains>>,
|
||||||
@@ -77,7 +76,7 @@ export const getListAuthDomainsQueryOptions = <
|
|||||||
export type ListAuthDomainsQueryResult = NonNullable<
|
export type ListAuthDomainsQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof listAuthDomains>>
|
Awaited<ReturnType<typeof listAuthDomains>>
|
||||||
>;
|
>;
|
||||||
export type ListAuthDomainsQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type ListAuthDomainsQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary List all auth domains
|
* @summary List all auth domains
|
||||||
@@ -85,7 +84,7 @@ export type ListAuthDomainsQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useListAuthDomains<
|
export function useListAuthDomains<
|
||||||
TData = Awaited<ReturnType<typeof listAuthDomains>>,
|
TData = Awaited<ReturnType<typeof listAuthDomains>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof listAuthDomains>>,
|
Awaited<ReturnType<typeof listAuthDomains>>,
|
||||||
@@ -124,7 +123,7 @@ export const invalidateListAuthDomains = async (
|
|||||||
* @summary Create auth domain
|
* @summary Create auth domain
|
||||||
*/
|
*/
|
||||||
export const createAuthDomain = (
|
export const createAuthDomain = (
|
||||||
authtypesPostableAuthDomainDTO: BodyType<AuthtypesPostableAuthDomainDTO>,
|
authtypesPostableAuthDomainDTO: AuthtypesPostableAuthDomainDTO,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<CreateAuthDomain200>({
|
return GeneratedAPIInstance<CreateAuthDomain200>({
|
||||||
@@ -137,19 +136,19 @@ export const createAuthDomain = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateAuthDomainMutationOptions = <
|
export const getCreateAuthDomainMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createAuthDomain>>,
|
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<AuthtypesPostableAuthDomainDTO> },
|
{ data: AuthtypesPostableAuthDomainDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createAuthDomain>>,
|
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<AuthtypesPostableAuthDomainDTO> },
|
{ data: AuthtypesPostableAuthDomainDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['createAuthDomain'];
|
const mutationKey = ['createAuthDomain'];
|
||||||
@@ -163,7 +162,7 @@ export const getCreateAuthDomainMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof createAuthDomain>>,
|
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||||
{ data: BodyType<AuthtypesPostableAuthDomainDTO> }
|
{ data: AuthtypesPostableAuthDomainDTO }
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
@@ -176,26 +175,26 @@ export const getCreateAuthDomainMutationOptions = <
|
|||||||
export type CreateAuthDomainMutationResult = NonNullable<
|
export type CreateAuthDomainMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof createAuthDomain>>
|
Awaited<ReturnType<typeof createAuthDomain>>
|
||||||
>;
|
>;
|
||||||
export type CreateAuthDomainMutationBody = BodyType<AuthtypesPostableAuthDomainDTO>;
|
export type CreateAuthDomainMutationBody = AuthtypesPostableAuthDomainDTO;
|
||||||
export type CreateAuthDomainMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type CreateAuthDomainMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Create auth domain
|
* @summary Create auth domain
|
||||||
*/
|
*/
|
||||||
export const useCreateAuthDomain = <
|
export const useCreateAuthDomain = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createAuthDomain>>,
|
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<AuthtypesPostableAuthDomainDTO> },
|
{ data: AuthtypesPostableAuthDomainDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof createAuthDomain>>,
|
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<AuthtypesPostableAuthDomainDTO> },
|
{ data: AuthtypesPostableAuthDomainDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getCreateAuthDomainMutationOptions(options);
|
const mutationOptions = getCreateAuthDomainMutationOptions(options);
|
||||||
@@ -214,7 +213,7 @@ export const deleteAuthDomain = ({ id }: DeleteAuthDomainPathParameters) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getDeleteAuthDomainMutationOptions = <
|
export const getDeleteAuthDomainMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -254,13 +253,13 @@ export type DeleteAuthDomainMutationResult = NonNullable<
|
|||||||
Awaited<ReturnType<typeof deleteAuthDomain>>
|
Awaited<ReturnType<typeof deleteAuthDomain>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type DeleteAuthDomainMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type DeleteAuthDomainMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Delete auth domain
|
* @summary Delete auth domain
|
||||||
*/
|
*/
|
||||||
export const useDeleteAuthDomain = <
|
export const useDeleteAuthDomain = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -285,7 +284,7 @@ export const useDeleteAuthDomain = <
|
|||||||
*/
|
*/
|
||||||
export const updateAuthDomain = (
|
export const updateAuthDomain = (
|
||||||
{ id }: UpdateAuthDomainPathParameters,
|
{ id }: UpdateAuthDomainPathParameters,
|
||||||
authtypesUpdateableAuthDomainDTO: BodyType<AuthtypesUpdateableAuthDomainDTO>,
|
authtypesUpdateableAuthDomainDTO: AuthtypesUpdateableAuthDomainDTO,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<void>({
|
return GeneratedAPIInstance<void>({
|
||||||
url: `/api/v1/domains/${id}`,
|
url: `/api/v1/domains/${id}`,
|
||||||
@@ -296,7 +295,7 @@ export const updateAuthDomain = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getUpdateAuthDomainMutationOptions = <
|
export const getUpdateAuthDomainMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -304,7 +303,7 @@ export const getUpdateAuthDomainMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateAuthDomainPathParameters;
|
pathParams: UpdateAuthDomainPathParameters;
|
||||||
data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
|
data: AuthtypesUpdateableAuthDomainDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -313,7 +312,7 @@ export const getUpdateAuthDomainMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateAuthDomainPathParameters;
|
pathParams: UpdateAuthDomainPathParameters;
|
||||||
data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
|
data: AuthtypesUpdateableAuthDomainDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -330,7 +329,7 @@ export const getUpdateAuthDomainMutationOptions = <
|
|||||||
Awaited<ReturnType<typeof updateAuthDomain>>,
|
Awaited<ReturnType<typeof updateAuthDomain>>,
|
||||||
{
|
{
|
||||||
pathParams: UpdateAuthDomainPathParameters;
|
pathParams: UpdateAuthDomainPathParameters;
|
||||||
data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
|
data: AuthtypesUpdateableAuthDomainDTO;
|
||||||
}
|
}
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { pathParams, data } = props ?? {};
|
const { pathParams, data } = props ?? {};
|
||||||
@@ -344,14 +343,14 @@ export const getUpdateAuthDomainMutationOptions = <
|
|||||||
export type UpdateAuthDomainMutationResult = NonNullable<
|
export type UpdateAuthDomainMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof updateAuthDomain>>
|
Awaited<ReturnType<typeof updateAuthDomain>>
|
||||||
>;
|
>;
|
||||||
export type UpdateAuthDomainMutationBody = BodyType<AuthtypesUpdateableAuthDomainDTO>;
|
export type UpdateAuthDomainMutationBody = AuthtypesUpdateableAuthDomainDTO;
|
||||||
export type UpdateAuthDomainMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type UpdateAuthDomainMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Update auth domain
|
* @summary Update auth domain
|
||||||
*/
|
*/
|
||||||
export const useUpdateAuthDomain = <
|
export const useUpdateAuthDomain = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -359,7 +358,7 @@ export const useUpdateAuthDomain = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateAuthDomainPathParameters;
|
pathParams: UpdateAuthDomainPathParameters;
|
||||||
data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
|
data: AuthtypesUpdateableAuthDomainDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -368,7 +367,7 @@ export const useUpdateAuthDomain = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateAuthDomainPathParameters;
|
pathParams: UpdateAuthDomainPathParameters;
|
||||||
data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
|
data: AuthtypesUpdateableAuthDomainDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
|
|||||||
@@ -1,200 +0,0 @@
|
|||||||
/**
|
|
||||||
* ! Do not edit manually
|
|
||||||
* * The file has been auto-generated using Orval for SigNoz
|
|
||||||
* * regenerate with 'yarn generate:api'
|
|
||||||
* SigNoz
|
|
||||||
*/
|
|
||||||
import type {
|
|
||||||
InvalidateOptions,
|
|
||||||
MutationFunction,
|
|
||||||
QueryClient,
|
|
||||||
QueryFunction,
|
|
||||||
QueryKey,
|
|
||||||
UseMutationOptions,
|
|
||||||
UseMutationResult,
|
|
||||||
UseQueryOptions,
|
|
||||||
UseQueryResult,
|
|
||||||
} from 'react-query';
|
|
||||||
import { useMutation, useQuery } from 'react-query';
|
|
||||||
|
|
||||||
import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
|
|
||||||
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
|
|
||||||
import type {
|
|
||||||
AuthtypesTransactionDTO,
|
|
||||||
AuthzCheck200,
|
|
||||||
AuthzResources200,
|
|
||||||
RenderErrorResponseDTO,
|
|
||||||
} from '../sigNoz.schemas';
|
|
||||||
|
|
||||||
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
||||||
|
|
||||||
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the authenticated user has permissions for given transactions
|
|
||||||
* @summary Check permissions
|
|
||||||
*/
|
|
||||||
export const authzCheck = (
|
|
||||||
authtypesTransactionDTO: BodyType<AuthtypesTransactionDTO[]>,
|
|
||||||
signal?: AbortSignal,
|
|
||||||
) => {
|
|
||||||
return GeneratedAPIInstance<AuthzCheck200>({
|
|
||||||
url: `/api/v1/authz/check`,
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
data: authtypesTransactionDTO,
|
|
||||||
signal,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getAuthzCheckMutationOptions = <
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
|
||||||
TContext = unknown
|
|
||||||
>(options?: {
|
|
||||||
mutation?: UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof authzCheck>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<AuthtypesTransactionDTO[]> },
|
|
||||||
TContext
|
|
||||||
>;
|
|
||||||
}): UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof authzCheck>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<AuthtypesTransactionDTO[]> },
|
|
||||||
TContext
|
|
||||||
> => {
|
|
||||||
const mutationKey = ['authzCheck'];
|
|
||||||
const { mutation: mutationOptions } = options
|
|
||||||
? options.mutation &&
|
|
||||||
'mutationKey' in options.mutation &&
|
|
||||||
options.mutation.mutationKey
|
|
||||||
? options
|
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
||||||
: { mutation: { mutationKey } };
|
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
|
||||||
Awaited<ReturnType<typeof authzCheck>>,
|
|
||||||
{ data: BodyType<AuthtypesTransactionDTO[]> }
|
|
||||||
> = (props) => {
|
|
||||||
const { data } = props ?? {};
|
|
||||||
|
|
||||||
return authzCheck(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type AuthzCheckMutationResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof authzCheck>>
|
|
||||||
>;
|
|
||||||
export type AuthzCheckMutationBody = BodyType<AuthtypesTransactionDTO[]>;
|
|
||||||
export type AuthzCheckMutationError = ErrorType<RenderErrorResponseDTO>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @summary Check permissions
|
|
||||||
*/
|
|
||||||
export const useAuthzCheck = <
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
|
||||||
TContext = unknown
|
|
||||||
>(options?: {
|
|
||||||
mutation?: UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof authzCheck>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<AuthtypesTransactionDTO[]> },
|
|
||||||
TContext
|
|
||||||
>;
|
|
||||||
}): UseMutationResult<
|
|
||||||
Awaited<ReturnType<typeof authzCheck>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<AuthtypesTransactionDTO[]> },
|
|
||||||
TContext
|
|
||||||
> => {
|
|
||||||
const mutationOptions = getAuthzCheckMutationOptions(options);
|
|
||||||
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
@@ -17,8 +17,7 @@ import type {
|
|||||||
} from 'react-query';
|
} from 'react-query';
|
||||||
import { useMutation, useQuery } from 'react-query';
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
|
|
||||||
import type {
|
import type {
|
||||||
CreatePublicDashboard201,
|
CreatePublicDashboard201,
|
||||||
CreatePublicDashboardPathParameters,
|
CreatePublicDashboardPathParameters,
|
||||||
@@ -53,7 +52,7 @@ export const deletePublicDashboard = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getDeletePublicDashboardMutationOptions = <
|
export const getDeletePublicDashboardMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -93,13 +92,13 @@ export type DeletePublicDashboardMutationResult = NonNullable<
|
|||||||
Awaited<ReturnType<typeof deletePublicDashboard>>
|
Awaited<ReturnType<typeof deletePublicDashboard>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type DeletePublicDashboardMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type DeletePublicDashboardMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Delete public dashboard
|
* @summary Delete public dashboard
|
||||||
*/
|
*/
|
||||||
export const useDeletePublicDashboard = <
|
export const useDeletePublicDashboard = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -136,12 +135,12 @@ export const getPublicDashboard = (
|
|||||||
export const getGetPublicDashboardQueryKey = ({
|
export const getGetPublicDashboardQueryKey = ({
|
||||||
id,
|
id,
|
||||||
}: GetPublicDashboardPathParameters) => {
|
}: GetPublicDashboardPathParameters) => {
|
||||||
return [`/api/v1/dashboards/${id}/public`] as const;
|
return ['getPublicDashboard'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetPublicDashboardQueryOptions = <
|
export const getGetPublicDashboardQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getPublicDashboard>>,
|
TData = Awaited<ReturnType<typeof getPublicDashboard>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ id }: GetPublicDashboardPathParameters,
|
{ id }: GetPublicDashboardPathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -176,7 +175,7 @@ export const getGetPublicDashboardQueryOptions = <
|
|||||||
export type GetPublicDashboardQueryResult = NonNullable<
|
export type GetPublicDashboardQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getPublicDashboard>>
|
Awaited<ReturnType<typeof getPublicDashboard>>
|
||||||
>;
|
>;
|
||||||
export type GetPublicDashboardQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetPublicDashboardQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get public dashboard
|
* @summary Get public dashboard
|
||||||
@@ -184,7 +183,7 @@ export type GetPublicDashboardQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetPublicDashboard<
|
export function useGetPublicDashboard<
|
||||||
TData = Awaited<ReturnType<typeof getPublicDashboard>>,
|
TData = Awaited<ReturnType<typeof getPublicDashboard>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ id }: GetPublicDashboardPathParameters,
|
{ id }: GetPublicDashboardPathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -228,7 +227,7 @@ export const invalidateGetPublicDashboard = async (
|
|||||||
*/
|
*/
|
||||||
export const createPublicDashboard = (
|
export const createPublicDashboard = (
|
||||||
{ id }: CreatePublicDashboardPathParameters,
|
{ id }: CreatePublicDashboardPathParameters,
|
||||||
dashboardtypesPostablePublicDashboardDTO: BodyType<DashboardtypesPostablePublicDashboardDTO>,
|
dashboardtypesPostablePublicDashboardDTO: DashboardtypesPostablePublicDashboardDTO,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<CreatePublicDashboard201>({
|
return GeneratedAPIInstance<CreatePublicDashboard201>({
|
||||||
@@ -241,7 +240,7 @@ export const createPublicDashboard = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCreatePublicDashboardMutationOptions = <
|
export const getCreatePublicDashboardMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -249,7 +248,7 @@ export const getCreatePublicDashboardMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: CreatePublicDashboardPathParameters;
|
pathParams: CreatePublicDashboardPathParameters;
|
||||||
data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
data: DashboardtypesPostablePublicDashboardDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -258,7 +257,7 @@ export const getCreatePublicDashboardMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: CreatePublicDashboardPathParameters;
|
pathParams: CreatePublicDashboardPathParameters;
|
||||||
data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
data: DashboardtypesPostablePublicDashboardDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -275,7 +274,7 @@ export const getCreatePublicDashboardMutationOptions = <
|
|||||||
Awaited<ReturnType<typeof createPublicDashboard>>,
|
Awaited<ReturnType<typeof createPublicDashboard>>,
|
||||||
{
|
{
|
||||||
pathParams: CreatePublicDashboardPathParameters;
|
pathParams: CreatePublicDashboardPathParameters;
|
||||||
data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
data: DashboardtypesPostablePublicDashboardDTO;
|
||||||
}
|
}
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { pathParams, data } = props ?? {};
|
const { pathParams, data } = props ?? {};
|
||||||
@@ -289,14 +288,14 @@ export const getCreatePublicDashboardMutationOptions = <
|
|||||||
export type CreatePublicDashboardMutationResult = NonNullable<
|
export type CreatePublicDashboardMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof createPublicDashboard>>
|
Awaited<ReturnType<typeof createPublicDashboard>>
|
||||||
>;
|
>;
|
||||||
export type CreatePublicDashboardMutationBody = BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
export type CreatePublicDashboardMutationBody = DashboardtypesPostablePublicDashboardDTO;
|
||||||
export type CreatePublicDashboardMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type CreatePublicDashboardMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Create public dashboard
|
* @summary Create public dashboard
|
||||||
*/
|
*/
|
||||||
export const useCreatePublicDashboard = <
|
export const useCreatePublicDashboard = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -304,7 +303,7 @@ export const useCreatePublicDashboard = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: CreatePublicDashboardPathParameters;
|
pathParams: CreatePublicDashboardPathParameters;
|
||||||
data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
data: DashboardtypesPostablePublicDashboardDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -313,7 +312,7 @@ export const useCreatePublicDashboard = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: CreatePublicDashboardPathParameters;
|
pathParams: CreatePublicDashboardPathParameters;
|
||||||
data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
data: DashboardtypesPostablePublicDashboardDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -327,7 +326,7 @@ export const useCreatePublicDashboard = <
|
|||||||
*/
|
*/
|
||||||
export const updatePublicDashboard = (
|
export const updatePublicDashboard = (
|
||||||
{ id }: UpdatePublicDashboardPathParameters,
|
{ id }: UpdatePublicDashboardPathParameters,
|
||||||
dashboardtypesUpdatablePublicDashboardDTO: BodyType<DashboardtypesUpdatablePublicDashboardDTO>,
|
dashboardtypesUpdatablePublicDashboardDTO: DashboardtypesUpdatablePublicDashboardDTO,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<string>({
|
return GeneratedAPIInstance<string>({
|
||||||
url: `/api/v1/dashboards/${id}/public`,
|
url: `/api/v1/dashboards/${id}/public`,
|
||||||
@@ -338,7 +337,7 @@ export const updatePublicDashboard = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getUpdatePublicDashboardMutationOptions = <
|
export const getUpdatePublicDashboardMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -346,7 +345,7 @@ export const getUpdatePublicDashboardMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdatePublicDashboardPathParameters;
|
pathParams: UpdatePublicDashboardPathParameters;
|
||||||
data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
data: DashboardtypesUpdatablePublicDashboardDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -355,7 +354,7 @@ export const getUpdatePublicDashboardMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdatePublicDashboardPathParameters;
|
pathParams: UpdatePublicDashboardPathParameters;
|
||||||
data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
data: DashboardtypesUpdatablePublicDashboardDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -372,7 +371,7 @@ export const getUpdatePublicDashboardMutationOptions = <
|
|||||||
Awaited<ReturnType<typeof updatePublicDashboard>>,
|
Awaited<ReturnType<typeof updatePublicDashboard>>,
|
||||||
{
|
{
|
||||||
pathParams: UpdatePublicDashboardPathParameters;
|
pathParams: UpdatePublicDashboardPathParameters;
|
||||||
data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
data: DashboardtypesUpdatablePublicDashboardDTO;
|
||||||
}
|
}
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { pathParams, data } = props ?? {};
|
const { pathParams, data } = props ?? {};
|
||||||
@@ -386,14 +385,14 @@ export const getUpdatePublicDashboardMutationOptions = <
|
|||||||
export type UpdatePublicDashboardMutationResult = NonNullable<
|
export type UpdatePublicDashboardMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof updatePublicDashboard>>
|
Awaited<ReturnType<typeof updatePublicDashboard>>
|
||||||
>;
|
>;
|
||||||
export type UpdatePublicDashboardMutationBody = BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
export type UpdatePublicDashboardMutationBody = DashboardtypesUpdatablePublicDashboardDTO;
|
||||||
export type UpdatePublicDashboardMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type UpdatePublicDashboardMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Update public dashboard
|
* @summary Update public dashboard
|
||||||
*/
|
*/
|
||||||
export const useUpdatePublicDashboard = <
|
export const useUpdatePublicDashboard = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -401,7 +400,7 @@ export const useUpdatePublicDashboard = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdatePublicDashboardPathParameters;
|
pathParams: UpdatePublicDashboardPathParameters;
|
||||||
data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
data: DashboardtypesUpdatablePublicDashboardDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -410,7 +409,7 @@ export const useUpdatePublicDashboard = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdatePublicDashboardPathParameters;
|
pathParams: UpdatePublicDashboardPathParameters;
|
||||||
data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
data: DashboardtypesUpdatablePublicDashboardDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -436,12 +435,12 @@ export const getPublicDashboardData = (
|
|||||||
export const getGetPublicDashboardDataQueryKey = ({
|
export const getGetPublicDashboardDataQueryKey = ({
|
||||||
id,
|
id,
|
||||||
}: GetPublicDashboardDataPathParameters) => {
|
}: GetPublicDashboardDataPathParameters) => {
|
||||||
return [`/api/v1/public/dashboards/${id}`] as const;
|
return ['getPublicDashboardData'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetPublicDashboardDataQueryOptions = <
|
export const getGetPublicDashboardDataQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getPublicDashboardData>>,
|
TData = Awaited<ReturnType<typeof getPublicDashboardData>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ id }: GetPublicDashboardDataPathParameters,
|
{ id }: GetPublicDashboardDataPathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -476,7 +475,7 @@ export const getGetPublicDashboardDataQueryOptions = <
|
|||||||
export type GetPublicDashboardDataQueryResult = NonNullable<
|
export type GetPublicDashboardDataQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getPublicDashboardData>>
|
Awaited<ReturnType<typeof getPublicDashboardData>>
|
||||||
>;
|
>;
|
||||||
export type GetPublicDashboardDataQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetPublicDashboardDataQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get public dashboard data
|
* @summary Get public dashboard data
|
||||||
@@ -484,7 +483,7 @@ export type GetPublicDashboardDataQueryError = ErrorType<RenderErrorResponseDTO>
|
|||||||
|
|
||||||
export function useGetPublicDashboardData<
|
export function useGetPublicDashboardData<
|
||||||
TData = Awaited<ReturnType<typeof getPublicDashboardData>>,
|
TData = Awaited<ReturnType<typeof getPublicDashboardData>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ id }: GetPublicDashboardDataPathParameters,
|
{ id }: GetPublicDashboardDataPathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -541,12 +540,12 @@ export const getGetPublicDashboardWidgetQueryRangeQueryKey = ({
|
|||||||
id,
|
id,
|
||||||
idx,
|
idx,
|
||||||
}: GetPublicDashboardWidgetQueryRangePathParameters) => {
|
}: GetPublicDashboardWidgetQueryRangePathParameters) => {
|
||||||
return [`/api/v1/public/dashboards/${id}/widgets/${idx}/query_range`] as const;
|
return ['getPublicDashboardWidgetQueryRange'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetPublicDashboardWidgetQueryRangeQueryOptions = <
|
export const getGetPublicDashboardWidgetQueryRangeQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>,
|
TData = Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ id, idx }: GetPublicDashboardWidgetQueryRangePathParameters,
|
{ id, idx }: GetPublicDashboardWidgetQueryRangePathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -582,7 +581,7 @@ export const getGetPublicDashboardWidgetQueryRangeQueryOptions = <
|
|||||||
export type GetPublicDashboardWidgetQueryRangeQueryResult = NonNullable<
|
export type GetPublicDashboardWidgetQueryRangeQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>
|
Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>
|
||||||
>;
|
>;
|
||||||
export type GetPublicDashboardWidgetQueryRangeQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetPublicDashboardWidgetQueryRangeQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get query range result
|
* @summary Get query range result
|
||||||
@@ -590,7 +589,7 @@ export type GetPublicDashboardWidgetQueryRangeQueryError = ErrorType<RenderError
|
|||||||
|
|
||||||
export function useGetPublicDashboardWidgetQueryRange<
|
export function useGetPublicDashboardWidgetQueryRange<
|
||||||
TData = Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>,
|
TData = Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ id, idx }: GetPublicDashboardWidgetQueryRangePathParameters,
|
{ id, idx }: GetPublicDashboardWidgetQueryRangePathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ import type {
|
|||||||
} from 'react-query';
|
} from 'react-query';
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery } from 'react-query';
|
||||||
|
|
||||||
import type { ErrorType } from '../../../generatedAPIInstance';
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
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;
|
||||||
@@ -35,12 +34,12 @@ export const getFeatures = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getGetFeaturesQueryKey = () => {
|
export const getGetFeaturesQueryKey = () => {
|
||||||
return [`/api/v2/features`] as const;
|
return ['getFeatures'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetFeaturesQueryOptions = <
|
export const getGetFeaturesQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getFeatures>>,
|
TData = Awaited<ReturnType<typeof getFeatures>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof getFeatures>>,
|
Awaited<ReturnType<typeof getFeatures>>,
|
||||||
@@ -66,7 +65,7 @@ export const getGetFeaturesQueryOptions = <
|
|||||||
export type GetFeaturesQueryResult = NonNullable<
|
export type GetFeaturesQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getFeatures>>
|
Awaited<ReturnType<typeof getFeatures>>
|
||||||
>;
|
>;
|
||||||
export type GetFeaturesQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetFeaturesQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get features
|
* @summary Get features
|
||||||
@@ -74,7 +73,7 @@ export type GetFeaturesQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetFeatures<
|
export function useGetFeatures<
|
||||||
TData = Awaited<ReturnType<typeof getFeatures>>,
|
TData = Awaited<ReturnType<typeof getFeatures>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof getFeatures>>,
|
Awaited<ReturnType<typeof getFeatures>>,
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ import type {
|
|||||||
} from 'react-query';
|
} from 'react-query';
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery } from 'react-query';
|
||||||
|
|
||||||
import type { ErrorType } from '../../../generatedAPIInstance';
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
|
|
||||||
import type {
|
import type {
|
||||||
GetFieldsKeys200,
|
GetFieldsKeys200,
|
||||||
GetFieldsKeysParams,
|
GetFieldsKeysParams,
|
||||||
@@ -45,12 +44,12 @@ export const getFieldsKeys = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getGetFieldsKeysQueryKey = (params?: GetFieldsKeysParams) => {
|
export const getGetFieldsKeysQueryKey = (params?: GetFieldsKeysParams) => {
|
||||||
return [`/api/v1/fields/keys`, ...(params ? [params] : [])] as const;
|
return ['getFieldsKeys', ...(params ? [params] : [])] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetFieldsKeysQueryOptions = <
|
export const getGetFieldsKeysQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getFieldsKeys>>,
|
TData = Awaited<ReturnType<typeof getFieldsKeys>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
params?: GetFieldsKeysParams,
|
params?: GetFieldsKeysParams,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -79,7 +78,7 @@ export const getGetFieldsKeysQueryOptions = <
|
|||||||
export type GetFieldsKeysQueryResult = NonNullable<
|
export type GetFieldsKeysQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getFieldsKeys>>
|
Awaited<ReturnType<typeof getFieldsKeys>>
|
||||||
>;
|
>;
|
||||||
export type GetFieldsKeysQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetFieldsKeysQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get field keys
|
* @summary Get field keys
|
||||||
@@ -87,7 +86,7 @@ export type GetFieldsKeysQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetFieldsKeys<
|
export function useGetFieldsKeys<
|
||||||
TData = Awaited<ReturnType<typeof getFieldsKeys>>,
|
TData = Awaited<ReturnType<typeof getFieldsKeys>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
params?: GetFieldsKeysParams,
|
params?: GetFieldsKeysParams,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -142,12 +141,12 @@ export const getFieldsValues = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getGetFieldsValuesQueryKey = (params?: GetFieldsValuesParams) => {
|
export const getGetFieldsValuesQueryKey = (params?: GetFieldsValuesParams) => {
|
||||||
return [`/api/v1/fields/values`, ...(params ? [params] : [])] as const;
|
return ['getFieldsValues', ...(params ? [params] : [])] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetFieldsValuesQueryOptions = <
|
export const getGetFieldsValuesQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getFieldsValues>>,
|
TData = Awaited<ReturnType<typeof getFieldsValues>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
params?: GetFieldsValuesParams,
|
params?: GetFieldsValuesParams,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -176,7 +175,7 @@ export const getGetFieldsValuesQueryOptions = <
|
|||||||
export type GetFieldsValuesQueryResult = NonNullable<
|
export type GetFieldsValuesQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getFieldsValues>>
|
Awaited<ReturnType<typeof getFieldsValues>>
|
||||||
>;
|
>;
|
||||||
export type GetFieldsValuesQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetFieldsValuesQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get field values
|
* @summary Get field values
|
||||||
@@ -184,7 +183,7 @@ export type GetFieldsValuesQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetFieldsValues<
|
export function useGetFieldsValues<
|
||||||
TData = Awaited<ReturnType<typeof getFieldsValues>>,
|
TData = Awaited<ReturnType<typeof getFieldsValues>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
params?: GetFieldsValuesParams,
|
params?: GetFieldsValuesParams,
|
||||||
options?: {
|
options?: {
|
||||||
|
|||||||
@@ -17,10 +17,9 @@ import type {
|
|||||||
} from 'react-query';
|
} from 'react-query';
|
||||||
import { useMutation, useQuery } from 'react-query';
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
|
|
||||||
import type {
|
import type {
|
||||||
CreateIngestionKey201,
|
CreateIngestionKey200,
|
||||||
CreateIngestionKeyLimit201,
|
CreateIngestionKeyLimit201,
|
||||||
CreateIngestionKeyLimitPathParameters,
|
CreateIngestionKeyLimitPathParameters,
|
||||||
DeleteIngestionKeyLimitPathParameters,
|
DeleteIngestionKeyLimitPathParameters,
|
||||||
@@ -60,15 +59,12 @@ export const getIngestionKeys = (
|
|||||||
export const getGetIngestionKeysQueryKey = (
|
export const getGetIngestionKeysQueryKey = (
|
||||||
params?: GetIngestionKeysParams,
|
params?: GetIngestionKeysParams,
|
||||||
) => {
|
) => {
|
||||||
return [
|
return ['getIngestionKeys', ...(params ? [params] : [])] as const;
|
||||||
`/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 = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
params?: GetIngestionKeysParams,
|
params?: GetIngestionKeysParams,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -97,7 +93,7 @@ export const getGetIngestionKeysQueryOptions = <
|
|||||||
export type GetIngestionKeysQueryResult = NonNullable<
|
export type GetIngestionKeysQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getIngestionKeys>>
|
Awaited<ReturnType<typeof getIngestionKeys>>
|
||||||
>;
|
>;
|
||||||
export type GetIngestionKeysQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetIngestionKeysQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get ingestion keys for workspace
|
* @summary Get ingestion keys for workspace
|
||||||
@@ -105,7 +101,7 @@ export type GetIngestionKeysQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetIngestionKeys<
|
export function useGetIngestionKeys<
|
||||||
TData = Awaited<ReturnType<typeof getIngestionKeys>>,
|
TData = Awaited<ReturnType<typeof getIngestionKeys>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
params?: GetIngestionKeysParams,
|
params?: GetIngestionKeysParams,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -148,10 +144,10 @@ export const invalidateGetIngestionKeys = async (
|
|||||||
* @summary Create ingestion key for workspace
|
* @summary Create ingestion key for workspace
|
||||||
*/
|
*/
|
||||||
export const createIngestionKey = (
|
export const createIngestionKey = (
|
||||||
gatewaytypesPostableIngestionKeyDTO: BodyType<GatewaytypesPostableIngestionKeyDTO>,
|
gatewaytypesPostableIngestionKeyDTO: GatewaytypesPostableIngestionKeyDTO,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<CreateIngestionKey201>({
|
return GeneratedAPIInstance<CreateIngestionKey200>({
|
||||||
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' },
|
||||||
@@ -161,19 +157,19 @@ export const createIngestionKey = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateIngestionKeyMutationOptions = <
|
export const getCreateIngestionKeyMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createIngestionKey>>,
|
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<GatewaytypesPostableIngestionKeyDTO> },
|
{ data: GatewaytypesPostableIngestionKeyDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createIngestionKey>>,
|
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<GatewaytypesPostableIngestionKeyDTO> },
|
{ data: GatewaytypesPostableIngestionKeyDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['createIngestionKey'];
|
const mutationKey = ['createIngestionKey'];
|
||||||
@@ -187,7 +183,7 @@ export const getCreateIngestionKeyMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof createIngestionKey>>,
|
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||||
{ data: BodyType<GatewaytypesPostableIngestionKeyDTO> }
|
{ data: GatewaytypesPostableIngestionKeyDTO }
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
@@ -200,26 +196,26 @@ export const getCreateIngestionKeyMutationOptions = <
|
|||||||
export type CreateIngestionKeyMutationResult = NonNullable<
|
export type CreateIngestionKeyMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof createIngestionKey>>
|
Awaited<ReturnType<typeof createIngestionKey>>
|
||||||
>;
|
>;
|
||||||
export type CreateIngestionKeyMutationBody = BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
export type CreateIngestionKeyMutationBody = GatewaytypesPostableIngestionKeyDTO;
|
||||||
export type CreateIngestionKeyMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type CreateIngestionKeyMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Create ingestion key for workspace
|
* @summary Create ingestion key for workspace
|
||||||
*/
|
*/
|
||||||
export const useCreateIngestionKey = <
|
export const useCreateIngestionKey = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createIngestionKey>>,
|
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<GatewaytypesPostableIngestionKeyDTO> },
|
{ data: GatewaytypesPostableIngestionKeyDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof createIngestionKey>>,
|
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<GatewaytypesPostableIngestionKeyDTO> },
|
{ data: GatewaytypesPostableIngestionKeyDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getCreateIngestionKeyMutationOptions(options);
|
const mutationOptions = getCreateIngestionKeyMutationOptions(options);
|
||||||
@@ -240,7 +236,7 @@ export const deleteIngestionKey = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getDeleteIngestionKeyMutationOptions = <
|
export const getDeleteIngestionKeyMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -280,13 +276,13 @@ export type DeleteIngestionKeyMutationResult = NonNullable<
|
|||||||
Awaited<ReturnType<typeof deleteIngestionKey>>
|
Awaited<ReturnType<typeof deleteIngestionKey>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type DeleteIngestionKeyMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type DeleteIngestionKeyMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Delete ingestion key for workspace
|
* @summary Delete ingestion key for workspace
|
||||||
*/
|
*/
|
||||||
export const useDeleteIngestionKey = <
|
export const useDeleteIngestionKey = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -311,7 +307,7 @@ export const useDeleteIngestionKey = <
|
|||||||
*/
|
*/
|
||||||
export const updateIngestionKey = (
|
export const updateIngestionKey = (
|
||||||
{ keyId }: UpdateIngestionKeyPathParameters,
|
{ keyId }: UpdateIngestionKeyPathParameters,
|
||||||
gatewaytypesPostableIngestionKeyDTO: BodyType<GatewaytypesPostableIngestionKeyDTO>,
|
gatewaytypesPostableIngestionKeyDTO: GatewaytypesPostableIngestionKeyDTO,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<void>({
|
return GeneratedAPIInstance<void>({
|
||||||
url: `/api/v2/gateway/ingestion_keys/${keyId}`,
|
url: `/api/v2/gateway/ingestion_keys/${keyId}`,
|
||||||
@@ -322,7 +318,7 @@ export const updateIngestionKey = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getUpdateIngestionKeyMutationOptions = <
|
export const getUpdateIngestionKeyMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -330,7 +326,7 @@ export const getUpdateIngestionKeyMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateIngestionKeyPathParameters;
|
pathParams: UpdateIngestionKeyPathParameters;
|
||||||
data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
data: GatewaytypesPostableIngestionKeyDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -339,7 +335,7 @@ export const getUpdateIngestionKeyMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateIngestionKeyPathParameters;
|
pathParams: UpdateIngestionKeyPathParameters;
|
||||||
data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
data: GatewaytypesPostableIngestionKeyDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -356,7 +352,7 @@ export const getUpdateIngestionKeyMutationOptions = <
|
|||||||
Awaited<ReturnType<typeof updateIngestionKey>>,
|
Awaited<ReturnType<typeof updateIngestionKey>>,
|
||||||
{
|
{
|
||||||
pathParams: UpdateIngestionKeyPathParameters;
|
pathParams: UpdateIngestionKeyPathParameters;
|
||||||
data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
data: GatewaytypesPostableIngestionKeyDTO;
|
||||||
}
|
}
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { pathParams, data } = props ?? {};
|
const { pathParams, data } = props ?? {};
|
||||||
@@ -370,14 +366,14 @@ export const getUpdateIngestionKeyMutationOptions = <
|
|||||||
export type UpdateIngestionKeyMutationResult = NonNullable<
|
export type UpdateIngestionKeyMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof updateIngestionKey>>
|
Awaited<ReturnType<typeof updateIngestionKey>>
|
||||||
>;
|
>;
|
||||||
export type UpdateIngestionKeyMutationBody = BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
export type UpdateIngestionKeyMutationBody = GatewaytypesPostableIngestionKeyDTO;
|
||||||
export type UpdateIngestionKeyMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type UpdateIngestionKeyMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Update ingestion key for workspace
|
* @summary Update ingestion key for workspace
|
||||||
*/
|
*/
|
||||||
export const useUpdateIngestionKey = <
|
export const useUpdateIngestionKey = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -385,7 +381,7 @@ export const useUpdateIngestionKey = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateIngestionKeyPathParameters;
|
pathParams: UpdateIngestionKeyPathParameters;
|
||||||
data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
data: GatewaytypesPostableIngestionKeyDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -394,7 +390,7 @@ export const useUpdateIngestionKey = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateIngestionKeyPathParameters;
|
pathParams: UpdateIngestionKeyPathParameters;
|
||||||
data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
data: GatewaytypesPostableIngestionKeyDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -408,7 +404,7 @@ export const useUpdateIngestionKey = <
|
|||||||
*/
|
*/
|
||||||
export const createIngestionKeyLimit = (
|
export const createIngestionKeyLimit = (
|
||||||
{ keyId }: CreateIngestionKeyLimitPathParameters,
|
{ keyId }: CreateIngestionKeyLimitPathParameters,
|
||||||
gatewaytypesPostableIngestionKeyLimitDTO: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>,
|
gatewaytypesPostableIngestionKeyLimitDTO: GatewaytypesPostableIngestionKeyLimitDTO,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<CreateIngestionKeyLimit201>({
|
return GeneratedAPIInstance<CreateIngestionKeyLimit201>({
|
||||||
@@ -421,7 +417,7 @@ export const createIngestionKeyLimit = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateIngestionKeyLimitMutationOptions = <
|
export const getCreateIngestionKeyLimitMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -429,7 +425,7 @@ export const getCreateIngestionKeyLimitMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: CreateIngestionKeyLimitPathParameters;
|
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||||
data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
data: GatewaytypesPostableIngestionKeyLimitDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -438,7 +434,7 @@ export const getCreateIngestionKeyLimitMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: CreateIngestionKeyLimitPathParameters;
|
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||||
data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
data: GatewaytypesPostableIngestionKeyLimitDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -455,7 +451,7 @@ export const getCreateIngestionKeyLimitMutationOptions = <
|
|||||||
Awaited<ReturnType<typeof createIngestionKeyLimit>>,
|
Awaited<ReturnType<typeof createIngestionKeyLimit>>,
|
||||||
{
|
{
|
||||||
pathParams: CreateIngestionKeyLimitPathParameters;
|
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||||
data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
data: GatewaytypesPostableIngestionKeyLimitDTO;
|
||||||
}
|
}
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { pathParams, data } = props ?? {};
|
const { pathParams, data } = props ?? {};
|
||||||
@@ -469,14 +465,14 @@ export const getCreateIngestionKeyLimitMutationOptions = <
|
|||||||
export type CreateIngestionKeyLimitMutationResult = NonNullable<
|
export type CreateIngestionKeyLimitMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof createIngestionKeyLimit>>
|
Awaited<ReturnType<typeof createIngestionKeyLimit>>
|
||||||
>;
|
>;
|
||||||
export type CreateIngestionKeyLimitMutationBody = BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
export type CreateIngestionKeyLimitMutationBody = GatewaytypesPostableIngestionKeyLimitDTO;
|
||||||
export type CreateIngestionKeyLimitMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type CreateIngestionKeyLimitMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Create limit for the ingestion key
|
* @summary Create limit for the ingestion key
|
||||||
*/
|
*/
|
||||||
export const useCreateIngestionKeyLimit = <
|
export const useCreateIngestionKeyLimit = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -484,7 +480,7 @@ export const useCreateIngestionKeyLimit = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: CreateIngestionKeyLimitPathParameters;
|
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||||
data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
data: GatewaytypesPostableIngestionKeyLimitDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -493,7 +489,7 @@ export const useCreateIngestionKeyLimit = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: CreateIngestionKeyLimitPathParameters;
|
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||||
data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
data: GatewaytypesPostableIngestionKeyLimitDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -515,7 +511,7 @@ export const deleteIngestionKeyLimit = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getDeleteIngestionKeyLimitMutationOptions = <
|
export const getDeleteIngestionKeyLimitMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -555,13 +551,13 @@ export type DeleteIngestionKeyLimitMutationResult = NonNullable<
|
|||||||
Awaited<ReturnType<typeof deleteIngestionKeyLimit>>
|
Awaited<ReturnType<typeof deleteIngestionKeyLimit>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type DeleteIngestionKeyLimitMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type DeleteIngestionKeyLimitMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Delete limit for the ingestion key
|
* @summary Delete limit for the ingestion key
|
||||||
*/
|
*/
|
||||||
export const useDeleteIngestionKeyLimit = <
|
export const useDeleteIngestionKeyLimit = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -586,7 +582,7 @@ export const useDeleteIngestionKeyLimit = <
|
|||||||
*/
|
*/
|
||||||
export const updateIngestionKeyLimit = (
|
export const updateIngestionKeyLimit = (
|
||||||
{ limitId }: UpdateIngestionKeyLimitPathParameters,
|
{ limitId }: UpdateIngestionKeyLimitPathParameters,
|
||||||
gatewaytypesUpdatableIngestionKeyLimitDTO: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>,
|
gatewaytypesUpdatableIngestionKeyLimitDTO: GatewaytypesUpdatableIngestionKeyLimitDTO,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<void>({
|
return GeneratedAPIInstance<void>({
|
||||||
url: `/api/v2/gateway/ingestion_keys/limits/${limitId}`,
|
url: `/api/v2/gateway/ingestion_keys/limits/${limitId}`,
|
||||||
@@ -597,7 +593,7 @@ export const updateIngestionKeyLimit = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getUpdateIngestionKeyLimitMutationOptions = <
|
export const getUpdateIngestionKeyLimitMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -605,7 +601,7 @@ export const getUpdateIngestionKeyLimitMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateIngestionKeyLimitPathParameters;
|
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||||
data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
data: GatewaytypesUpdatableIngestionKeyLimitDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -614,7 +610,7 @@ export const getUpdateIngestionKeyLimitMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateIngestionKeyLimitPathParameters;
|
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||||
data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
data: GatewaytypesUpdatableIngestionKeyLimitDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -631,7 +627,7 @@ export const getUpdateIngestionKeyLimitMutationOptions = <
|
|||||||
Awaited<ReturnType<typeof updateIngestionKeyLimit>>,
|
Awaited<ReturnType<typeof updateIngestionKeyLimit>>,
|
||||||
{
|
{
|
||||||
pathParams: UpdateIngestionKeyLimitPathParameters;
|
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||||
data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
data: GatewaytypesUpdatableIngestionKeyLimitDTO;
|
||||||
}
|
}
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { pathParams, data } = props ?? {};
|
const { pathParams, data } = props ?? {};
|
||||||
@@ -645,14 +641,14 @@ export const getUpdateIngestionKeyLimitMutationOptions = <
|
|||||||
export type UpdateIngestionKeyLimitMutationResult = NonNullable<
|
export type UpdateIngestionKeyLimitMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof updateIngestionKeyLimit>>
|
Awaited<ReturnType<typeof updateIngestionKeyLimit>>
|
||||||
>;
|
>;
|
||||||
export type UpdateIngestionKeyLimitMutationBody = BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
export type UpdateIngestionKeyLimitMutationBody = GatewaytypesUpdatableIngestionKeyLimitDTO;
|
||||||
export type UpdateIngestionKeyLimitMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type UpdateIngestionKeyLimitMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Update limit for the ingestion key
|
* @summary Update limit for the ingestion key
|
||||||
*/
|
*/
|
||||||
export const useUpdateIngestionKeyLimit = <
|
export const useUpdateIngestionKeyLimit = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -660,7 +656,7 @@ export const useUpdateIngestionKeyLimit = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateIngestionKeyLimitPathParameters;
|
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||||
data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
data: GatewaytypesUpdatableIngestionKeyLimitDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -669,7 +665,7 @@ export const useUpdateIngestionKeyLimit = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateIngestionKeyLimitPathParameters;
|
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||||
data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
data: GatewaytypesUpdatableIngestionKeyLimitDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -682,7 +678,7 @@ export const useUpdateIngestionKeyLimit = <
|
|||||||
* @summary Search ingestion keys for workspace
|
* @summary Search ingestion keys for workspace
|
||||||
*/
|
*/
|
||||||
export const searchIngestionKeys = (
|
export const searchIngestionKeys = (
|
||||||
params: SearchIngestionKeysParams,
|
params?: SearchIngestionKeysParams,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<SearchIngestionKeys200>({
|
return GeneratedAPIInstance<SearchIngestionKeys200>({
|
||||||
@@ -696,17 +692,14 @@ export const searchIngestionKeys = (
|
|||||||
export const getSearchIngestionKeysQueryKey = (
|
export const getSearchIngestionKeysQueryKey = (
|
||||||
params?: SearchIngestionKeysParams,
|
params?: SearchIngestionKeysParams,
|
||||||
) => {
|
) => {
|
||||||
return [
|
return ['searchIngestionKeys', ...(params ? [params] : [])] as const;
|
||||||
`/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 = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
params: SearchIngestionKeysParams,
|
params?: SearchIngestionKeysParams,
|
||||||
options?: {
|
options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof searchIngestionKeys>>,
|
Awaited<ReturnType<typeof searchIngestionKeys>>,
|
||||||
@@ -734,7 +727,7 @@ export const getSearchIngestionKeysQueryOptions = <
|
|||||||
export type SearchIngestionKeysQueryResult = NonNullable<
|
export type SearchIngestionKeysQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof searchIngestionKeys>>
|
Awaited<ReturnType<typeof searchIngestionKeys>>
|
||||||
>;
|
>;
|
||||||
export type SearchIngestionKeysQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type SearchIngestionKeysQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Search ingestion keys for workspace
|
* @summary Search ingestion keys for workspace
|
||||||
@@ -742,9 +735,9 @@ export type SearchIngestionKeysQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useSearchIngestionKeys<
|
export function useSearchIngestionKeys<
|
||||||
TData = Awaited<ReturnType<typeof searchIngestionKeys>>,
|
TData = Awaited<ReturnType<typeof searchIngestionKeys>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
params: SearchIngestionKeysParams,
|
params?: SearchIngestionKeysParams,
|
||||||
options?: {
|
options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof searchIngestionKeys>>,
|
Awaited<ReturnType<typeof searchIngestionKeys>>,
|
||||||
@@ -769,7 +762,7 @@ export function useSearchIngestionKeys<
|
|||||||
*/
|
*/
|
||||||
export const invalidateSearchIngestionKeys = async (
|
export const invalidateSearchIngestionKeys = async (
|
||||||
queryClient: QueryClient,
|
queryClient: QueryClient,
|
||||||
params: SearchIngestionKeysParams,
|
params?: SearchIngestionKeysParams,
|
||||||
options?: InvalidateOptions,
|
options?: InvalidateOptions,
|
||||||
): Promise<QueryClient> => {
|
): Promise<QueryClient> => {
|
||||||
await queryClient.invalidateQueries(
|
await queryClient.invalidateQueries(
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ import type {
|
|||||||
} from 'react-query';
|
} from 'react-query';
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery } from 'react-query';
|
||||||
|
|
||||||
import type { ErrorType } from '../../../generatedAPIInstance';
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
|
|
||||||
import type {
|
import type {
|
||||||
GetGlobalConfig200,
|
GetGlobalConfig200,
|
||||||
RenderErrorResponseDTO,
|
RenderErrorResponseDTO,
|
||||||
@@ -38,12 +37,12 @@ export const getGlobalConfig = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getGetGlobalConfigQueryKey = () => {
|
export const getGetGlobalConfigQueryKey = () => {
|
||||||
return [`/api/v1/global/config`] as const;
|
return ['getGlobalConfig'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetGlobalConfigQueryOptions = <
|
export const getGetGlobalConfigQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getGlobalConfig>>,
|
TData = Awaited<ReturnType<typeof getGlobalConfig>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof getGlobalConfig>>,
|
Awaited<ReturnType<typeof getGlobalConfig>>,
|
||||||
@@ -69,7 +68,7 @@ export const getGetGlobalConfigQueryOptions = <
|
|||||||
export type GetGlobalConfigQueryResult = NonNullable<
|
export type GetGlobalConfigQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getGlobalConfig>>
|
Awaited<ReturnType<typeof getGlobalConfig>>
|
||||||
>;
|
>;
|
||||||
export type GetGlobalConfigQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetGlobalConfigQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get global config
|
* @summary Get global config
|
||||||
@@ -77,7 +76,7 @@ export type GetGlobalConfigQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetGlobalConfig<
|
export function useGetGlobalConfig<
|
||||||
TData = Awaited<ReturnType<typeof getGlobalConfig>>,
|
TData = Awaited<ReturnType<typeof getGlobalConfig>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof getGlobalConfig>>,
|
Awaited<ReturnType<typeof getGlobalConfig>>,
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ import type {
|
|||||||
} from 'react-query';
|
} from 'react-query';
|
||||||
import { useMutation, useQuery } from 'react-query';
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
|
|
||||||
import type {
|
import type {
|
||||||
ListPromotedAndIndexedPaths200,
|
ListPromotedAndIndexedPaths200,
|
||||||
PromotetypesPromotePathDTO,
|
PromotetypesPromotePathDTO,
|
||||||
@@ -42,12 +41,12 @@ export const listPromotedAndIndexedPaths = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getListPromotedAndIndexedPathsQueryKey = () => {
|
export const getListPromotedAndIndexedPathsQueryKey = () => {
|
||||||
return [`/api/v1/logs/promote_paths`] as const;
|
return ['listPromotedAndIndexedPaths'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getListPromotedAndIndexedPathsQueryOptions = <
|
export const getListPromotedAndIndexedPathsQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
|
TData = Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
|
Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
|
||||||
@@ -74,7 +73,7 @@ export const getListPromotedAndIndexedPathsQueryOptions = <
|
|||||||
export type ListPromotedAndIndexedPathsQueryResult = NonNullable<
|
export type ListPromotedAndIndexedPathsQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>
|
Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>
|
||||||
>;
|
>;
|
||||||
export type ListPromotedAndIndexedPathsQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type ListPromotedAndIndexedPathsQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Promote and index paths
|
* @summary Promote and index paths
|
||||||
@@ -82,7 +81,7 @@ export type ListPromotedAndIndexedPathsQueryError = ErrorType<RenderErrorRespons
|
|||||||
|
|
||||||
export function useListPromotedAndIndexedPaths<
|
export function useListPromotedAndIndexedPaths<
|
||||||
TData = Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
|
TData = Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
|
Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
|
||||||
@@ -121,9 +120,7 @@ export const invalidateListPromotedAndIndexedPaths = async (
|
|||||||
* @summary Promote and index paths
|
* @summary Promote and index paths
|
||||||
*/
|
*/
|
||||||
export const handlePromoteAndIndexPaths = (
|
export const handlePromoteAndIndexPaths = (
|
||||||
promotetypesPromotePathDTONull: BodyType<
|
promotetypesPromotePathDTONull: PromotetypesPromotePathDTO[] | null,
|
||||||
PromotetypesPromotePathDTO[] | null
|
|
||||||
> | null,
|
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<void>({
|
return GeneratedAPIInstance<void>({
|
||||||
@@ -136,19 +133,19 @@ export const handlePromoteAndIndexPaths = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getHandlePromoteAndIndexPathsMutationOptions = <
|
export const getHandlePromoteAndIndexPathsMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<PromotetypesPromotePathDTO[] | null> },
|
{ data: PromotetypesPromotePathDTO[] | null },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<PromotetypesPromotePathDTO[] | null> },
|
{ data: PromotetypesPromotePathDTO[] | null },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['handlePromoteAndIndexPaths'];
|
const mutationKey = ['handlePromoteAndIndexPaths'];
|
||||||
@@ -162,7 +159,7 @@ export const getHandlePromoteAndIndexPathsMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||||
{ data: BodyType<PromotetypesPromotePathDTO[] | null> }
|
{ data: PromotetypesPromotePathDTO[] | null }
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
@@ -175,28 +172,28 @@ export const getHandlePromoteAndIndexPathsMutationOptions = <
|
|||||||
export type HandlePromoteAndIndexPathsMutationResult = NonNullable<
|
export type HandlePromoteAndIndexPathsMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>
|
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>
|
||||||
>;
|
>;
|
||||||
export type HandlePromoteAndIndexPathsMutationBody = BodyType<
|
export type HandlePromoteAndIndexPathsMutationBody =
|
||||||
PromotetypesPromotePathDTO[] | null
|
| PromotetypesPromotePathDTO[]
|
||||||
>;
|
| null;
|
||||||
export type HandlePromoteAndIndexPathsMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type HandlePromoteAndIndexPathsMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Promote and index paths
|
* @summary Promote and index paths
|
||||||
*/
|
*/
|
||||||
export const useHandlePromoteAndIndexPaths = <
|
export const useHandlePromoteAndIndexPaths = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<PromotetypesPromotePathDTO[] | null> },
|
{ data: PromotetypesPromotePathDTO[] | null },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<PromotetypesPromotePathDTO[] | null> },
|
{ data: PromotetypesPromotePathDTO[] | null },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getHandlePromoteAndIndexPathsMutationOptions(options);
|
const mutationOptions = getHandlePromoteAndIndexPathsMutationOptions(options);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -17,8 +17,7 @@ import type {
|
|||||||
} from 'react-query';
|
} from 'react-query';
|
||||||
import { useMutation, useQuery } from 'react-query';
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
|
|
||||||
import type {
|
import type {
|
||||||
GetMyOrganization200,
|
GetMyOrganization200,
|
||||||
RenderErrorResponseDTO,
|
RenderErrorResponseDTO,
|
||||||
@@ -42,12 +41,12 @@ export const getMyOrganization = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getGetMyOrganizationQueryKey = () => {
|
export const getGetMyOrganizationQueryKey = () => {
|
||||||
return [`/api/v2/orgs/me`] as const;
|
return ['getMyOrganization'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetMyOrganizationQueryOptions = <
|
export const getGetMyOrganizationQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getMyOrganization>>,
|
TData = Awaited<ReturnType<typeof getMyOrganization>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof getMyOrganization>>,
|
Awaited<ReturnType<typeof getMyOrganization>>,
|
||||||
@@ -73,7 +72,7 @@ export const getGetMyOrganizationQueryOptions = <
|
|||||||
export type GetMyOrganizationQueryResult = NonNullable<
|
export type GetMyOrganizationQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getMyOrganization>>
|
Awaited<ReturnType<typeof getMyOrganization>>
|
||||||
>;
|
>;
|
||||||
export type GetMyOrganizationQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetMyOrganizationQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get my organization
|
* @summary Get my organization
|
||||||
@@ -81,7 +80,7 @@ export type GetMyOrganizationQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetMyOrganization<
|
export function useGetMyOrganization<
|
||||||
TData = Awaited<ReturnType<typeof getMyOrganization>>,
|
TData = Awaited<ReturnType<typeof getMyOrganization>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof getMyOrganization>>,
|
Awaited<ReturnType<typeof getMyOrganization>>,
|
||||||
@@ -120,7 +119,7 @@ export const invalidateGetMyOrganization = async (
|
|||||||
* @summary Update my organization
|
* @summary Update my organization
|
||||||
*/
|
*/
|
||||||
export const updateMyOrganization = (
|
export const updateMyOrganization = (
|
||||||
typesOrganizationDTO: BodyType<TypesOrganizationDTO>,
|
typesOrganizationDTO: TypesOrganizationDTO,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<void>({
|
return GeneratedAPIInstance<void>({
|
||||||
url: `/api/v2/orgs/me`,
|
url: `/api/v2/orgs/me`,
|
||||||
@@ -131,19 +130,19 @@ export const updateMyOrganization = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getUpdateMyOrganizationMutationOptions = <
|
export const getUpdateMyOrganizationMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof updateMyOrganization>>,
|
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesOrganizationDTO> },
|
{ data: TypesOrganizationDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof updateMyOrganization>>,
|
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesOrganizationDTO> },
|
{ data: TypesOrganizationDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['updateMyOrganization'];
|
const mutationKey = ['updateMyOrganization'];
|
||||||
@@ -157,7 +156,7 @@ export const getUpdateMyOrganizationMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof updateMyOrganization>>,
|
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||||
{ data: BodyType<TypesOrganizationDTO> }
|
{ data: TypesOrganizationDTO }
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
@@ -170,26 +169,26 @@ export const getUpdateMyOrganizationMutationOptions = <
|
|||||||
export type UpdateMyOrganizationMutationResult = NonNullable<
|
export type UpdateMyOrganizationMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof updateMyOrganization>>
|
Awaited<ReturnType<typeof updateMyOrganization>>
|
||||||
>;
|
>;
|
||||||
export type UpdateMyOrganizationMutationBody = BodyType<TypesOrganizationDTO>;
|
export type UpdateMyOrganizationMutationBody = TypesOrganizationDTO;
|
||||||
export type UpdateMyOrganizationMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type UpdateMyOrganizationMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Update my organization
|
* @summary Update my organization
|
||||||
*/
|
*/
|
||||||
export const useUpdateMyOrganization = <
|
export const useUpdateMyOrganization = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof updateMyOrganization>>,
|
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesOrganizationDTO> },
|
{ data: TypesOrganizationDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof updateMyOrganization>>,
|
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesOrganizationDTO> },
|
{ data: TypesOrganizationDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getUpdateMyOrganizationMutationOptions(options);
|
const mutationOptions = getUpdateMyOrganizationMutationOptions(options);
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ import type {
|
|||||||
} from 'react-query';
|
} from 'react-query';
|
||||||
import { useMutation, useQuery } from 'react-query';
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
|
|
||||||
import type {
|
import type {
|
||||||
GetOrgPreference200,
|
GetOrgPreference200,
|
||||||
GetOrgPreferencePathParameters,
|
GetOrgPreferencePathParameters,
|
||||||
@@ -49,12 +48,12 @@ export const listOrgPreferences = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getListOrgPreferencesQueryKey = () => {
|
export const getListOrgPreferencesQueryKey = () => {
|
||||||
return [`/api/v1/org/preferences`] as const;
|
return ['listOrgPreferences'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getListOrgPreferencesQueryOptions = <
|
export const getListOrgPreferencesQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof listOrgPreferences>>,
|
TData = Awaited<ReturnType<typeof listOrgPreferences>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof listOrgPreferences>>,
|
Awaited<ReturnType<typeof listOrgPreferences>>,
|
||||||
@@ -80,7 +79,7 @@ export const getListOrgPreferencesQueryOptions = <
|
|||||||
export type ListOrgPreferencesQueryResult = NonNullable<
|
export type ListOrgPreferencesQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof listOrgPreferences>>
|
Awaited<ReturnType<typeof listOrgPreferences>>
|
||||||
>;
|
>;
|
||||||
export type ListOrgPreferencesQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type ListOrgPreferencesQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary List org preferences
|
* @summary List org preferences
|
||||||
@@ -88,7 +87,7 @@ export type ListOrgPreferencesQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useListOrgPreferences<
|
export function useListOrgPreferences<
|
||||||
TData = Awaited<ReturnType<typeof listOrgPreferences>>,
|
TData = Awaited<ReturnType<typeof listOrgPreferences>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof listOrgPreferences>>,
|
Awaited<ReturnType<typeof listOrgPreferences>>,
|
||||||
@@ -140,12 +139,12 @@ export const getOrgPreference = (
|
|||||||
export const getGetOrgPreferenceQueryKey = ({
|
export const getGetOrgPreferenceQueryKey = ({
|
||||||
name,
|
name,
|
||||||
}: GetOrgPreferencePathParameters) => {
|
}: GetOrgPreferencePathParameters) => {
|
||||||
return [`/api/v1/org/preferences/${name}`] as const;
|
return ['getOrgPreference'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetOrgPreferenceQueryOptions = <
|
export const getGetOrgPreferenceQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getOrgPreference>>,
|
TData = Awaited<ReturnType<typeof getOrgPreference>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ name }: GetOrgPreferencePathParameters,
|
{ name }: GetOrgPreferencePathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -180,7 +179,7 @@ export const getGetOrgPreferenceQueryOptions = <
|
|||||||
export type GetOrgPreferenceQueryResult = NonNullable<
|
export type GetOrgPreferenceQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getOrgPreference>>
|
Awaited<ReturnType<typeof getOrgPreference>>
|
||||||
>;
|
>;
|
||||||
export type GetOrgPreferenceQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetOrgPreferenceQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get org preference
|
* @summary Get org preference
|
||||||
@@ -188,7 +187,7 @@ export type GetOrgPreferenceQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetOrgPreference<
|
export function useGetOrgPreference<
|
||||||
TData = Awaited<ReturnType<typeof getOrgPreference>>,
|
TData = Awaited<ReturnType<typeof getOrgPreference>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ name }: GetOrgPreferencePathParameters,
|
{ name }: GetOrgPreferencePathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -232,7 +231,7 @@ export const invalidateGetOrgPreference = async (
|
|||||||
*/
|
*/
|
||||||
export const updateOrgPreference = (
|
export const updateOrgPreference = (
|
||||||
{ name }: UpdateOrgPreferencePathParameters,
|
{ name }: UpdateOrgPreferencePathParameters,
|
||||||
preferencetypesUpdatablePreferenceDTO: BodyType<PreferencetypesUpdatablePreferenceDTO>,
|
preferencetypesUpdatablePreferenceDTO: PreferencetypesUpdatablePreferenceDTO,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<void>({
|
return GeneratedAPIInstance<void>({
|
||||||
url: `/api/v1/org/preferences/${name}`,
|
url: `/api/v1/org/preferences/${name}`,
|
||||||
@@ -243,7 +242,7 @@ export const updateOrgPreference = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getUpdateOrgPreferenceMutationOptions = <
|
export const getUpdateOrgPreferenceMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -251,7 +250,7 @@ export const getUpdateOrgPreferenceMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateOrgPreferencePathParameters;
|
pathParams: UpdateOrgPreferencePathParameters;
|
||||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -260,7 +259,7 @@ export const getUpdateOrgPreferenceMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateOrgPreferencePathParameters;
|
pathParams: UpdateOrgPreferencePathParameters;
|
||||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -277,7 +276,7 @@ export const getUpdateOrgPreferenceMutationOptions = <
|
|||||||
Awaited<ReturnType<typeof updateOrgPreference>>,
|
Awaited<ReturnType<typeof updateOrgPreference>>,
|
||||||
{
|
{
|
||||||
pathParams: UpdateOrgPreferencePathParameters;
|
pathParams: UpdateOrgPreferencePathParameters;
|
||||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
}
|
}
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { pathParams, data } = props ?? {};
|
const { pathParams, data } = props ?? {};
|
||||||
@@ -291,14 +290,14 @@ export const getUpdateOrgPreferenceMutationOptions = <
|
|||||||
export type UpdateOrgPreferenceMutationResult = NonNullable<
|
export type UpdateOrgPreferenceMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof updateOrgPreference>>
|
Awaited<ReturnType<typeof updateOrgPreference>>
|
||||||
>;
|
>;
|
||||||
export type UpdateOrgPreferenceMutationBody = BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
export type UpdateOrgPreferenceMutationBody = PreferencetypesUpdatablePreferenceDTO;
|
||||||
export type UpdateOrgPreferenceMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type UpdateOrgPreferenceMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Update org preference
|
* @summary Update org preference
|
||||||
*/
|
*/
|
||||||
export const useUpdateOrgPreference = <
|
export const useUpdateOrgPreference = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -306,7 +305,7 @@ export const useUpdateOrgPreference = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateOrgPreferencePathParameters;
|
pathParams: UpdateOrgPreferencePathParameters;
|
||||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -315,7 +314,7 @@ export const useUpdateOrgPreference = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateOrgPreferencePathParameters;
|
pathParams: UpdateOrgPreferencePathParameters;
|
||||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -336,12 +335,12 @@ export const listUserPreferences = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getListUserPreferencesQueryKey = () => {
|
export const getListUserPreferencesQueryKey = () => {
|
||||||
return [`/api/v1/user/preferences`] as const;
|
return ['listUserPreferences'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getListUserPreferencesQueryOptions = <
|
export const getListUserPreferencesQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof listUserPreferences>>,
|
TData = Awaited<ReturnType<typeof listUserPreferences>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof listUserPreferences>>,
|
Awaited<ReturnType<typeof listUserPreferences>>,
|
||||||
@@ -367,7 +366,7 @@ export const getListUserPreferencesQueryOptions = <
|
|||||||
export type ListUserPreferencesQueryResult = NonNullable<
|
export type ListUserPreferencesQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof listUserPreferences>>
|
Awaited<ReturnType<typeof listUserPreferences>>
|
||||||
>;
|
>;
|
||||||
export type ListUserPreferencesQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type ListUserPreferencesQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary List user preferences
|
* @summary List user preferences
|
||||||
@@ -375,7 +374,7 @@ export type ListUserPreferencesQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useListUserPreferences<
|
export function useListUserPreferences<
|
||||||
TData = Awaited<ReturnType<typeof listUserPreferences>>,
|
TData = Awaited<ReturnType<typeof listUserPreferences>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof listUserPreferences>>,
|
Awaited<ReturnType<typeof listUserPreferences>>,
|
||||||
@@ -427,12 +426,12 @@ export const getUserPreference = (
|
|||||||
export const getGetUserPreferenceQueryKey = ({
|
export const getGetUserPreferenceQueryKey = ({
|
||||||
name,
|
name,
|
||||||
}: GetUserPreferencePathParameters) => {
|
}: GetUserPreferencePathParameters) => {
|
||||||
return [`/api/v1/user/preferences/${name}`] as const;
|
return ['getUserPreference'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetUserPreferenceQueryOptions = <
|
export const getGetUserPreferenceQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getUserPreference>>,
|
TData = Awaited<ReturnType<typeof getUserPreference>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ name }: GetUserPreferencePathParameters,
|
{ name }: GetUserPreferencePathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -467,7 +466,7 @@ export const getGetUserPreferenceQueryOptions = <
|
|||||||
export type GetUserPreferenceQueryResult = NonNullable<
|
export type GetUserPreferenceQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getUserPreference>>
|
Awaited<ReturnType<typeof getUserPreference>>
|
||||||
>;
|
>;
|
||||||
export type GetUserPreferenceQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetUserPreferenceQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get user preference
|
* @summary Get user preference
|
||||||
@@ -475,7 +474,7 @@ export type GetUserPreferenceQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetUserPreference<
|
export function useGetUserPreference<
|
||||||
TData = Awaited<ReturnType<typeof getUserPreference>>,
|
TData = Awaited<ReturnType<typeof getUserPreference>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ name }: GetUserPreferencePathParameters,
|
{ name }: GetUserPreferencePathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -519,7 +518,7 @@ export const invalidateGetUserPreference = async (
|
|||||||
*/
|
*/
|
||||||
export const updateUserPreference = (
|
export const updateUserPreference = (
|
||||||
{ name }: UpdateUserPreferencePathParameters,
|
{ name }: UpdateUserPreferencePathParameters,
|
||||||
preferencetypesUpdatablePreferenceDTO: BodyType<PreferencetypesUpdatablePreferenceDTO>,
|
preferencetypesUpdatablePreferenceDTO: PreferencetypesUpdatablePreferenceDTO,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<void>({
|
return GeneratedAPIInstance<void>({
|
||||||
url: `/api/v1/user/preferences/${name}`,
|
url: `/api/v1/user/preferences/${name}`,
|
||||||
@@ -530,7 +529,7 @@ export const updateUserPreference = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getUpdateUserPreferenceMutationOptions = <
|
export const getUpdateUserPreferenceMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -538,7 +537,7 @@ export const getUpdateUserPreferenceMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateUserPreferencePathParameters;
|
pathParams: UpdateUserPreferencePathParameters;
|
||||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -547,7 +546,7 @@ export const getUpdateUserPreferenceMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateUserPreferencePathParameters;
|
pathParams: UpdateUserPreferencePathParameters;
|
||||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -564,7 +563,7 @@ export const getUpdateUserPreferenceMutationOptions = <
|
|||||||
Awaited<ReturnType<typeof updateUserPreference>>,
|
Awaited<ReturnType<typeof updateUserPreference>>,
|
||||||
{
|
{
|
||||||
pathParams: UpdateUserPreferencePathParameters;
|
pathParams: UpdateUserPreferencePathParameters;
|
||||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
}
|
}
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { pathParams, data } = props ?? {};
|
const { pathParams, data } = props ?? {};
|
||||||
@@ -578,14 +577,14 @@ export const getUpdateUserPreferenceMutationOptions = <
|
|||||||
export type UpdateUserPreferenceMutationResult = NonNullable<
|
export type UpdateUserPreferenceMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof updateUserPreference>>
|
Awaited<ReturnType<typeof updateUserPreference>>
|
||||||
>;
|
>;
|
||||||
export type UpdateUserPreferenceMutationBody = BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
export type UpdateUserPreferenceMutationBody = PreferencetypesUpdatablePreferenceDTO;
|
||||||
export type UpdateUserPreferenceMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type UpdateUserPreferenceMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Update user preference
|
* @summary Update user preference
|
||||||
*/
|
*/
|
||||||
export const useUpdateUserPreference = <
|
export const useUpdateUserPreference = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -593,7 +592,7 @@ export const useUpdateUserPreference = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateUserPreferencePathParameters;
|
pathParams: UpdateUserPreferencePathParameters;
|
||||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -602,7 +601,7 @@ export const useUpdateUserPreference = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: UpdateUserPreferencePathParameters;
|
pathParams: UpdateUserPreferencePathParameters;
|
||||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
|
|||||||
@@ -1,192 +0,0 @@
|
|||||||
/**
|
|
||||||
* ! Do not edit manually
|
|
||||||
* * The file has been auto-generated using Orval for SigNoz
|
|
||||||
* * regenerate with 'yarn generate:api'
|
|
||||||
* SigNoz
|
|
||||||
*/
|
|
||||||
import type {
|
|
||||||
MutationFunction,
|
|
||||||
UseMutationOptions,
|
|
||||||
UseMutationResult,
|
|
||||||
} from 'react-query';
|
|
||||||
import { useMutation } from 'react-query';
|
|
||||||
|
|
||||||
import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
|
|
||||||
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
|
|
||||||
import type {
|
|
||||||
Querybuildertypesv5QueryRangeRequestDTO,
|
|
||||||
QueryRangeV5200,
|
|
||||||
RenderErrorResponseDTO,
|
|
||||||
ReplaceVariables200,
|
|
||||||
} from '../sigNoz.schemas';
|
|
||||||
|
|
||||||
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
||||||
|
|
||||||
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute a composite query over a time range. Supports builder queries (traces, logs, metrics), formulas, trace operators, PromQL, and ClickHouse SQL.
|
|
||||||
* @summary Query range
|
|
||||||
*/
|
|
||||||
export const queryRangeV5 = (
|
|
||||||
querybuildertypesv5QueryRangeRequestDTO: BodyType<Querybuildertypesv5QueryRangeRequestDTO>,
|
|
||||||
signal?: AbortSignal,
|
|
||||||
) => {
|
|
||||||
return GeneratedAPIInstance<QueryRangeV5200>({
|
|
||||||
url: `/api/v5/query_range`,
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
data: querybuildertypesv5QueryRangeRequestDTO,
|
|
||||||
signal,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getQueryRangeV5MutationOptions = <
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
|
||||||
TContext = unknown
|
|
||||||
>(options?: {
|
|
||||||
mutation?: UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof queryRangeV5>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
|
||||||
TContext
|
|
||||||
>;
|
|
||||||
}): UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof queryRangeV5>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
|
||||||
TContext
|
|
||||||
> => {
|
|
||||||
const mutationKey = ['queryRangeV5'];
|
|
||||||
const { mutation: mutationOptions } = options
|
|
||||||
? options.mutation &&
|
|
||||||
'mutationKey' in options.mutation &&
|
|
||||||
options.mutation.mutationKey
|
|
||||||
? options
|
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
||||||
: { mutation: { mutationKey } };
|
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
|
||||||
Awaited<ReturnType<typeof queryRangeV5>>,
|
|
||||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> }
|
|
||||||
> = (props) => {
|
|
||||||
const { data } = props ?? {};
|
|
||||||
|
|
||||||
return queryRangeV5(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type QueryRangeV5MutationResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof queryRangeV5>>
|
|
||||||
>;
|
|
||||||
export type QueryRangeV5MutationBody = BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
|
||||||
export type QueryRangeV5MutationError = ErrorType<RenderErrorResponseDTO>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @summary Query range
|
|
||||||
*/
|
|
||||||
export const useQueryRangeV5 = <
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
|
||||||
TContext = unknown
|
|
||||||
>(options?: {
|
|
||||||
mutation?: UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof queryRangeV5>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
|
||||||
TContext
|
|
||||||
>;
|
|
||||||
}): UseMutationResult<
|
|
||||||
Awaited<ReturnType<typeof queryRangeV5>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
|
||||||
TContext
|
|
||||||
> => {
|
|
||||||
const mutationOptions = getQueryRangeV5MutationOptions(options);
|
|
||||||
|
|
||||||
return useMutation(mutationOptions);
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Replace variables in a query
|
|
||||||
* @summary Replace variables
|
|
||||||
*/
|
|
||||||
export const replaceVariables = (
|
|
||||||
querybuildertypesv5QueryRangeRequestDTO: BodyType<Querybuildertypesv5QueryRangeRequestDTO>,
|
|
||||||
signal?: AbortSignal,
|
|
||||||
) => {
|
|
||||||
return GeneratedAPIInstance<ReplaceVariables200>({
|
|
||||||
url: `/api/v5/substitute_vars`,
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
data: querybuildertypesv5QueryRangeRequestDTO,
|
|
||||||
signal,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getReplaceVariablesMutationOptions = <
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
|
||||||
TContext = unknown
|
|
||||||
>(options?: {
|
|
||||||
mutation?: UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof replaceVariables>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
|
||||||
TContext
|
|
||||||
>;
|
|
||||||
}): UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof replaceVariables>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
|
||||||
TContext
|
|
||||||
> => {
|
|
||||||
const mutationKey = ['replaceVariables'];
|
|
||||||
const { mutation: mutationOptions } = options
|
|
||||||
? options.mutation &&
|
|
||||||
'mutationKey' in options.mutation &&
|
|
||||||
options.mutation.mutationKey
|
|
||||||
? options
|
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
||||||
: { mutation: { mutationKey } };
|
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
|
||||||
Awaited<ReturnType<typeof replaceVariables>>,
|
|
||||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> }
|
|
||||||
> = (props) => {
|
|
||||||
const { data } = props ?? {};
|
|
||||||
|
|
||||||
return replaceVariables(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ReplaceVariablesMutationResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof replaceVariables>>
|
|
||||||
>;
|
|
||||||
export type ReplaceVariablesMutationBody = BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
|
||||||
export type ReplaceVariablesMutationError = ErrorType<RenderErrorResponseDTO>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @summary Replace variables
|
|
||||||
*/
|
|
||||||
export const useReplaceVariables = <
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
|
||||||
TContext = unknown
|
|
||||||
>(options?: {
|
|
||||||
mutation?: UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof replaceVariables>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
|
||||||
TContext
|
|
||||||
>;
|
|
||||||
}): UseMutationResult<
|
|
||||||
Awaited<ReturnType<typeof replaceVariables>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
|
||||||
TContext
|
|
||||||
> => {
|
|
||||||
const mutationOptions = getReplaceVariablesMutationOptions(options);
|
|
||||||
|
|
||||||
return useMutation(mutationOptions);
|
|
||||||
};
|
|
||||||
@@ -17,22 +17,15 @@ import type {
|
|||||||
} from 'react-query';
|
} from 'react-query';
|
||||||
import { useMutation, useQuery } from 'react-query';
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
|
|
||||||
import type {
|
import type {
|
||||||
AuthtypesPatchableObjectsDTO,
|
|
||||||
CreateRole201,
|
CreateRole201,
|
||||||
DeleteRolePathParameters,
|
DeleteRolePathParameters,
|
||||||
GetObjects200,
|
|
||||||
GetObjectsPathParameters,
|
|
||||||
GetRole200,
|
GetRole200,
|
||||||
GetRolePathParameters,
|
GetRolePathParameters,
|
||||||
ListRoles200,
|
ListRoles200,
|
||||||
PatchObjectsPathParameters,
|
|
||||||
PatchRolePathParameters,
|
PatchRolePathParameters,
|
||||||
RenderErrorResponseDTO,
|
RenderErrorResponseDTO,
|
||||||
RoletypesPatchableRoleDTO,
|
|
||||||
RoletypesPostableRoleDTO,
|
|
||||||
} from '../sigNoz.schemas';
|
} from '../sigNoz.schemas';
|
||||||
|
|
||||||
type AwaitedInput<T> = PromiseLike<T> | T;
|
type AwaitedInput<T> = PromiseLike<T> | T;
|
||||||
@@ -52,12 +45,12 @@ export const listRoles = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getListRolesQueryKey = () => {
|
export const getListRolesQueryKey = () => {
|
||||||
return [`/api/v1/roles`] as const;
|
return ['listRoles'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getListRolesQueryOptions = <
|
export const getListRolesQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof listRoles>>,
|
TData = Awaited<ReturnType<typeof listRoles>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<Awaited<ReturnType<typeof listRoles>>, TError, TData>;
|
query?: UseQueryOptions<Awaited<ReturnType<typeof listRoles>>, TError, TData>;
|
||||||
}) => {
|
}) => {
|
||||||
@@ -79,7 +72,7 @@ export const getListRolesQueryOptions = <
|
|||||||
export type ListRolesQueryResult = NonNullable<
|
export type ListRolesQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof listRoles>>
|
Awaited<ReturnType<typeof listRoles>>
|
||||||
>;
|
>;
|
||||||
export type ListRolesQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type ListRolesQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary List roles
|
* @summary List roles
|
||||||
@@ -87,7 +80,7 @@ export type ListRolesQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useListRoles<
|
export function useListRoles<
|
||||||
TData = Awaited<ReturnType<typeof listRoles>>,
|
TData = Awaited<ReturnType<typeof listRoles>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = 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 } {
|
||||||
@@ -121,33 +114,28 @@ export const invalidateListRoles = async (
|
|||||||
* This endpoint creates a role
|
* This endpoint creates a role
|
||||||
* @summary Create role
|
* @summary Create role
|
||||||
*/
|
*/
|
||||||
export const createRole = (
|
export const createRole = (signal?: AbortSignal) => {
|
||||||
roletypesPostableRoleDTO: BodyType<RoletypesPostableRoleDTO>,
|
|
||||||
signal?: AbortSignal,
|
|
||||||
) => {
|
|
||||||
return GeneratedAPIInstance<CreateRole201>({
|
return GeneratedAPIInstance<CreateRole201>({
|
||||||
url: `/api/v1/roles`,
|
url: `/api/v1/roles`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
data: roletypesPostableRoleDTO,
|
|
||||||
signal,
|
signal,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateRoleMutationOptions = <
|
export const getCreateRoleMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createRole>>,
|
Awaited<ReturnType<typeof createRole>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<RoletypesPostableRoleDTO> },
|
void,
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createRole>>,
|
Awaited<ReturnType<typeof createRole>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<RoletypesPostableRoleDTO> },
|
void,
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['createRole'];
|
const mutationKey = ['createRole'];
|
||||||
@@ -161,11 +149,9 @@ export const getCreateRoleMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof createRole>>,
|
Awaited<ReturnType<typeof createRole>>,
|
||||||
{ data: BodyType<RoletypesPostableRoleDTO> }
|
void
|
||||||
> = (props) => {
|
> = () => {
|
||||||
const { data } = props ?? {};
|
return createRole();
|
||||||
|
|
||||||
return createRole(data);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@@ -174,26 +160,26 @@ export const getCreateRoleMutationOptions = <
|
|||||||
export type CreateRoleMutationResult = NonNullable<
|
export type CreateRoleMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof createRole>>
|
Awaited<ReturnType<typeof createRole>>
|
||||||
>;
|
>;
|
||||||
export type CreateRoleMutationBody = BodyType<RoletypesPostableRoleDTO>;
|
|
||||||
export type CreateRoleMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type CreateRoleMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Create role
|
* @summary Create role
|
||||||
*/
|
*/
|
||||||
export const useCreateRole = <
|
export const useCreateRole = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createRole>>,
|
Awaited<ReturnType<typeof createRole>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<RoletypesPostableRoleDTO> },
|
void,
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof createRole>>,
|
Awaited<ReturnType<typeof createRole>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<RoletypesPostableRoleDTO> },
|
void,
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getCreateRoleMutationOptions(options);
|
const mutationOptions = getCreateRoleMutationOptions(options);
|
||||||
@@ -212,7 +198,7 @@ export const deleteRole = ({ id }: DeleteRolePathParameters) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getDeleteRoleMutationOptions = <
|
export const getDeleteRoleMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -252,13 +238,13 @@ export type DeleteRoleMutationResult = NonNullable<
|
|||||||
Awaited<ReturnType<typeof deleteRole>>
|
Awaited<ReturnType<typeof deleteRole>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type DeleteRoleMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type DeleteRoleMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Delete role
|
* @summary Delete role
|
||||||
*/
|
*/
|
||||||
export const useDeleteRole = <
|
export const useDeleteRole = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -293,12 +279,12 @@ export const getRole = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getGetRoleQueryKey = ({ id }: GetRolePathParameters) => {
|
export const getGetRoleQueryKey = ({ id }: GetRolePathParameters) => {
|
||||||
return [`/api/v1/roles/${id}`] as const;
|
return ['getRole'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetRoleQueryOptions = <
|
export const getGetRoleQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getRole>>,
|
TData = Awaited<ReturnType<typeof getRole>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ id }: GetRolePathParameters,
|
{ id }: GetRolePathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -326,7 +312,7 @@ export const getGetRoleQueryOptions = <
|
|||||||
export type GetRoleQueryResult = NonNullable<
|
export type GetRoleQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getRole>>
|
Awaited<ReturnType<typeof getRole>>
|
||||||
>;
|
>;
|
||||||
export type GetRoleQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetRoleQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get role
|
* @summary Get role
|
||||||
@@ -334,7 +320,7 @@ export type GetRoleQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetRole<
|
export function useGetRole<
|
||||||
TData = Awaited<ReturnType<typeof getRole>>,
|
TData = Awaited<ReturnType<typeof getRole>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ id }: GetRolePathParameters,
|
{ id }: GetRolePathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -372,38 +358,27 @@ export const invalidateGetRole = async (
|
|||||||
* This endpoint patches a role
|
* This endpoint patches a role
|
||||||
* @summary Patch role
|
* @summary Patch role
|
||||||
*/
|
*/
|
||||||
export const patchRole = (
|
export const patchRole = ({ id }: PatchRolePathParameters) => {
|
||||||
{ id }: PatchRolePathParameters,
|
|
||||||
roletypesPatchableRoleDTO: BodyType<RoletypesPatchableRoleDTO>,
|
|
||||||
) => {
|
|
||||||
return GeneratedAPIInstance<string>({
|
return GeneratedAPIInstance<string>({
|
||||||
url: `/api/v1/roles/${id}`,
|
url: `/api/v1/roles/${id}`,
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
data: roletypesPatchableRoleDTO,
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getPatchRoleMutationOptions = <
|
export const getPatchRoleMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof patchRole>>,
|
Awaited<ReturnType<typeof patchRole>>,
|
||||||
TError,
|
TError,
|
||||||
{
|
{ pathParams: PatchRolePathParameters },
|
||||||
pathParams: PatchRolePathParameters;
|
|
||||||
data: BodyType<RoletypesPatchableRoleDTO>;
|
|
||||||
},
|
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof patchRole>>,
|
Awaited<ReturnType<typeof patchRole>>,
|
||||||
TError,
|
TError,
|
||||||
{
|
{ pathParams: PatchRolePathParameters },
|
||||||
pathParams: PatchRolePathParameters;
|
|
||||||
data: BodyType<RoletypesPatchableRoleDTO>;
|
|
||||||
},
|
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['patchRole'];
|
const mutationKey = ['patchRole'];
|
||||||
@@ -417,14 +392,11 @@ export const getPatchRoleMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof patchRole>>,
|
Awaited<ReturnType<typeof patchRole>>,
|
||||||
{
|
{ pathParams: PatchRolePathParameters }
|
||||||
pathParams: PatchRolePathParameters;
|
|
||||||
data: BodyType<RoletypesPatchableRoleDTO>;
|
|
||||||
}
|
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { pathParams, data } = props ?? {};
|
const { pathParams } = props ?? {};
|
||||||
|
|
||||||
return patchRole(pathParams, data);
|
return patchRole(pathParams);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@@ -433,235 +405,29 @@ export const getPatchRoleMutationOptions = <
|
|||||||
export type PatchRoleMutationResult = NonNullable<
|
export type PatchRoleMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof patchRole>>
|
Awaited<ReturnType<typeof patchRole>>
|
||||||
>;
|
>;
|
||||||
export type PatchRoleMutationBody = BodyType<RoletypesPatchableRoleDTO>;
|
|
||||||
export type PatchRoleMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type PatchRoleMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Patch role
|
* @summary Patch role
|
||||||
*/
|
*/
|
||||||
export const usePatchRole = <
|
export const usePatchRole = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof patchRole>>,
|
Awaited<ReturnType<typeof patchRole>>,
|
||||||
TError,
|
TError,
|
||||||
{
|
{ pathParams: PatchRolePathParameters },
|
||||||
pathParams: PatchRolePathParameters;
|
|
||||||
data: BodyType<RoletypesPatchableRoleDTO>;
|
|
||||||
},
|
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof patchRole>>,
|
Awaited<ReturnType<typeof patchRole>>,
|
||||||
TError,
|
TError,
|
||||||
{
|
{ pathParams: PatchRolePathParameters },
|
||||||
pathParams: PatchRolePathParameters;
|
|
||||||
data: BodyType<RoletypesPatchableRoleDTO>;
|
|
||||||
},
|
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getPatchRoleMutationOptions(options);
|
const mutationOptions = getPatchRoleMutationOptions(options);
|
||||||
|
|
||||||
return useMutation(mutationOptions);
|
return useMutation(mutationOptions);
|
||||||
};
|
};
|
||||||
/**
|
|
||||||
* Gets all objects connected to the specified role via a given relation type
|
|
||||||
* @summary Get objects for a role by relation
|
|
||||||
*/
|
|
||||||
export const getObjects = (
|
|
||||||
{ id, relation }: GetObjectsPathParameters,
|
|
||||||
signal?: AbortSignal,
|
|
||||||
) => {
|
|
||||||
return GeneratedAPIInstance<GetObjects200>({
|
|
||||||
url: `/api/v1/roles/${id}/relation/${relation}/objects`,
|
|
||||||
method: 'GET',
|
|
||||||
signal,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getGetObjectsQueryKey = ({
|
|
||||||
id,
|
|
||||||
relation,
|
|
||||||
}: GetObjectsPathParameters) => {
|
|
||||||
return [`/api/v1/roles/${id}/relation/${relation}/objects`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getGetObjectsQueryOptions = <
|
|
||||||
TData = Awaited<ReturnType<typeof getObjects>>,
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
|
||||||
>(
|
|
||||||
{ id, relation }: GetObjectsPathParameters,
|
|
||||||
options?: {
|
|
||||||
query?: UseQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof getObjects>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey =
|
|
||||||
queryOptions?.queryKey ?? getGetObjectsQueryKey({ id, relation });
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getObjects>>> = ({
|
|
||||||
signal,
|
|
||||||
}) => getObjects({ id, relation }, signal);
|
|
||||||
|
|
||||||
return {
|
|
||||||
queryKey,
|
|
||||||
queryFn,
|
|
||||||
enabled: !!(id && relation),
|
|
||||||
...queryOptions,
|
|
||||||
} as UseQueryOptions<Awaited<ReturnType<typeof getObjects>>, TError, TData> & {
|
|
||||||
queryKey: QueryKey;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export type GetObjectsQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof getObjects>>
|
|
||||||
>;
|
|
||||||
export type GetObjectsQueryError = ErrorType<RenderErrorResponseDTO>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @summary Get objects for a role by relation
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useGetObjects<
|
|
||||||
TData = Awaited<ReturnType<typeof getObjects>>,
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
|
||||||
>(
|
|
||||||
{ id, relation }: GetObjectsPathParameters,
|
|
||||||
options?: {
|
|
||||||
query?: UseQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof getObjects>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
>;
|
|
||||||
},
|
|
||||||
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
||||||
const queryOptions = getGetObjectsQueryOptions({ id, relation }, options);
|
|
||||||
|
|
||||||
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
||||||
queryKey: QueryKey;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @summary Get objects for a role by relation
|
|
||||||
*/
|
|
||||||
export const invalidateGetObjects = async (
|
|
||||||
queryClient: QueryClient,
|
|
||||||
{ id, relation }: GetObjectsPathParameters,
|
|
||||||
options?: InvalidateOptions,
|
|
||||||
): Promise<QueryClient> => {
|
|
||||||
await queryClient.invalidateQueries(
|
|
||||||
{ queryKey: getGetObjectsQueryKey({ id, relation }) },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
return queryClient;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Patches the objects connected to the specified role via a given relation type
|
|
||||||
* @summary Patch objects for a role by relation
|
|
||||||
*/
|
|
||||||
export const patchObjects = (
|
|
||||||
{ id, relation }: PatchObjectsPathParameters,
|
|
||||||
authtypesPatchableObjectsDTO: BodyType<AuthtypesPatchableObjectsDTO>,
|
|
||||||
) => {
|
|
||||||
return GeneratedAPIInstance<string>({
|
|
||||||
url: `/api/v1/roles/${id}/relation/${relation}/objects`,
|
|
||||||
method: 'PATCH',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
data: authtypesPatchableObjectsDTO,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getPatchObjectsMutationOptions = <
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
|
||||||
TContext = unknown
|
|
||||||
>(options?: {
|
|
||||||
mutation?: UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof patchObjects>>,
|
|
||||||
TError,
|
|
||||||
{
|
|
||||||
pathParams: PatchObjectsPathParameters;
|
|
||||||
data: BodyType<AuthtypesPatchableObjectsDTO>;
|
|
||||||
},
|
|
||||||
TContext
|
|
||||||
>;
|
|
||||||
}): UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof patchObjects>>,
|
|
||||||
TError,
|
|
||||||
{
|
|
||||||
pathParams: PatchObjectsPathParameters;
|
|
||||||
data: BodyType<AuthtypesPatchableObjectsDTO>;
|
|
||||||
},
|
|
||||||
TContext
|
|
||||||
> => {
|
|
||||||
const mutationKey = ['patchObjects'];
|
|
||||||
const { mutation: mutationOptions } = options
|
|
||||||
? options.mutation &&
|
|
||||||
'mutationKey' in options.mutation &&
|
|
||||||
options.mutation.mutationKey
|
|
||||||
? options
|
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
||||||
: { mutation: { mutationKey } };
|
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
|
||||||
Awaited<ReturnType<typeof patchObjects>>,
|
|
||||||
{
|
|
||||||
pathParams: PatchObjectsPathParameters;
|
|
||||||
data: BodyType<AuthtypesPatchableObjectsDTO>;
|
|
||||||
}
|
|
||||||
> = (props) => {
|
|
||||||
const { pathParams, data } = props ?? {};
|
|
||||||
|
|
||||||
return patchObjects(pathParams, data);
|
|
||||||
};
|
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PatchObjectsMutationResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof patchObjects>>
|
|
||||||
>;
|
|
||||||
export type PatchObjectsMutationBody = BodyType<AuthtypesPatchableObjectsDTO>;
|
|
||||||
export type PatchObjectsMutationError = ErrorType<RenderErrorResponseDTO>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @summary Patch objects for a role by relation
|
|
||||||
*/
|
|
||||||
export const usePatchObjects = <
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
|
||||||
TContext = unknown
|
|
||||||
>(options?: {
|
|
||||||
mutation?: UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof patchObjects>>,
|
|
||||||
TError,
|
|
||||||
{
|
|
||||||
pathParams: PatchObjectsPathParameters;
|
|
||||||
data: BodyType<AuthtypesPatchableObjectsDTO>;
|
|
||||||
},
|
|
||||||
TContext
|
|
||||||
>;
|
|
||||||
}): UseMutationResult<
|
|
||||||
Awaited<ReturnType<typeof patchObjects>>,
|
|
||||||
TError,
|
|
||||||
{
|
|
||||||
pathParams: PatchObjectsPathParameters;
|
|
||||||
data: BodyType<AuthtypesPatchableObjectsDTO>;
|
|
||||||
},
|
|
||||||
TContext
|
|
||||||
> => {
|
|
||||||
const mutationOptions = getPatchObjectsMutationOptions(options);
|
|
||||||
|
|
||||||
return useMutation(mutationOptions);
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ import type {
|
|||||||
} from 'react-query';
|
} from 'react-query';
|
||||||
import { useMutation, useQuery } from 'react-query';
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
|
|
||||||
import type {
|
import type {
|
||||||
AuthtypesPostableEmailPasswordSessionDTO,
|
AuthtypesPostableEmailPasswordSessionDTO,
|
||||||
AuthtypesPostableRotateTokenDTO,
|
AuthtypesPostableRotateTokenDTO,
|
||||||
@@ -50,12 +49,12 @@ export const createSessionByGoogleCallback = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateSessionByGoogleCallbackQueryKey = () => {
|
export const getCreateSessionByGoogleCallbackQueryKey = () => {
|
||||||
return [`/api/v1/complete/google`] as const;
|
return ['createSessionByGoogleCallback'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateSessionByGoogleCallbackQueryOptions = <
|
export const getCreateSessionByGoogleCallbackQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
|
TData = Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
|
||||||
TError = ErrorType<CreateSessionByGoogleCallback303 | RenderErrorResponseDTO>
|
TError = CreateSessionByGoogleCallback303 | RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
|
Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
|
||||||
@@ -82,9 +81,9 @@ export const getCreateSessionByGoogleCallbackQueryOptions = <
|
|||||||
export type CreateSessionByGoogleCallbackQueryResult = NonNullable<
|
export type CreateSessionByGoogleCallbackQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof createSessionByGoogleCallback>>
|
Awaited<ReturnType<typeof createSessionByGoogleCallback>>
|
||||||
>;
|
>;
|
||||||
export type CreateSessionByGoogleCallbackQueryError = ErrorType<
|
export type CreateSessionByGoogleCallbackQueryError =
|
||||||
CreateSessionByGoogleCallback303 | RenderErrorResponseDTO
|
| CreateSessionByGoogleCallback303
|
||||||
>;
|
| RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Create session by google callback
|
* @summary Create session by google callback
|
||||||
@@ -92,7 +91,7 @@ export type CreateSessionByGoogleCallbackQueryError = ErrorType<
|
|||||||
|
|
||||||
export function useCreateSessionByGoogleCallback<
|
export function useCreateSessionByGoogleCallback<
|
||||||
TData = Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
|
TData = Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
|
||||||
TError = ErrorType<CreateSessionByGoogleCallback303 | RenderErrorResponseDTO>
|
TError = CreateSessionByGoogleCallback303 | RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
|
Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
|
||||||
@@ -139,12 +138,12 @@ export const createSessionByOIDCCallback = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateSessionByOIDCCallbackQueryKey = () => {
|
export const getCreateSessionByOIDCCallbackQueryKey = () => {
|
||||||
return [`/api/v1/complete/oidc`] as const;
|
return ['createSessionByOIDCCallback'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateSessionByOIDCCallbackQueryOptions = <
|
export const getCreateSessionByOIDCCallbackQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
|
TData = Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
|
||||||
TError = ErrorType<CreateSessionByOIDCCallback303 | RenderErrorResponseDTO>
|
TError = CreateSessionByOIDCCallback303 | RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
|
Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
|
||||||
@@ -171,9 +170,9 @@ export const getCreateSessionByOIDCCallbackQueryOptions = <
|
|||||||
export type CreateSessionByOIDCCallbackQueryResult = NonNullable<
|
export type CreateSessionByOIDCCallbackQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof createSessionByOIDCCallback>>
|
Awaited<ReturnType<typeof createSessionByOIDCCallback>>
|
||||||
>;
|
>;
|
||||||
export type CreateSessionByOIDCCallbackQueryError = ErrorType<
|
export type CreateSessionByOIDCCallbackQueryError =
|
||||||
CreateSessionByOIDCCallback303 | RenderErrorResponseDTO
|
| CreateSessionByOIDCCallback303
|
||||||
>;
|
| RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Create session by oidc callback
|
* @summary Create session by oidc callback
|
||||||
@@ -181,7 +180,7 @@ export type CreateSessionByOIDCCallbackQueryError = ErrorType<
|
|||||||
|
|
||||||
export function useCreateSessionByOIDCCallback<
|
export function useCreateSessionByOIDCCallback<
|
||||||
TData = Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
|
TData = Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
|
||||||
TError = ErrorType<CreateSessionByOIDCCallback303 | RenderErrorResponseDTO>
|
TError = CreateSessionByOIDCCallback303 | RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
|
Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
|
||||||
@@ -220,7 +219,7 @@ export const invalidateCreateSessionByOIDCCallback = async (
|
|||||||
* @summary Create session by saml callback
|
* @summary Create session by saml callback
|
||||||
*/
|
*/
|
||||||
export const createSessionBySAMLCallback = (
|
export const createSessionBySAMLCallback = (
|
||||||
createSessionBySAMLCallbackBody: BodyType<CreateSessionBySAMLCallbackBody>,
|
createSessionBySAMLCallbackBody: CreateSessionBySAMLCallbackBody,
|
||||||
params?: CreateSessionBySAMLCallbackParams,
|
params?: CreateSessionBySAMLCallbackParams,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
@@ -249,14 +248,14 @@ export const createSessionBySAMLCallback = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateSessionBySAMLCallbackMutationOptions = <
|
export const getCreateSessionBySAMLCallbackMutationOptions = <
|
||||||
TError = ErrorType<CreateSessionBySAMLCallback303 | RenderErrorResponseDTO>,
|
TError = CreateSessionBySAMLCallback303 | RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
data: BodyType<CreateSessionBySAMLCallbackBody>;
|
data: CreateSessionBySAMLCallbackBody;
|
||||||
params?: CreateSessionBySAMLCallbackParams;
|
params?: CreateSessionBySAMLCallbackParams;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
@@ -265,7 +264,7 @@ export const getCreateSessionBySAMLCallbackMutationOptions = <
|
|||||||
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
data: BodyType<CreateSessionBySAMLCallbackBody>;
|
data: CreateSessionBySAMLCallbackBody;
|
||||||
params?: CreateSessionBySAMLCallbackParams;
|
params?: CreateSessionBySAMLCallbackParams;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
@@ -282,7 +281,7 @@ export const getCreateSessionBySAMLCallbackMutationOptions = <
|
|||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||||
{
|
{
|
||||||
data: BodyType<CreateSessionBySAMLCallbackBody>;
|
data: CreateSessionBySAMLCallbackBody;
|
||||||
params?: CreateSessionBySAMLCallbackParams;
|
params?: CreateSessionBySAMLCallbackParams;
|
||||||
}
|
}
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
@@ -297,23 +296,23 @@ export const getCreateSessionBySAMLCallbackMutationOptions = <
|
|||||||
export type CreateSessionBySAMLCallbackMutationResult = NonNullable<
|
export type CreateSessionBySAMLCallbackMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof createSessionBySAMLCallback>>
|
Awaited<ReturnType<typeof createSessionBySAMLCallback>>
|
||||||
>;
|
>;
|
||||||
export type CreateSessionBySAMLCallbackMutationBody = BodyType<CreateSessionBySAMLCallbackBody>;
|
export type CreateSessionBySAMLCallbackMutationBody = CreateSessionBySAMLCallbackBody;
|
||||||
export type CreateSessionBySAMLCallbackMutationError = ErrorType<
|
export type CreateSessionBySAMLCallbackMutationError =
|
||||||
CreateSessionBySAMLCallback303 | RenderErrorResponseDTO
|
| CreateSessionBySAMLCallback303
|
||||||
>;
|
| RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Create session by saml callback
|
* @summary Create session by saml callback
|
||||||
*/
|
*/
|
||||||
export const useCreateSessionBySAMLCallback = <
|
export const useCreateSessionBySAMLCallback = <
|
||||||
TError = ErrorType<CreateSessionBySAMLCallback303 | RenderErrorResponseDTO>,
|
TError = CreateSessionBySAMLCallback303 | RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
data: BodyType<CreateSessionBySAMLCallbackBody>;
|
data: CreateSessionBySAMLCallbackBody;
|
||||||
params?: CreateSessionBySAMLCallbackParams;
|
params?: CreateSessionBySAMLCallbackParams;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
@@ -322,7 +321,7 @@ export const useCreateSessionBySAMLCallback = <
|
|||||||
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
data: BodyType<CreateSessionBySAMLCallbackBody>;
|
data: CreateSessionBySAMLCallbackBody;
|
||||||
params?: CreateSessionBySAMLCallbackParams;
|
params?: CreateSessionBySAMLCallbackParams;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
@@ -343,7 +342,7 @@ export const deleteSession = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getDeleteSessionMutationOptions = <
|
export const getDeleteSessionMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -381,13 +380,13 @@ export type DeleteSessionMutationResult = NonNullable<
|
|||||||
Awaited<ReturnType<typeof deleteSession>>
|
Awaited<ReturnType<typeof deleteSession>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type DeleteSessionMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type DeleteSessionMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Delete session
|
* @summary Delete session
|
||||||
*/
|
*/
|
||||||
export const useDeleteSession = <
|
export const useDeleteSession = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -419,12 +418,12 @@ export const getSessionContext = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getGetSessionContextQueryKey = () => {
|
export const getGetSessionContextQueryKey = () => {
|
||||||
return [`/api/v2/sessions/context`] as const;
|
return ['getSessionContext'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetSessionContextQueryOptions = <
|
export const getGetSessionContextQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getSessionContext>>,
|
TData = Awaited<ReturnType<typeof getSessionContext>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof getSessionContext>>,
|
Awaited<ReturnType<typeof getSessionContext>>,
|
||||||
@@ -450,7 +449,7 @@ export const getGetSessionContextQueryOptions = <
|
|||||||
export type GetSessionContextQueryResult = NonNullable<
|
export type GetSessionContextQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getSessionContext>>
|
Awaited<ReturnType<typeof getSessionContext>>
|
||||||
>;
|
>;
|
||||||
export type GetSessionContextQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetSessionContextQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get session context
|
* @summary Get session context
|
||||||
@@ -458,7 +457,7 @@ export type GetSessionContextQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetSessionContext<
|
export function useGetSessionContext<
|
||||||
TData = Awaited<ReturnType<typeof getSessionContext>>,
|
TData = Awaited<ReturnType<typeof getSessionContext>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof getSessionContext>>,
|
Awaited<ReturnType<typeof getSessionContext>>,
|
||||||
@@ -497,7 +496,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: BodyType<AuthtypesPostableEmailPasswordSessionDTO>,
|
authtypesPostableEmailPasswordSessionDTO: AuthtypesPostableEmailPasswordSessionDTO,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<CreateSessionByEmailPassword200>({
|
return GeneratedAPIInstance<CreateSessionByEmailPassword200>({
|
||||||
@@ -510,19 +509,19 @@ export const createSessionByEmailPassword = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateSessionByEmailPasswordMutationOptions = <
|
export const getCreateSessionByEmailPasswordMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
|
{ data: AuthtypesPostableEmailPasswordSessionDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
|
{ data: AuthtypesPostableEmailPasswordSessionDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['createSessionByEmailPassword'];
|
const mutationKey = ['createSessionByEmailPassword'];
|
||||||
@@ -536,7 +535,7 @@ export const getCreateSessionByEmailPasswordMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||||
{ data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> }
|
{ data: AuthtypesPostableEmailPasswordSessionDTO }
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
@@ -549,26 +548,26 @@ export const getCreateSessionByEmailPasswordMutationOptions = <
|
|||||||
export type CreateSessionByEmailPasswordMutationResult = NonNullable<
|
export type CreateSessionByEmailPasswordMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof createSessionByEmailPassword>>
|
Awaited<ReturnType<typeof createSessionByEmailPassword>>
|
||||||
>;
|
>;
|
||||||
export type CreateSessionByEmailPasswordMutationBody = BodyType<AuthtypesPostableEmailPasswordSessionDTO>;
|
export type CreateSessionByEmailPasswordMutationBody = AuthtypesPostableEmailPasswordSessionDTO;
|
||||||
export type CreateSessionByEmailPasswordMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type CreateSessionByEmailPasswordMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Create session by email and password
|
* @summary Create session by email and password
|
||||||
*/
|
*/
|
||||||
export const useCreateSessionByEmailPassword = <
|
export const useCreateSessionByEmailPassword = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
|
{ data: AuthtypesPostableEmailPasswordSessionDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
|
{ data: AuthtypesPostableEmailPasswordSessionDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getCreateSessionByEmailPasswordMutationOptions(
|
const mutationOptions = getCreateSessionByEmailPasswordMutationOptions(
|
||||||
@@ -582,7 +581,7 @@ export const useCreateSessionByEmailPassword = <
|
|||||||
* @summary Rotate session
|
* @summary Rotate session
|
||||||
*/
|
*/
|
||||||
export const rotateSession = (
|
export const rotateSession = (
|
||||||
authtypesPostableRotateTokenDTO: BodyType<AuthtypesPostableRotateTokenDTO>,
|
authtypesPostableRotateTokenDTO: AuthtypesPostableRotateTokenDTO,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<RotateSession200>({
|
return GeneratedAPIInstance<RotateSession200>({
|
||||||
@@ -595,19 +594,19 @@ export const rotateSession = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getRotateSessionMutationOptions = <
|
export const getRotateSessionMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof rotateSession>>,
|
Awaited<ReturnType<typeof rotateSession>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<AuthtypesPostableRotateTokenDTO> },
|
{ data: AuthtypesPostableRotateTokenDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof rotateSession>>,
|
Awaited<ReturnType<typeof rotateSession>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<AuthtypesPostableRotateTokenDTO> },
|
{ data: AuthtypesPostableRotateTokenDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['rotateSession'];
|
const mutationKey = ['rotateSession'];
|
||||||
@@ -621,7 +620,7 @@ export const getRotateSessionMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof rotateSession>>,
|
Awaited<ReturnType<typeof rotateSession>>,
|
||||||
{ data: BodyType<AuthtypesPostableRotateTokenDTO> }
|
{ data: AuthtypesPostableRotateTokenDTO }
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
@@ -634,26 +633,26 @@ export const getRotateSessionMutationOptions = <
|
|||||||
export type RotateSessionMutationResult = NonNullable<
|
export type RotateSessionMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof rotateSession>>
|
Awaited<ReturnType<typeof rotateSession>>
|
||||||
>;
|
>;
|
||||||
export type RotateSessionMutationBody = BodyType<AuthtypesPostableRotateTokenDTO>;
|
export type RotateSessionMutationBody = AuthtypesPostableRotateTokenDTO;
|
||||||
export type RotateSessionMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type RotateSessionMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Rotate session
|
* @summary Rotate session
|
||||||
*/
|
*/
|
||||||
export const useRotateSession = <
|
export const useRotateSession = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof rotateSession>>,
|
Awaited<ReturnType<typeof rotateSession>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<AuthtypesPostableRotateTokenDTO> },
|
{ data: AuthtypesPostableRotateTokenDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof rotateSession>>,
|
Awaited<ReturnType<typeof rotateSession>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<AuthtypesPostableRotateTokenDTO> },
|
{ data: AuthtypesPostableRotateTokenDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getRotateSessionMutationOptions(options);
|
const mutationOptions = getRotateSessionMutationOptions(options);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -17,8 +17,7 @@ import type {
|
|||||||
} from 'react-query';
|
} from 'react-query';
|
||||||
import { useMutation, useQuery } from 'react-query';
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
|
|
||||||
import type {
|
import type {
|
||||||
AcceptInvite201,
|
AcceptInvite201,
|
||||||
ChangePasswordPathParameters,
|
ChangePasswordPathParameters,
|
||||||
@@ -61,7 +60,7 @@ type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|||||||
*/
|
*/
|
||||||
export const changePassword = (
|
export const changePassword = (
|
||||||
{ id }: ChangePasswordPathParameters,
|
{ id }: ChangePasswordPathParameters,
|
||||||
typesChangePasswordRequestDTO: BodyType<TypesChangePasswordRequestDTO>,
|
typesChangePasswordRequestDTO: TypesChangePasswordRequestDTO,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<void>({
|
return GeneratedAPIInstance<void>({
|
||||||
@@ -74,7 +73,7 @@ export const changePassword = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getChangePasswordMutationOptions = <
|
export const getChangePasswordMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -82,7 +81,7 @@ export const getChangePasswordMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: ChangePasswordPathParameters;
|
pathParams: ChangePasswordPathParameters;
|
||||||
data: BodyType<TypesChangePasswordRequestDTO>;
|
data: TypesChangePasswordRequestDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -91,7 +90,7 @@ export const getChangePasswordMutationOptions = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: ChangePasswordPathParameters;
|
pathParams: ChangePasswordPathParameters;
|
||||||
data: BodyType<TypesChangePasswordRequestDTO>;
|
data: TypesChangePasswordRequestDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -108,7 +107,7 @@ export const getChangePasswordMutationOptions = <
|
|||||||
Awaited<ReturnType<typeof changePassword>>,
|
Awaited<ReturnType<typeof changePassword>>,
|
||||||
{
|
{
|
||||||
pathParams: ChangePasswordPathParameters;
|
pathParams: ChangePasswordPathParameters;
|
||||||
data: BodyType<TypesChangePasswordRequestDTO>;
|
data: TypesChangePasswordRequestDTO;
|
||||||
}
|
}
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { pathParams, data } = props ?? {};
|
const { pathParams, data } = props ?? {};
|
||||||
@@ -122,14 +121,14 @@ export const getChangePasswordMutationOptions = <
|
|||||||
export type ChangePasswordMutationResult = NonNullable<
|
export type ChangePasswordMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof changePassword>>
|
Awaited<ReturnType<typeof changePassword>>
|
||||||
>;
|
>;
|
||||||
export type ChangePasswordMutationBody = BodyType<TypesChangePasswordRequestDTO>;
|
export type ChangePasswordMutationBody = TypesChangePasswordRequestDTO;
|
||||||
export type ChangePasswordMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type ChangePasswordMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Change password
|
* @summary Change password
|
||||||
*/
|
*/
|
||||||
export const useChangePassword = <
|
export const useChangePassword = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -137,7 +136,7 @@ export const useChangePassword = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: ChangePasswordPathParameters;
|
pathParams: ChangePasswordPathParameters;
|
||||||
data: BodyType<TypesChangePasswordRequestDTO>;
|
data: TypesChangePasswordRequestDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
@@ -146,7 +145,7 @@ export const useChangePassword = <
|
|||||||
TError,
|
TError,
|
||||||
{
|
{
|
||||||
pathParams: ChangePasswordPathParameters;
|
pathParams: ChangePasswordPathParameters;
|
||||||
data: BodyType<TypesChangePasswordRequestDTO>;
|
data: TypesChangePasswordRequestDTO;
|
||||||
},
|
},
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
@@ -172,12 +171,12 @@ export const getResetPasswordToken = (
|
|||||||
export const getGetResetPasswordTokenQueryKey = ({
|
export const getGetResetPasswordTokenQueryKey = ({
|
||||||
id,
|
id,
|
||||||
}: GetResetPasswordTokenPathParameters) => {
|
}: GetResetPasswordTokenPathParameters) => {
|
||||||
return [`/api/v1/getResetPasswordToken/${id}`] as const;
|
return ['getResetPasswordToken'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetResetPasswordTokenQueryOptions = <
|
export const getGetResetPasswordTokenQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getResetPasswordToken>>,
|
TData = Awaited<ReturnType<typeof getResetPasswordToken>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ id }: GetResetPasswordTokenPathParameters,
|
{ id }: GetResetPasswordTokenPathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -212,7 +211,7 @@ export const getGetResetPasswordTokenQueryOptions = <
|
|||||||
export type GetResetPasswordTokenQueryResult = NonNullable<
|
export type GetResetPasswordTokenQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getResetPasswordToken>>
|
Awaited<ReturnType<typeof getResetPasswordToken>>
|
||||||
>;
|
>;
|
||||||
export type GetResetPasswordTokenQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetResetPasswordTokenQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get reset password token
|
* @summary Get reset password token
|
||||||
@@ -220,7 +219,7 @@ export type GetResetPasswordTokenQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetResetPasswordToken<
|
export function useGetResetPasswordToken<
|
||||||
TData = Awaited<ReturnType<typeof getResetPasswordToken>>,
|
TData = Awaited<ReturnType<typeof getResetPasswordToken>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ id }: GetResetPasswordTokenPathParameters,
|
{ id }: GetResetPasswordTokenPathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -271,12 +270,12 @@ export const listInvite = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getListInviteQueryKey = () => {
|
export const getListInviteQueryKey = () => {
|
||||||
return [`/api/v1/invite`] as const;
|
return ['listInvite'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getListInviteQueryOptions = <
|
export const getListInviteQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof listInvite>>,
|
TData = Awaited<ReturnType<typeof listInvite>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<Awaited<ReturnType<typeof listInvite>>, TError, TData>;
|
query?: UseQueryOptions<Awaited<ReturnType<typeof listInvite>>, TError, TData>;
|
||||||
}) => {
|
}) => {
|
||||||
@@ -298,7 +297,7 @@ export const getListInviteQueryOptions = <
|
|||||||
export type ListInviteQueryResult = NonNullable<
|
export type ListInviteQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof listInvite>>
|
Awaited<ReturnType<typeof listInvite>>
|
||||||
>;
|
>;
|
||||||
export type ListInviteQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type ListInviteQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary List invites
|
* @summary List invites
|
||||||
@@ -306,7 +305,7 @@ export type ListInviteQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useListInvite<
|
export function useListInvite<
|
||||||
TData = Awaited<ReturnType<typeof listInvite>>,
|
TData = Awaited<ReturnType<typeof listInvite>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = 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 } {
|
||||||
@@ -341,7 +340,7 @@ export const invalidateListInvite = async (
|
|||||||
* @summary Create invite
|
* @summary Create invite
|
||||||
*/
|
*/
|
||||||
export const createInvite = (
|
export const createInvite = (
|
||||||
typesPostableInviteDTO: BodyType<TypesPostableInviteDTO>,
|
typesPostableInviteDTO: TypesPostableInviteDTO,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<CreateInvite201>({
|
return GeneratedAPIInstance<CreateInvite201>({
|
||||||
@@ -354,19 +353,19 @@ export const createInvite = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateInviteMutationOptions = <
|
export const getCreateInviteMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createInvite>>,
|
Awaited<ReturnType<typeof createInvite>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableInviteDTO> },
|
{ data: TypesPostableInviteDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createInvite>>,
|
Awaited<ReturnType<typeof createInvite>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableInviteDTO> },
|
{ data: TypesPostableInviteDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['createInvite'];
|
const mutationKey = ['createInvite'];
|
||||||
@@ -380,7 +379,7 @@ export const getCreateInviteMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof createInvite>>,
|
Awaited<ReturnType<typeof createInvite>>,
|
||||||
{ data: BodyType<TypesPostableInviteDTO> }
|
{ data: TypesPostableInviteDTO }
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
@@ -393,26 +392,26 @@ export const getCreateInviteMutationOptions = <
|
|||||||
export type CreateInviteMutationResult = NonNullable<
|
export type CreateInviteMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof createInvite>>
|
Awaited<ReturnType<typeof createInvite>>
|
||||||
>;
|
>;
|
||||||
export type CreateInviteMutationBody = BodyType<TypesPostableInviteDTO>;
|
export type CreateInviteMutationBody = TypesPostableInviteDTO;
|
||||||
export type CreateInviteMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type CreateInviteMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Create invite
|
* @summary Create invite
|
||||||
*/
|
*/
|
||||||
export const useCreateInvite = <
|
export const useCreateInvite = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createInvite>>,
|
Awaited<ReturnType<typeof createInvite>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableInviteDTO> },
|
{ data: TypesPostableInviteDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof createInvite>>,
|
Awaited<ReturnType<typeof createInvite>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableInviteDTO> },
|
{ data: TypesPostableInviteDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getCreateInviteMutationOptions(options);
|
const mutationOptions = getCreateInviteMutationOptions(options);
|
||||||
@@ -431,7 +430,7 @@ export const deleteInvite = ({ id }: DeleteInvitePathParameters) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getDeleteInviteMutationOptions = <
|
export const getDeleteInviteMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -471,13 +470,13 @@ export type DeleteInviteMutationResult = NonNullable<
|
|||||||
Awaited<ReturnType<typeof deleteInvite>>
|
Awaited<ReturnType<typeof deleteInvite>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type DeleteInviteMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type DeleteInviteMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Delete invite
|
* @summary Delete invite
|
||||||
*/
|
*/
|
||||||
export const useDeleteInvite = <
|
export const useDeleteInvite = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -512,12 +511,12 @@ export const getInvite = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getGetInviteQueryKey = ({ token }: GetInvitePathParameters) => {
|
export const getGetInviteQueryKey = ({ token }: GetInvitePathParameters) => {
|
||||||
return [`/api/v1/invite/${token}`] as const;
|
return ['getInvite'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetInviteQueryOptions = <
|
export const getGetInviteQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getInvite>>,
|
TData = Awaited<ReturnType<typeof getInvite>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ token }: GetInvitePathParameters,
|
{ token }: GetInvitePathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -545,7 +544,7 @@ export const getGetInviteQueryOptions = <
|
|||||||
export type GetInviteQueryResult = NonNullable<
|
export type GetInviteQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getInvite>>
|
Awaited<ReturnType<typeof getInvite>>
|
||||||
>;
|
>;
|
||||||
export type GetInviteQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetInviteQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get invite
|
* @summary Get invite
|
||||||
@@ -553,7 +552,7 @@ export type GetInviteQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetInvite<
|
export function useGetInvite<
|
||||||
TData = Awaited<ReturnType<typeof getInvite>>,
|
TData = Awaited<ReturnType<typeof getInvite>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ token }: GetInvitePathParameters,
|
{ token }: GetInvitePathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -592,7 +591,7 @@ export const invalidateGetInvite = async (
|
|||||||
* @summary Accept invite
|
* @summary Accept invite
|
||||||
*/
|
*/
|
||||||
export const acceptInvite = (
|
export const acceptInvite = (
|
||||||
typesPostableAcceptInviteDTO: BodyType<TypesPostableAcceptInviteDTO>,
|
typesPostableAcceptInviteDTO: TypesPostableAcceptInviteDTO,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<AcceptInvite201>({
|
return GeneratedAPIInstance<AcceptInvite201>({
|
||||||
@@ -605,19 +604,19 @@ export const acceptInvite = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getAcceptInviteMutationOptions = <
|
export const getAcceptInviteMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof acceptInvite>>,
|
Awaited<ReturnType<typeof acceptInvite>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableAcceptInviteDTO> },
|
{ data: TypesPostableAcceptInviteDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof acceptInvite>>,
|
Awaited<ReturnType<typeof acceptInvite>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableAcceptInviteDTO> },
|
{ data: TypesPostableAcceptInviteDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['acceptInvite'];
|
const mutationKey = ['acceptInvite'];
|
||||||
@@ -631,7 +630,7 @@ export const getAcceptInviteMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof acceptInvite>>,
|
Awaited<ReturnType<typeof acceptInvite>>,
|
||||||
{ data: BodyType<TypesPostableAcceptInviteDTO> }
|
{ data: TypesPostableAcceptInviteDTO }
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
@@ -644,26 +643,26 @@ export const getAcceptInviteMutationOptions = <
|
|||||||
export type AcceptInviteMutationResult = NonNullable<
|
export type AcceptInviteMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof acceptInvite>>
|
Awaited<ReturnType<typeof acceptInvite>>
|
||||||
>;
|
>;
|
||||||
export type AcceptInviteMutationBody = BodyType<TypesPostableAcceptInviteDTO>;
|
export type AcceptInviteMutationBody = TypesPostableAcceptInviteDTO;
|
||||||
export type AcceptInviteMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type AcceptInviteMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Accept invite
|
* @summary Accept invite
|
||||||
*/
|
*/
|
||||||
export const useAcceptInvite = <
|
export const useAcceptInvite = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof acceptInvite>>,
|
Awaited<ReturnType<typeof acceptInvite>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableAcceptInviteDTO> },
|
{ data: TypesPostableAcceptInviteDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof acceptInvite>>,
|
Awaited<ReturnType<typeof acceptInvite>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableAcceptInviteDTO> },
|
{ data: TypesPostableAcceptInviteDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getAcceptInviteMutationOptions(options);
|
const mutationOptions = getAcceptInviteMutationOptions(options);
|
||||||
@@ -675,7 +674,7 @@ export const useAcceptInvite = <
|
|||||||
* @summary Create bulk invite
|
* @summary Create bulk invite
|
||||||
*/
|
*/
|
||||||
export const createBulkInvite = (
|
export const createBulkInvite = (
|
||||||
typesPostableInviteDTO: BodyType<TypesPostableInviteDTO[]>,
|
typesPostableInviteDTO: TypesPostableInviteDTO[],
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<void>({
|
return GeneratedAPIInstance<void>({
|
||||||
@@ -688,19 +687,19 @@ export const createBulkInvite = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateBulkInviteMutationOptions = <
|
export const getCreateBulkInviteMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createBulkInvite>>,
|
Awaited<ReturnType<typeof createBulkInvite>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableInviteDTO[]> },
|
{ data: TypesPostableInviteDTO[] },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createBulkInvite>>,
|
Awaited<ReturnType<typeof createBulkInvite>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableInviteDTO[]> },
|
{ data: TypesPostableInviteDTO[] },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['createBulkInvite'];
|
const mutationKey = ['createBulkInvite'];
|
||||||
@@ -714,7 +713,7 @@ export const getCreateBulkInviteMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof createBulkInvite>>,
|
Awaited<ReturnType<typeof createBulkInvite>>,
|
||||||
{ data: BodyType<TypesPostableInviteDTO[]> }
|
{ data: TypesPostableInviteDTO[] }
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
@@ -727,26 +726,26 @@ export const getCreateBulkInviteMutationOptions = <
|
|||||||
export type CreateBulkInviteMutationResult = NonNullable<
|
export type CreateBulkInviteMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof createBulkInvite>>
|
Awaited<ReturnType<typeof createBulkInvite>>
|
||||||
>;
|
>;
|
||||||
export type CreateBulkInviteMutationBody = BodyType<TypesPostableInviteDTO[]>;
|
export type CreateBulkInviteMutationBody = TypesPostableInviteDTO[];
|
||||||
export type CreateBulkInviteMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type CreateBulkInviteMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Create bulk invite
|
* @summary Create bulk invite
|
||||||
*/
|
*/
|
||||||
export const useCreateBulkInvite = <
|
export const useCreateBulkInvite = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createBulkInvite>>,
|
Awaited<ReturnType<typeof createBulkInvite>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableInviteDTO[]> },
|
{ data: TypesPostableInviteDTO[] },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof createBulkInvite>>,
|
Awaited<ReturnType<typeof createBulkInvite>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableInviteDTO[]> },
|
{ data: TypesPostableInviteDTO[] },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getCreateBulkInviteMutationOptions(options);
|
const mutationOptions = getCreateBulkInviteMutationOptions(options);
|
||||||
@@ -766,12 +765,12 @@ export const listAPIKeys = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getListAPIKeysQueryKey = () => {
|
export const getListAPIKeysQueryKey = () => {
|
||||||
return [`/api/v1/pats`] as const;
|
return ['listAPIKeys'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getListAPIKeysQueryOptions = <
|
export const getListAPIKeysQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof listAPIKeys>>,
|
TData = Awaited<ReturnType<typeof listAPIKeys>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof listAPIKeys>>,
|
Awaited<ReturnType<typeof listAPIKeys>>,
|
||||||
@@ -797,7 +796,7 @@ export const getListAPIKeysQueryOptions = <
|
|||||||
export type ListAPIKeysQueryResult = NonNullable<
|
export type ListAPIKeysQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof listAPIKeys>>
|
Awaited<ReturnType<typeof listAPIKeys>>
|
||||||
>;
|
>;
|
||||||
export type ListAPIKeysQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type ListAPIKeysQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary List api keys
|
* @summary List api keys
|
||||||
@@ -805,7 +804,7 @@ export type ListAPIKeysQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useListAPIKeys<
|
export function useListAPIKeys<
|
||||||
TData = Awaited<ReturnType<typeof listAPIKeys>>,
|
TData = Awaited<ReturnType<typeof listAPIKeys>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<
|
query?: UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof listAPIKeys>>,
|
Awaited<ReturnType<typeof listAPIKeys>>,
|
||||||
@@ -844,7 +843,7 @@ export const invalidateListAPIKeys = async (
|
|||||||
* @summary Create api key
|
* @summary Create api key
|
||||||
*/
|
*/
|
||||||
export const createAPIKey = (
|
export const createAPIKey = (
|
||||||
typesPostableAPIKeyDTO: BodyType<TypesPostableAPIKeyDTO>,
|
typesPostableAPIKeyDTO: TypesPostableAPIKeyDTO,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<CreateAPIKey201>({
|
return GeneratedAPIInstance<CreateAPIKey201>({
|
||||||
@@ -857,19 +856,19 @@ export const createAPIKey = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateAPIKeyMutationOptions = <
|
export const getCreateAPIKeyMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createAPIKey>>,
|
Awaited<ReturnType<typeof createAPIKey>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableAPIKeyDTO> },
|
{ data: TypesPostableAPIKeyDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createAPIKey>>,
|
Awaited<ReturnType<typeof createAPIKey>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableAPIKeyDTO> },
|
{ data: TypesPostableAPIKeyDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['createAPIKey'];
|
const mutationKey = ['createAPIKey'];
|
||||||
@@ -883,7 +882,7 @@ export const getCreateAPIKeyMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof createAPIKey>>,
|
Awaited<ReturnType<typeof createAPIKey>>,
|
||||||
{ data: BodyType<TypesPostableAPIKeyDTO> }
|
{ data: TypesPostableAPIKeyDTO }
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
@@ -896,26 +895,26 @@ export const getCreateAPIKeyMutationOptions = <
|
|||||||
export type CreateAPIKeyMutationResult = NonNullable<
|
export type CreateAPIKeyMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof createAPIKey>>
|
Awaited<ReturnType<typeof createAPIKey>>
|
||||||
>;
|
>;
|
||||||
export type CreateAPIKeyMutationBody = BodyType<TypesPostableAPIKeyDTO>;
|
export type CreateAPIKeyMutationBody = TypesPostableAPIKeyDTO;
|
||||||
export type CreateAPIKeyMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type CreateAPIKeyMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Create api key
|
* @summary Create api key
|
||||||
*/
|
*/
|
||||||
export const useCreateAPIKey = <
|
export const useCreateAPIKey = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createAPIKey>>,
|
Awaited<ReturnType<typeof createAPIKey>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableAPIKeyDTO> },
|
{ data: TypesPostableAPIKeyDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof createAPIKey>>,
|
Awaited<ReturnType<typeof createAPIKey>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableAPIKeyDTO> },
|
{ data: TypesPostableAPIKeyDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getCreateAPIKeyMutationOptions(options);
|
const mutationOptions = getCreateAPIKeyMutationOptions(options);
|
||||||
@@ -934,7 +933,7 @@ export const revokeAPIKey = ({ id }: RevokeAPIKeyPathParameters) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getRevokeAPIKeyMutationOptions = <
|
export const getRevokeAPIKeyMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -974,13 +973,13 @@ export type RevokeAPIKeyMutationResult = NonNullable<
|
|||||||
Awaited<ReturnType<typeof revokeAPIKey>>
|
Awaited<ReturnType<typeof revokeAPIKey>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type RevokeAPIKeyMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type RevokeAPIKeyMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Revoke api key
|
* @summary Revoke api key
|
||||||
*/
|
*/
|
||||||
export const useRevokeAPIKey = <
|
export const useRevokeAPIKey = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -1005,7 +1004,7 @@ export const useRevokeAPIKey = <
|
|||||||
*/
|
*/
|
||||||
export const updateAPIKey = (
|
export const updateAPIKey = (
|
||||||
{ id }: UpdateAPIKeyPathParameters,
|
{ id }: UpdateAPIKeyPathParameters,
|
||||||
typesStorableAPIKeyDTO: BodyType<TypesStorableAPIKeyDTO>,
|
typesStorableAPIKeyDTO: TypesStorableAPIKeyDTO,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<string>({
|
return GeneratedAPIInstance<string>({
|
||||||
url: `/api/v1/pats/${id}`,
|
url: `/api/v1/pats/${id}`,
|
||||||
@@ -1016,25 +1015,19 @@ export const updateAPIKey = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getUpdateAPIKeyMutationOptions = <
|
export const getUpdateAPIKeyMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = 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'];
|
||||||
@@ -1048,10 +1041,7 @@ 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 ?? {};
|
||||||
|
|
||||||
@@ -1064,32 +1054,26 @@ export const getUpdateAPIKeyMutationOptions = <
|
|||||||
export type UpdateAPIKeyMutationResult = NonNullable<
|
export type UpdateAPIKeyMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof updateAPIKey>>
|
Awaited<ReturnType<typeof updateAPIKey>>
|
||||||
>;
|
>;
|
||||||
export type UpdateAPIKeyMutationBody = BodyType<TypesStorableAPIKeyDTO>;
|
export type UpdateAPIKeyMutationBody = TypesStorableAPIKeyDTO;
|
||||||
export type UpdateAPIKeyMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type UpdateAPIKeyMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Update api key
|
* @summary Update api key
|
||||||
*/
|
*/
|
||||||
export const useUpdateAPIKey = <
|
export const useUpdateAPIKey = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = 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);
|
||||||
@@ -1101,7 +1085,7 @@ export const useUpdateAPIKey = <
|
|||||||
* @summary Reset password
|
* @summary Reset password
|
||||||
*/
|
*/
|
||||||
export const resetPassword = (
|
export const resetPassword = (
|
||||||
typesPostableResetPasswordDTO: BodyType<TypesPostableResetPasswordDTO>,
|
typesPostableResetPasswordDTO: TypesPostableResetPasswordDTO,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<void>({
|
return GeneratedAPIInstance<void>({
|
||||||
@@ -1114,19 +1098,19 @@ export const resetPassword = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getResetPasswordMutationOptions = <
|
export const getResetPasswordMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof resetPassword>>,
|
Awaited<ReturnType<typeof resetPassword>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableResetPasswordDTO> },
|
{ data: TypesPostableResetPasswordDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof resetPassword>>,
|
Awaited<ReturnType<typeof resetPassword>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableResetPasswordDTO> },
|
{ data: TypesPostableResetPasswordDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['resetPassword'];
|
const mutationKey = ['resetPassword'];
|
||||||
@@ -1140,7 +1124,7 @@ export const getResetPasswordMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof resetPassword>>,
|
Awaited<ReturnType<typeof resetPassword>>,
|
||||||
{ data: BodyType<TypesPostableResetPasswordDTO> }
|
{ data: TypesPostableResetPasswordDTO }
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
@@ -1153,26 +1137,26 @@ export const getResetPasswordMutationOptions = <
|
|||||||
export type ResetPasswordMutationResult = NonNullable<
|
export type ResetPasswordMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof resetPassword>>
|
Awaited<ReturnType<typeof resetPassword>>
|
||||||
>;
|
>;
|
||||||
export type ResetPasswordMutationBody = BodyType<TypesPostableResetPasswordDTO>;
|
export type ResetPasswordMutationBody = TypesPostableResetPasswordDTO;
|
||||||
export type ResetPasswordMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type ResetPasswordMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Reset password
|
* @summary Reset password
|
||||||
*/
|
*/
|
||||||
export const useResetPassword = <
|
export const useResetPassword = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof resetPassword>>,
|
Awaited<ReturnType<typeof resetPassword>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableResetPasswordDTO> },
|
{ data: TypesPostableResetPasswordDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof resetPassword>>,
|
Awaited<ReturnType<typeof resetPassword>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableResetPasswordDTO> },
|
{ data: TypesPostableResetPasswordDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getResetPasswordMutationOptions(options);
|
const mutationOptions = getResetPasswordMutationOptions(options);
|
||||||
@@ -1192,12 +1176,12 @@ export const listUsers = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getListUsersQueryKey = () => {
|
export const getListUsersQueryKey = () => {
|
||||||
return [`/api/v1/user`] as const;
|
return ['listUsers'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getListUsersQueryOptions = <
|
export const getListUsersQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof listUsers>>,
|
TData = Awaited<ReturnType<typeof listUsers>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<Awaited<ReturnType<typeof listUsers>>, TError, TData>;
|
query?: UseQueryOptions<Awaited<ReturnType<typeof listUsers>>, TError, TData>;
|
||||||
}) => {
|
}) => {
|
||||||
@@ -1219,7 +1203,7 @@ export const getListUsersQueryOptions = <
|
|||||||
export type ListUsersQueryResult = NonNullable<
|
export type ListUsersQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof listUsers>>
|
Awaited<ReturnType<typeof listUsers>>
|
||||||
>;
|
>;
|
||||||
export type ListUsersQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type ListUsersQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary List users
|
* @summary List users
|
||||||
@@ -1227,7 +1211,7 @@ export type ListUsersQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useListUsers<
|
export function useListUsers<
|
||||||
TData = Awaited<ReturnType<typeof listUsers>>,
|
TData = Awaited<ReturnType<typeof listUsers>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = 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 } {
|
||||||
@@ -1269,7 +1253,7 @@ export const deleteUser = ({ id }: DeleteUserPathParameters) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getDeleteUserMutationOptions = <
|
export const getDeleteUserMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -1309,13 +1293,13 @@ export type DeleteUserMutationResult = NonNullable<
|
|||||||
Awaited<ReturnType<typeof deleteUser>>
|
Awaited<ReturnType<typeof deleteUser>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type DeleteUserMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type DeleteUserMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Delete user
|
* @summary Delete user
|
||||||
*/
|
*/
|
||||||
export const useDeleteUser = <
|
export const useDeleteUser = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
@@ -1350,12 +1334,12 @@ export const getUser = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getGetUserQueryKey = ({ id }: GetUserPathParameters) => {
|
export const getGetUserQueryKey = ({ id }: GetUserPathParameters) => {
|
||||||
return [`/api/v1/user/${id}`] as const;
|
return ['getUser'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetUserQueryOptions = <
|
export const getGetUserQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getUser>>,
|
TData = Awaited<ReturnType<typeof getUser>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ id }: GetUserPathParameters,
|
{ id }: GetUserPathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -1383,7 +1367,7 @@ export const getGetUserQueryOptions = <
|
|||||||
export type GetUserQueryResult = NonNullable<
|
export type GetUserQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getUser>>
|
Awaited<ReturnType<typeof getUser>>
|
||||||
>;
|
>;
|
||||||
export type GetUserQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetUserQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get user
|
* @summary Get user
|
||||||
@@ -1391,7 +1375,7 @@ export type GetUserQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetUser<
|
export function useGetUser<
|
||||||
TData = Awaited<ReturnType<typeof getUser>>,
|
TData = Awaited<ReturnType<typeof getUser>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(
|
>(
|
||||||
{ id }: GetUserPathParameters,
|
{ id }: GetUserPathParameters,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -1431,7 +1415,7 @@ export const invalidateGetUser = async (
|
|||||||
*/
|
*/
|
||||||
export const updateUser = (
|
export const updateUser = (
|
||||||
{ id }: UpdateUserPathParameters,
|
{ id }: UpdateUserPathParameters,
|
||||||
typesUserDTO: BodyType<TypesUserDTO>,
|
typesUserDTO: TypesUserDTO,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<UpdateUser200>({
|
return GeneratedAPIInstance<UpdateUser200>({
|
||||||
url: `/api/v1/user/${id}`,
|
url: `/api/v1/user/${id}`,
|
||||||
@@ -1442,19 +1426,19 @@ export const updateUser = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getUpdateUserMutationOptions = <
|
export const getUpdateUserMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof updateUser>>,
|
Awaited<ReturnType<typeof updateUser>>,
|
||||||
TError,
|
TError,
|
||||||
{ pathParams: UpdateUserPathParameters; data: BodyType<TypesUserDTO> },
|
{ pathParams: UpdateUserPathParameters; data: TypesUserDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof updateUser>>,
|
Awaited<ReturnType<typeof updateUser>>,
|
||||||
TError,
|
TError,
|
||||||
{ pathParams: UpdateUserPathParameters; data: BodyType<TypesUserDTO> },
|
{ pathParams: UpdateUserPathParameters; data: TypesUserDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['updateUser'];
|
const mutationKey = ['updateUser'];
|
||||||
@@ -1468,7 +1452,7 @@ export const getUpdateUserMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof updateUser>>,
|
Awaited<ReturnType<typeof updateUser>>,
|
||||||
{ pathParams: UpdateUserPathParameters; data: BodyType<TypesUserDTO> }
|
{ pathParams: UpdateUserPathParameters; data: TypesUserDTO }
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { pathParams, data } = props ?? {};
|
const { pathParams, data } = props ?? {};
|
||||||
|
|
||||||
@@ -1481,26 +1465,26 @@ export const getUpdateUserMutationOptions = <
|
|||||||
export type UpdateUserMutationResult = NonNullable<
|
export type UpdateUserMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof updateUser>>
|
Awaited<ReturnType<typeof updateUser>>
|
||||||
>;
|
>;
|
||||||
export type UpdateUserMutationBody = BodyType<TypesUserDTO>;
|
export type UpdateUserMutationBody = TypesUserDTO;
|
||||||
export type UpdateUserMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type UpdateUserMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Update user
|
* @summary Update user
|
||||||
*/
|
*/
|
||||||
export const useUpdateUser = <
|
export const useUpdateUser = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof updateUser>>,
|
Awaited<ReturnType<typeof updateUser>>,
|
||||||
TError,
|
TError,
|
||||||
{ pathParams: UpdateUserPathParameters; data: BodyType<TypesUserDTO> },
|
{ pathParams: UpdateUserPathParameters; data: TypesUserDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof updateUser>>,
|
Awaited<ReturnType<typeof updateUser>>,
|
||||||
TError,
|
TError,
|
||||||
{ pathParams: UpdateUserPathParameters; data: BodyType<TypesUserDTO> },
|
{ pathParams: UpdateUserPathParameters; data: TypesUserDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getUpdateUserMutationOptions(options);
|
const mutationOptions = getUpdateUserMutationOptions(options);
|
||||||
@@ -1520,12 +1504,12 @@ export const getMyUser = (signal?: AbortSignal) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getGetMyUserQueryKey = () => {
|
export const getGetMyUserQueryKey = () => {
|
||||||
return [`/api/v1/user/me`] as const;
|
return ['getMyUser'] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetMyUserQueryOptions = <
|
export const getGetMyUserQueryOptions = <
|
||||||
TData = Awaited<ReturnType<typeof getMyUser>>,
|
TData = Awaited<ReturnType<typeof getMyUser>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = RenderErrorResponseDTO
|
||||||
>(options?: {
|
>(options?: {
|
||||||
query?: UseQueryOptions<Awaited<ReturnType<typeof getMyUser>>, TError, TData>;
|
query?: UseQueryOptions<Awaited<ReturnType<typeof getMyUser>>, TError, TData>;
|
||||||
}) => {
|
}) => {
|
||||||
@@ -1547,7 +1531,7 @@ export const getGetMyUserQueryOptions = <
|
|||||||
export type GetMyUserQueryResult = NonNullable<
|
export type GetMyUserQueryResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof getMyUser>>
|
Awaited<ReturnType<typeof getMyUser>>
|
||||||
>;
|
>;
|
||||||
export type GetMyUserQueryError = ErrorType<RenderErrorResponseDTO>;
|
export type GetMyUserQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get my user
|
* @summary Get my user
|
||||||
@@ -1555,7 +1539,7 @@ export type GetMyUserQueryError = ErrorType<RenderErrorResponseDTO>;
|
|||||||
|
|
||||||
export function useGetMyUser<
|
export function useGetMyUser<
|
||||||
TData = Awaited<ReturnType<typeof getMyUser>>,
|
TData = Awaited<ReturnType<typeof getMyUser>>,
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
TError = 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 } {
|
||||||
@@ -1590,7 +1574,7 @@ export const invalidateGetMyUser = async (
|
|||||||
* @summary Forgot password
|
* @summary Forgot password
|
||||||
*/
|
*/
|
||||||
export const forgotPassword = (
|
export const forgotPassword = (
|
||||||
typesPostableForgotPasswordDTO: BodyType<TypesPostableForgotPasswordDTO>,
|
typesPostableForgotPasswordDTO: TypesPostableForgotPasswordDTO,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return GeneratedAPIInstance<void>({
|
return GeneratedAPIInstance<void>({
|
||||||
@@ -1603,19 +1587,19 @@ export const forgotPassword = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getForgotPasswordMutationOptions = <
|
export const getForgotPasswordMutationOptions = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof forgotPassword>>,
|
Awaited<ReturnType<typeof forgotPassword>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableForgotPasswordDTO> },
|
{ data: TypesPostableForgotPasswordDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof forgotPassword>>,
|
Awaited<ReturnType<typeof forgotPassword>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableForgotPasswordDTO> },
|
{ data: TypesPostableForgotPasswordDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ['forgotPassword'];
|
const mutationKey = ['forgotPassword'];
|
||||||
@@ -1629,7 +1613,7 @@ export const getForgotPasswordMutationOptions = <
|
|||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof forgotPassword>>,
|
Awaited<ReturnType<typeof forgotPassword>>,
|
||||||
{ data: BodyType<TypesPostableForgotPasswordDTO> }
|
{ data: TypesPostableForgotPasswordDTO }
|
||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
@@ -1642,26 +1626,26 @@ export const getForgotPasswordMutationOptions = <
|
|||||||
export type ForgotPasswordMutationResult = NonNullable<
|
export type ForgotPasswordMutationResult = NonNullable<
|
||||||
Awaited<ReturnType<typeof forgotPassword>>
|
Awaited<ReturnType<typeof forgotPassword>>
|
||||||
>;
|
>;
|
||||||
export type ForgotPasswordMutationBody = BodyType<TypesPostableForgotPasswordDTO>;
|
export type ForgotPasswordMutationBody = TypesPostableForgotPasswordDTO;
|
||||||
export type ForgotPasswordMutationError = ErrorType<RenderErrorResponseDTO>;
|
export type ForgotPasswordMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Forgot password
|
* @summary Forgot password
|
||||||
*/
|
*/
|
||||||
export const useForgotPassword = <
|
export const useForgotPassword = <
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
TError = RenderErrorResponseDTO,
|
||||||
TContext = unknown
|
TContext = unknown
|
||||||
>(options?: {
|
>(options?: {
|
||||||
mutation?: UseMutationOptions<
|
mutation?: UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof forgotPassword>>,
|
Awaited<ReturnType<typeof forgotPassword>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableForgotPasswordDTO> },
|
{ data: TypesPostableForgotPasswordDTO },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
}): UseMutationResult<
|
}): UseMutationResult<
|
||||||
Awaited<ReturnType<typeof forgotPassword>>,
|
Awaited<ReturnType<typeof forgotPassword>>,
|
||||||
TError,
|
TError,
|
||||||
{ data: BodyType<TypesPostableForgotPasswordDTO> },
|
{ data: TypesPostableForgotPasswordDTO },
|
||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationOptions = getForgotPasswordMutationOptions(options);
|
const mutationOptions = getForgotPasswordMutationOptions(options);
|
||||||
|
|||||||
@@ -1,272 +0,0 @@
|
|||||||
/**
|
|
||||||
* ! Do not edit manually
|
|
||||||
* * The file has been auto-generated using Orval for SigNoz
|
|
||||||
* * regenerate with 'yarn generate:api'
|
|
||||||
* SigNoz
|
|
||||||
*/
|
|
||||||
import type {
|
|
||||||
InvalidateOptions,
|
|
||||||
MutationFunction,
|
|
||||||
QueryClient,
|
|
||||||
QueryFunction,
|
|
||||||
QueryKey,
|
|
||||||
UseMutationOptions,
|
|
||||||
UseMutationResult,
|
|
||||||
UseQueryOptions,
|
|
||||||
UseQueryResult,
|
|
||||||
} from 'react-query';
|
|
||||||
import { useMutation, useQuery } from 'react-query';
|
|
||||||
|
|
||||||
import type { BodyType, ErrorType } from '../../../generatedAPIInstance';
|
|
||||||
import { GeneratedAPIInstance } from '../../../generatedAPIInstance';
|
|
||||||
import type {
|
|
||||||
GetHosts200,
|
|
||||||
RenderErrorResponseDTO,
|
|
||||||
ZeustypesPostableHostDTO,
|
|
||||||
ZeustypesPostableProfileDTO,
|
|
||||||
} from '../sigNoz.schemas';
|
|
||||||
|
|
||||||
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
||||||
|
|
||||||
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This endpoint gets the host info from zeus.
|
|
||||||
* @summary Get host info from Zeus.
|
|
||||||
*/
|
|
||||||
export const getHosts = (signal?: AbortSignal) => {
|
|
||||||
return GeneratedAPIInstance<GetHosts200>({
|
|
||||||
url: `/api/v2/zeus/hosts`,
|
|
||||||
method: 'GET',
|
|
||||||
signal,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getGetHostsQueryKey = () => {
|
|
||||||
return [`/api/v2/zeus/hosts`] as const;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getGetHostsQueryOptions = <
|
|
||||||
TData = Awaited<ReturnType<typeof getHosts>>,
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
|
||||||
>(options?: {
|
|
||||||
query?: UseQueryOptions<Awaited<ReturnType<typeof getHosts>>, TError, TData>;
|
|
||||||
}) => {
|
|
||||||
const { query: queryOptions } = options ?? {};
|
|
||||||
|
|
||||||
const queryKey = queryOptions?.queryKey ?? getGetHostsQueryKey();
|
|
||||||
|
|
||||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getHosts>>> = ({
|
|
||||||
signal,
|
|
||||||
}) => getHosts(signal);
|
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
|
||||||
Awaited<ReturnType<typeof getHosts>>,
|
|
||||||
TError,
|
|
||||||
TData
|
|
||||||
> & { queryKey: QueryKey };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type GetHostsQueryResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof getHosts>>
|
|
||||||
>;
|
|
||||||
export type GetHostsQueryError = ErrorType<RenderErrorResponseDTO>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @summary Get host info from Zeus.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function useGetHosts<
|
|
||||||
TData = Awaited<ReturnType<typeof getHosts>>,
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>
|
|
||||||
>(options?: {
|
|
||||||
query?: UseQueryOptions<Awaited<ReturnType<typeof getHosts>>, TError, TData>;
|
|
||||||
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
||||||
const queryOptions = getGetHostsQueryOptions(options);
|
|
||||||
|
|
||||||
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
||||||
queryKey: QueryKey;
|
|
||||||
};
|
|
||||||
|
|
||||||
query.queryKey = queryOptions.queryKey;
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @summary Get host info from Zeus.
|
|
||||||
*/
|
|
||||||
export const invalidateGetHosts = async (
|
|
||||||
queryClient: QueryClient,
|
|
||||||
options?: InvalidateOptions,
|
|
||||||
): Promise<QueryClient> => {
|
|
||||||
await queryClient.invalidateQueries(
|
|
||||||
{ queryKey: getGetHostsQueryKey() },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
return queryClient;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This endpoint saves the host of a deployment to zeus.
|
|
||||||
* @summary Put host in Zeus for a deployment.
|
|
||||||
*/
|
|
||||||
export const putHost = (
|
|
||||||
zeustypesPostableHostDTO: BodyType<ZeustypesPostableHostDTO>,
|
|
||||||
) => {
|
|
||||||
return GeneratedAPIInstance<void>({
|
|
||||||
url: `/api/v2/zeus/hosts`,
|
|
||||||
method: 'PUT',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
data: zeustypesPostableHostDTO,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getPutHostMutationOptions = <
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
|
||||||
TContext = unknown
|
|
||||||
>(options?: {
|
|
||||||
mutation?: UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof putHost>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<ZeustypesPostableHostDTO> },
|
|
||||||
TContext
|
|
||||||
>;
|
|
||||||
}): UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof putHost>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<ZeustypesPostableHostDTO> },
|
|
||||||
TContext
|
|
||||||
> => {
|
|
||||||
const mutationKey = ['putHost'];
|
|
||||||
const { mutation: mutationOptions } = options
|
|
||||||
? options.mutation &&
|
|
||||||
'mutationKey' in options.mutation &&
|
|
||||||
options.mutation.mutationKey
|
|
||||||
? options
|
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
||||||
: { mutation: { mutationKey } };
|
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
|
||||||
Awaited<ReturnType<typeof putHost>>,
|
|
||||||
{ data: BodyType<ZeustypesPostableHostDTO> }
|
|
||||||
> = (props) => {
|
|
||||||
const { data } = props ?? {};
|
|
||||||
|
|
||||||
return putHost(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PutHostMutationResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof putHost>>
|
|
||||||
>;
|
|
||||||
export type PutHostMutationBody = BodyType<ZeustypesPostableHostDTO>;
|
|
||||||
export type PutHostMutationError = ErrorType<RenderErrorResponseDTO>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @summary Put host in Zeus for a deployment.
|
|
||||||
*/
|
|
||||||
export const usePutHost = <
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
|
||||||
TContext = unknown
|
|
||||||
>(options?: {
|
|
||||||
mutation?: UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof putHost>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<ZeustypesPostableHostDTO> },
|
|
||||||
TContext
|
|
||||||
>;
|
|
||||||
}): UseMutationResult<
|
|
||||||
Awaited<ReturnType<typeof putHost>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<ZeustypesPostableHostDTO> },
|
|
||||||
TContext
|
|
||||||
> => {
|
|
||||||
const mutationOptions = getPutHostMutationOptions(options);
|
|
||||||
|
|
||||||
return useMutation(mutationOptions);
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* This endpoint saves the profile of a deployment to zeus.
|
|
||||||
* @summary Put profile in Zeus for a deployment.
|
|
||||||
*/
|
|
||||||
export const putProfile = (
|
|
||||||
zeustypesPostableProfileDTO: BodyType<ZeustypesPostableProfileDTO>,
|
|
||||||
) => {
|
|
||||||
return GeneratedAPIInstance<void>({
|
|
||||||
url: `/api/v2/zeus/profiles`,
|
|
||||||
method: 'PUT',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
data: zeustypesPostableProfileDTO,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getPutProfileMutationOptions = <
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
|
||||||
TContext = unknown
|
|
||||||
>(options?: {
|
|
||||||
mutation?: UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof putProfile>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<ZeustypesPostableProfileDTO> },
|
|
||||||
TContext
|
|
||||||
>;
|
|
||||||
}): UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof putProfile>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<ZeustypesPostableProfileDTO> },
|
|
||||||
TContext
|
|
||||||
> => {
|
|
||||||
const mutationKey = ['putProfile'];
|
|
||||||
const { mutation: mutationOptions } = options
|
|
||||||
? options.mutation &&
|
|
||||||
'mutationKey' in options.mutation &&
|
|
||||||
options.mutation.mutationKey
|
|
||||||
? options
|
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
||||||
: { mutation: { mutationKey } };
|
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
|
||||||
Awaited<ReturnType<typeof putProfile>>,
|
|
||||||
{ data: BodyType<ZeustypesPostableProfileDTO> }
|
|
||||||
> = (props) => {
|
|
||||||
const { data } = props ?? {};
|
|
||||||
|
|
||||||
return putProfile(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PutProfileMutationResult = NonNullable<
|
|
||||||
Awaited<ReturnType<typeof putProfile>>
|
|
||||||
>;
|
|
||||||
export type PutProfileMutationBody = BodyType<ZeustypesPostableProfileDTO>;
|
|
||||||
export type PutProfileMutationError = ErrorType<RenderErrorResponseDTO>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @summary Put profile in Zeus for a deployment.
|
|
||||||
*/
|
|
||||||
export const usePutProfile = <
|
|
||||||
TError = ErrorType<RenderErrorResponseDTO>,
|
|
||||||
TContext = unknown
|
|
||||||
>(options?: {
|
|
||||||
mutation?: UseMutationOptions<
|
|
||||||
Awaited<ReturnType<typeof putProfile>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<ZeustypesPostableProfileDTO> },
|
|
||||||
TContext
|
|
||||||
>;
|
|
||||||
}): UseMutationResult<
|
|
||||||
Awaited<ReturnType<typeof putProfile>>,
|
|
||||||
TError,
|
|
||||||
{ data: BodyType<ZeustypesPostableProfileDTO> },
|
|
||||||
TContext
|
|
||||||
> => {
|
|
||||||
const mutationOptions = getPutProfileMutationOptions(options);
|
|
||||||
|
|
||||||
return useMutation(mutationOptions);
|
|
||||||
};
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -15,7 +15,15 @@ import { Events } from 'constants/events';
|
|||||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||||
import { eventEmitter } from 'utils/getEventEmitter';
|
import { eventEmitter } from 'utils/getEventEmitter';
|
||||||
|
|
||||||
import apiV1, { apiAlertManager, apiV2, apiV3, apiV4, apiV5 } from './apiV1';
|
import apiV1, {
|
||||||
|
apiAlertManager,
|
||||||
|
apiV2,
|
||||||
|
apiV3,
|
||||||
|
apiV4,
|
||||||
|
apiV5,
|
||||||
|
gatewayApiV1,
|
||||||
|
gatewayApiV2,
|
||||||
|
} from './apiV1';
|
||||||
import { Logout } from './utils';
|
import { Logout } from './utils';
|
||||||
|
|
||||||
const RESPONSE_TIMEOUT_THRESHOLD = 5000; // 5 seconds
|
const RESPONSE_TIMEOUT_THRESHOLD = 5000; // 5 seconds
|
||||||
@@ -28,7 +36,7 @@ const queryClient = new QueryClient({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const interceptorsResponse = (
|
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 +59,7 @@ export const interceptorsResponse = (
|
|||||||
return Promise.resolve(value);
|
return Promise.resolve(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const interceptorsRequestResponse = (
|
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 +77,7 @@ export const interceptorsRequestResponse = (
|
|||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const interceptorRejected = async (
|
const interceptorRejected = async (
|
||||||
value: AxiosResponse<any>,
|
value: AxiosResponse<any>,
|
||||||
): Promise<AxiosResponse<any>> => {
|
): Promise<AxiosResponse<any>> => {
|
||||||
try {
|
try {
|
||||||
@@ -203,6 +211,43 @@ LogEventAxiosInstance.interceptors.response.use(
|
|||||||
LogEventAxiosInstance.interceptors.request.use(interceptorsRequestResponse);
|
LogEventAxiosInstance.interceptors.request.use(interceptorsRequestResponse);
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// gateway Api V1
|
||||||
|
export const GatewayApiV1Instance = axios.create({
|
||||||
|
baseURL: `${ENVIRONMENT.baseURL}${gatewayApiV1}`,
|
||||||
|
});
|
||||||
|
|
||||||
|
GatewayApiV1Instance.interceptors.response.use(
|
||||||
|
interceptorsResponse,
|
||||||
|
interceptorRejected,
|
||||||
|
);
|
||||||
|
|
||||||
|
GatewayApiV1Instance.interceptors.request.use(interceptorsRequestResponse);
|
||||||
|
//
|
||||||
|
|
||||||
|
// gateway Api V2
|
||||||
|
export const GatewayApiV2Instance = axios.create({
|
||||||
|
baseURL: `${ENVIRONMENT.baseURL}${gatewayApiV2}`,
|
||||||
|
});
|
||||||
|
|
||||||
|
// generated API Instance
|
||||||
|
export const GeneratedAPIInstance = axios.create({
|
||||||
|
baseURL: ENVIRONMENT.baseURL,
|
||||||
|
});
|
||||||
|
|
||||||
|
GeneratedAPIInstance.interceptors.request.use(interceptorsRequestResponse);
|
||||||
|
GeneratedAPIInstance.interceptors.response.use(
|
||||||
|
interceptorsResponse,
|
||||||
|
interceptorRejected,
|
||||||
|
);
|
||||||
|
|
||||||
|
GatewayApiV2Instance.interceptors.response.use(
|
||||||
|
interceptorsResponse,
|
||||||
|
interceptorRejected,
|
||||||
|
);
|
||||||
|
|
||||||
|
GatewayApiV2Instance.interceptors.request.use(interceptorsRequestResponse);
|
||||||
|
//
|
||||||
|
|
||||||
AxiosAlertManagerInstance.interceptors.response.use(
|
AxiosAlertManagerInstance.interceptors.response.use(
|
||||||
interceptorsResponse,
|
interceptorsResponse,
|
||||||
interceptorRejected,
|
interceptorRejected,
|
||||||
|
|||||||
@@ -11,10 +11,13 @@ export const getMetricMetadata = async (
|
|||||||
): Promise<SuccessResponseV2<MetricMetadataResponse> | ErrorResponseV2> => {
|
): Promise<SuccessResponseV2<MetricMetadataResponse> | ErrorResponseV2> => {
|
||||||
try {
|
try {
|
||||||
const encodedMetricName = encodeURIComponent(metricName);
|
const encodedMetricName = encodeURIComponent(metricName);
|
||||||
const response = await axios.get(`/metrics/${encodedMetricName}/metadata`, {
|
const response = await axios.get(
|
||||||
signal,
|
`/metrics/metadata?metricName=${encodedMetricName}`,
|
||||||
headers,
|
{
|
||||||
});
|
signal,
|
||||||
|
headers,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
httpStatusCode: response.status,
|
httpStatusCode: response.status,
|
||||||
|
|||||||
20
frontend/src/api/onboarding/updateProfile.ts
Normal file
20
frontend/src/api/onboarding/updateProfile.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { GatewayApiV2Instance } from 'api';
|
||||||
|
import { ErrorResponse, SuccessResponse } from 'types/api';
|
||||||
|
import { UpdateProfileProps } from 'types/api/onboarding/types';
|
||||||
|
|
||||||
|
const updateProfile = async (
|
||||||
|
props: UpdateProfileProps,
|
||||||
|
): Promise<SuccessResponse<UpdateProfileProps> | ErrorResponse> => {
|
||||||
|
const response = await GatewayApiV2Instance.put('/profiles/me', {
|
||||||
|
...props,
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
statusCode: 200,
|
||||||
|
error: null,
|
||||||
|
message: response.data.status,
|
||||||
|
payload: response.data.data,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default updateProfile;
|
||||||
19
frontend/src/api/v1/domains/id/delete.ts
Normal file
19
frontend/src/api/v1/domains/id/delete.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import axios from 'api';
|
||||||
|
import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
|
||||||
|
import { AxiosError } from 'axios';
|
||||||
|
import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
|
||||||
|
|
||||||
|
const deleteDomain = async (id: string): Promise<SuccessResponseV2<null>> => {
|
||||||
|
try {
|
||||||
|
const response = await axios.delete<null>(`/domains/${id}`);
|
||||||
|
|
||||||
|
return {
|
||||||
|
httpStatusCode: response.status,
|
||||||
|
data: null,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default deleteDomain;
|
||||||
25
frontend/src/api/v1/domains/id/put.ts
Normal file
25
frontend/src/api/v1/domains/id/put.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import axios from 'api';
|
||||||
|
import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
|
||||||
|
import { AxiosError } from 'axios';
|
||||||
|
import { ErrorV2Resp, RawSuccessResponse, SuccessResponseV2 } from 'types/api';
|
||||||
|
import { UpdatableAuthDomain } from 'types/api/v1/domains/put';
|
||||||
|
|
||||||
|
const put = async (
|
||||||
|
props: UpdatableAuthDomain,
|
||||||
|
): Promise<SuccessResponseV2<null>> => {
|
||||||
|
try {
|
||||||
|
const response = await axios.put<RawSuccessResponse<null>>(
|
||||||
|
`/domains/${props.id}`,
|
||||||
|
{ config: props.config },
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
httpStatusCode: response.status,
|
||||||
|
data: response.data.data,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default put;
|
||||||
24
frontend/src/api/v1/domains/list.ts
Normal file
24
frontend/src/api/v1/domains/list.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import axios from 'api';
|
||||||
|
import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
|
||||||
|
import { AxiosError } from 'axios';
|
||||||
|
import { ErrorV2Resp, RawSuccessResponse, SuccessResponseV2 } from 'types/api';
|
||||||
|
import { GettableAuthDomain } from 'types/api/v1/domains/list';
|
||||||
|
|
||||||
|
const listAllDomain = async (): Promise<
|
||||||
|
SuccessResponseV2<GettableAuthDomain[]>
|
||||||
|
> => {
|
||||||
|
try {
|
||||||
|
const response = await axios.get<RawSuccessResponse<GettableAuthDomain[]>>(
|
||||||
|
`/domains`,
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
httpStatusCode: response.status,
|
||||||
|
data: response.data.data,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default listAllDomain;
|
||||||
26
frontend/src/api/v1/domains/post.ts
Normal file
26
frontend/src/api/v1/domains/post.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import axios from 'api';
|
||||||
|
import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
|
||||||
|
import { AxiosError } from 'axios';
|
||||||
|
import { ErrorV2Resp, RawSuccessResponse, SuccessResponseV2 } from 'types/api';
|
||||||
|
import { GettableAuthDomain } from 'types/api/v1/domains/list';
|
||||||
|
import { PostableAuthDomain } from 'types/api/v1/domains/post';
|
||||||
|
|
||||||
|
const post = async (
|
||||||
|
props: PostableAuthDomain,
|
||||||
|
): Promise<SuccessResponseV2<GettableAuthDomain>> => {
|
||||||
|
try {
|
||||||
|
const response = await axios.post<RawSuccessResponse<GettableAuthDomain>>(
|
||||||
|
`/domains`,
|
||||||
|
props,
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
httpStatusCode: response.status,
|
||||||
|
data: response.data.data,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default post;
|
||||||
@@ -73,7 +73,7 @@ describe('convertV5ResponseToLegacy', () => {
|
|||||||
const v5Data: QueryRangeResponseV5 = {
|
const v5Data: QueryRangeResponseV5 = {
|
||||||
type: 'time_series',
|
type: 'time_series',
|
||||||
data: { results: [timeSeries] },
|
data: { results: [timeSeries] },
|
||||||
meta: { rowsScanned: 0, bytesScanned: 0, durationMs: 0, stepIntervals: {} },
|
meta: { rowsScanned: 0, bytesScanned: 0, durationMs: 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
const params = makeBaseParams('time_series', [
|
const params = makeBaseParams('time_series', [
|
||||||
@@ -156,7 +156,7 @@ describe('convertV5ResponseToLegacy', () => {
|
|||||||
const v5Data: QueryRangeResponseV5 = {
|
const v5Data: QueryRangeResponseV5 = {
|
||||||
type: 'scalar',
|
type: 'scalar',
|
||||||
data: { results: [scalar] },
|
data: { results: [scalar] },
|
||||||
meta: { rowsScanned: 0, bytesScanned: 0, durationMs: 0, stepIntervals: {} },
|
meta: { rowsScanned: 0, bytesScanned: 0, durationMs: 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
const params = makeBaseParams('scalar', [
|
const params = makeBaseParams('scalar', [
|
||||||
@@ -239,7 +239,7 @@ describe('convertV5ResponseToLegacy', () => {
|
|||||||
const v5Data: QueryRangeResponseV5 = {
|
const v5Data: QueryRangeResponseV5 = {
|
||||||
type: 'scalar',
|
type: 'scalar',
|
||||||
data: { results: [scalar] },
|
data: { results: [scalar] },
|
||||||
meta: { rowsScanned: 0, bytesScanned: 0, durationMs: 0, stepIntervals: {} },
|
meta: { rowsScanned: 0, bytesScanned: 0, durationMs: 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
const params = makeBaseParams('scalar', [
|
const params = makeBaseParams('scalar', [
|
||||||
|
|||||||
@@ -388,7 +388,6 @@ export function convertV5ResponseToLegacy(
|
|||||||
warnings: v5Data?.data?.warning || [],
|
warnings: v5Data?.data?.warning || [],
|
||||||
},
|
},
|
||||||
warning: v5Data?.warning || undefined,
|
warning: v5Data?.warning || undefined,
|
||||||
meta: v5Data?.meta,
|
|
||||||
},
|
},
|
||||||
warning: v5Data?.warning || undefined,
|
warning: v5Data?.warning || undefined,
|
||||||
};
|
};
|
||||||
@@ -407,7 +406,6 @@ export function convertV5ResponseToLegacy(
|
|||||||
payload: {
|
payload: {
|
||||||
data: convertedData,
|
data: convertedData,
|
||||||
warning: v5Response.payload?.data?.warning || undefined,
|
warning: v5Response.payload?.data?.warning || undefined,
|
||||||
meta: v5Data?.meta,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
2
frontend/src/auto-import-registry.d.ts
vendored
2
frontend/src/auto-import-registry.d.ts
vendored
@@ -21,9 +21,7 @@ import '@signozhq/design-tokens';
|
|||||||
import '@signozhq/icons';
|
import '@signozhq/icons';
|
||||||
import '@signozhq/input';
|
import '@signozhq/input';
|
||||||
import '@signozhq/popover';
|
import '@signozhq/popover';
|
||||||
import '@signozhq/radio-group';
|
|
||||||
import '@signozhq/resizable';
|
import '@signozhq/resizable';
|
||||||
import '@signozhq/sonner';
|
import '@signozhq/sonner';
|
||||||
import '@signozhq/switch';
|
|
||||||
import '@signozhq/table';
|
import '@signozhq/table';
|
||||||
import '@signozhq/tooltip';
|
import '@signozhq/tooltip';
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
/* eslint-disable no-nested-ternary */
|
/* eslint-disable no-nested-ternary */
|
||||||
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
import { useCallback, useEffect, useMemo } from 'react';
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery } from 'react-query';
|
||||||
import { Virtuoso, VirtuosoHandle } from 'react-virtuoso';
|
import { Virtuoso } from 'react-virtuoso';
|
||||||
import { Card } from 'antd';
|
import { Card } from 'antd';
|
||||||
import LogDetail from 'components/LogDetail';
|
|
||||||
import RawLogView from 'components/Logs/RawLogView';
|
import RawLogView from 'components/Logs/RawLogView';
|
||||||
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||||
import { DEFAULT_ENTITY_VERSION } from 'constants/app';
|
import { DEFAULT_ENTITY_VERSION } from 'constants/app';
|
||||||
@@ -11,8 +10,6 @@ import LogsError from 'container/LogsError/LogsError';
|
|||||||
import { LogsLoading } from 'container/LogsLoading/LogsLoading';
|
import { LogsLoading } from 'container/LogsLoading/LogsLoading';
|
||||||
import { FontSize } from 'container/OptionsMenu/types';
|
import { FontSize } from 'container/OptionsMenu/types';
|
||||||
import { useHandleLogsPagination } from 'hooks/infraMonitoring/useHandleLogsPagination';
|
import { useHandleLogsPagination } from 'hooks/infraMonitoring/useHandleLogsPagination';
|
||||||
import useLogDetailHandlers from 'hooks/logs/useLogDetailHandlers';
|
|
||||||
import useScrollToLog from 'hooks/logs/useScrollToLog';
|
|
||||||
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
|
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
|
||||||
import { ILog } from 'types/api/logs/log';
|
import { ILog } from 'types/api/logs/log';
|
||||||
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
|
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
@@ -31,15 +28,6 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function HostMetricsLogs({ timeRange, filters }: Props): JSX.Element {
|
function HostMetricsLogs({ timeRange, filters }: Props): JSX.Element {
|
||||||
const virtuosoRef = useRef<VirtuosoHandle>(null);
|
|
||||||
const {
|
|
||||||
activeLog,
|
|
||||||
onAddToQuery,
|
|
||||||
selectedTab,
|
|
||||||
handleSetActiveLog,
|
|
||||||
handleCloseLogDetail,
|
|
||||||
} = useLogDetailHandlers();
|
|
||||||
|
|
||||||
const basePayload = getHostLogsQueryPayload(
|
const basePayload = getHostLogsQueryPayload(
|
||||||
timeRange.startTime,
|
timeRange.startTime,
|
||||||
timeRange.endTime,
|
timeRange.endTime,
|
||||||
@@ -84,40 +72,29 @@ function HostMetricsLogs({ timeRange, filters }: Props): JSX.Element {
|
|||||||
setIsPaginating(false);
|
setIsPaginating(false);
|
||||||
}, [data, setIsPaginating]);
|
}, [data, setIsPaginating]);
|
||||||
|
|
||||||
const handleScrollToLog = useScrollToLog({
|
|
||||||
logs,
|
|
||||||
virtuosoRef,
|
|
||||||
});
|
|
||||||
|
|
||||||
const getItemContent = useCallback(
|
const getItemContent = useCallback(
|
||||||
(_: number, logToRender: ILog): JSX.Element => {
|
(_: number, logToRender: ILog): JSX.Element => (
|
||||||
return (
|
<RawLogView
|
||||||
<div key={logToRender.id}>
|
isTextOverflowEllipsisDisabled
|
||||||
<RawLogView
|
key={logToRender.id}
|
||||||
isTextOverflowEllipsisDisabled
|
data={logToRender}
|
||||||
data={logToRender}
|
linesPerRow={5}
|
||||||
linesPerRow={5}
|
fontSize={FontSize.MEDIUM}
|
||||||
fontSize={FontSize.MEDIUM}
|
selectedFields={[
|
||||||
selectedFields={[
|
{
|
||||||
{
|
dataType: 'string',
|
||||||
dataType: 'string',
|
type: '',
|
||||||
type: '',
|
name: 'body',
|
||||||
name: 'body',
|
},
|
||||||
},
|
{
|
||||||
{
|
dataType: 'string',
|
||||||
dataType: 'string',
|
type: '',
|
||||||
type: '',
|
name: 'timestamp',
|
||||||
name: 'timestamp',
|
},
|
||||||
},
|
]}
|
||||||
]}
|
/>
|
||||||
onSetActiveLog={handleSetActiveLog}
|
),
|
||||||
onClearActiveLog={handleCloseLogDetail}
|
[],
|
||||||
isActiveLog={activeLog?.id === logToRender.id}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
[activeLog, handleSetActiveLog, handleCloseLogDetail],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderFooter = useCallback(
|
const renderFooter = useCallback(
|
||||||
@@ -141,7 +118,6 @@ function HostMetricsLogs({ timeRange, filters }: Props): JSX.Element {
|
|||||||
<Virtuoso
|
<Virtuoso
|
||||||
className="host-metrics-logs-virtuoso"
|
className="host-metrics-logs-virtuoso"
|
||||||
key="host-metrics-logs-virtuoso"
|
key="host-metrics-logs-virtuoso"
|
||||||
ref={virtuosoRef}
|
|
||||||
data={logs}
|
data={logs}
|
||||||
endReached={loadMoreLogs}
|
endReached={loadMoreLogs}
|
||||||
totalCount={logs.length}
|
totalCount={logs.length}
|
||||||
@@ -163,24 +139,7 @@ function HostMetricsLogs({ timeRange, filters }: Props): JSX.Element {
|
|||||||
{!isLoading && !isError && logs.length === 0 && <NoLogsContainer />}
|
{!isLoading && !isError && logs.length === 0 && <NoLogsContainer />}
|
||||||
{isError && !isLoading && <LogsError />}
|
{isError && !isLoading && <LogsError />}
|
||||||
{!isLoading && !isError && logs.length > 0 && (
|
{!isLoading && !isError && logs.length > 0 && (
|
||||||
<div
|
<div className="host-metrics-logs-list-container">{renderContent}</div>
|
||||||
className="host-metrics-logs-list-container"
|
|
||||||
data-log-detail-ignore="true"
|
|
||||||
>
|
|
||||||
{renderContent}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{selectedTab && activeLog && (
|
|
||||||
<LogDetail
|
|
||||||
log={activeLog}
|
|
||||||
onClose={handleCloseLogDetail}
|
|
||||||
logs={logs}
|
|
||||||
onNavigateLog={handleSetActiveLog}
|
|
||||||
selectedTab={selectedTab}
|
|
||||||
onAddToQuery={onAddToQuery}
|
|
||||||
onClickActionItem={onAddToQuery}
|
|
||||||
onScrollToLog={handleScrollToLog}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ export type LogDetailProps = {
|
|||||||
handleChangeSelectedView?: ChangeViewFunctionType;
|
handleChangeSelectedView?: ChangeViewFunctionType;
|
||||||
isListViewPanel?: boolean;
|
isListViewPanel?: boolean;
|
||||||
listViewPanelSelectedFields?: IField[] | null;
|
listViewPanelSelectedFields?: IField[] | null;
|
||||||
logs?: ILog[];
|
|
||||||
onNavigateLog?: (log: ILog) => void;
|
|
||||||
onScrollToLog?: (logId: string) => void;
|
|
||||||
} & Pick<AddToQueryHOCProps, 'onAddToQuery'> &
|
} & Pick<AddToQueryHOCProps, 'onAddToQuery'> &
|
||||||
Partial<Pick<ActionItemProps, 'onClickActionItem'>> &
|
Partial<Pick<ActionItemProps, 'onClickActionItem'>> &
|
||||||
Pick<DrawerProps, 'onClose'>;
|
Pick<DrawerProps, 'onClose'>;
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.log-detail-drawer__title-right {
|
.log-detail-drawer__title-right {
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
.ant-btn {
|
.ant-btn {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -42,7 +40,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
padding-bottom: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
@@ -69,10 +66,6 @@
|
|||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.log-detail-drawer__content {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-detail-drawer__log {
|
.log-detail-drawer__log {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -190,115 +183,9 @@
|
|||||||
.ant-drawer-close {
|
.ant-drawer-close {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
.log-detail-drawer__footer-hint {
|
|
||||||
position: sticky;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
padding: 8px 16px;
|
|
||||||
text-align: left;
|
|
||||||
color: var(--text-vanilla-200);
|
|
||||||
background: var(--bg-ink-400);
|
|
||||||
z-index: 10;
|
|
||||||
|
|
||||||
.log-detail-drawer__footer-hint-content {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-detail-drawer__footer-hint-icon {
|
|
||||||
display: inline;
|
|
||||||
vertical-align: middle;
|
|
||||||
color: var(--text-vanilla-200);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-detail-drawer__footer-hint-text {
|
|
||||||
font-size: 13px;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.log-arrows {
|
|
||||||
display: flex;
|
|
||||||
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 2px 6px;
|
|
||||||
align-items: center;
|
|
||||||
margin-left: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-arrow-btn {
|
|
||||||
padding: 0;
|
|
||||||
min-width: 28px;
|
|
||||||
height: 28px;
|
|
||||||
border-radius: 4px;
|
|
||||||
background: var(--bg-ink-400);
|
|
||||||
color: var(--text-vanilla-400);
|
|
||||||
border: 1px solid var(--bg-ink-300);
|
|
||||||
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.08);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
transition: background-color 0.2s ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-arrow-btn-up,
|
|
||||||
.log-arrow-btn-down {
|
|
||||||
background: var(--bg-ink-400);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-arrow-btn:active,
|
|
||||||
.log-arrow-btn:focus {
|
|
||||||
background: var(--bg-ink-300);
|
|
||||||
color: var(--text-vanilla-100);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-arrow-btn[disabled] {
|
|
||||||
opacity: 0.5;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background: var(--bg-ink-500);
|
|
||||||
color: var(--text-vanilla-200);
|
|
||||||
|
|
||||||
.log-arrow-btn:hover:not([disabled]) {
|
|
||||||
background: var(--bg-ink-300);
|
|
||||||
color: var(--text-vanilla-100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.lightMode {
|
.lightMode {
|
||||||
.log-arrows {
|
|
||||||
background: var(--bg-vanilla-100);
|
|
||||||
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.04);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-arrow-btn {
|
|
||||||
background: var(--bg-vanilla-100);
|
|
||||||
color: var(--text-ink-400);
|
|
||||||
border: 1px solid var(--bg-vanilla-300);
|
|
||||||
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-arrow-btn-up,
|
|
||||||
.log-arrow-btn-down {
|
|
||||||
background: var(--bg-vanilla-100);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-arrow-btn:active,
|
|
||||||
.log-arrow-btn:focus {
|
|
||||||
background: var(--bg-vanilla-200);
|
|
||||||
color: var(--text-ink-500);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-arrow-btn:hover:not([disabled]) {
|
|
||||||
background: var(--bg-vanilla-200);
|
|
||||||
color: var(--text-ink-500);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-arrow-btn[disabled] {
|
|
||||||
background: var(--bg-vanilla-100);
|
|
||||||
color: var(--text-ink-200);
|
|
||||||
}
|
|
||||||
.ant-drawer-header {
|
.ant-drawer-header {
|
||||||
border-bottom: 1px solid var(--bg-vanilla-400);
|
border-bottom: 1px solid var(--bg-vanilla-400);
|
||||||
background: var(--bg-vanilla-100);
|
background: var(--bg-vanilla-100);
|
||||||
@@ -365,33 +252,4 @@
|
|||||||
color: var(--text-ink-300);
|
color: var(--text-ink-300);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.log-detail-drawer__footer-hint {
|
|
||||||
position: sticky;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
padding: 8px 16px;
|
|
||||||
text-align: left;
|
|
||||||
color: var(--text-vanilla-700);
|
|
||||||
background: var(--bg-vanilla-100);
|
|
||||||
z-index: 10;
|
|
||||||
|
|
||||||
.log-detail-drawer__footer-hint-content {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-detail-drawer__footer-hint-icon {
|
|
||||||
display: inline;
|
|
||||||
vertical-align: middle;
|
|
||||||
color: var(--text-vanilla-700);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-detail-drawer__footer-hint-text {
|
|
||||||
font-size: 13px;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable sonarjs/cognitive-complexity */
|
/* eslint-disable sonarjs/cognitive-complexity */
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { useCopyToClipboard, useLocation } from 'react-use';
|
import { useCopyToClipboard, useLocation } from 'react-use';
|
||||||
import { Color, Spacing } from '@signozhq/design-tokens';
|
import { Color, Spacing } from '@signozhq/design-tokens';
|
||||||
@@ -32,12 +32,8 @@ import { useSafeNavigate } from 'hooks/useSafeNavigate';
|
|||||||
import createQueryParams from 'lib/createQueryParams';
|
import createQueryParams from 'lib/createQueryParams';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
import {
|
import {
|
||||||
ArrowDown,
|
|
||||||
ArrowUp,
|
|
||||||
BarChart2,
|
BarChart2,
|
||||||
Braces,
|
Braces,
|
||||||
ChevronDown,
|
|
||||||
ChevronUp,
|
|
||||||
Compass,
|
Compass,
|
||||||
Copy,
|
Copy,
|
||||||
Filter,
|
Filter,
|
||||||
@@ -64,9 +60,6 @@ function LogDetailInner({
|
|||||||
isListViewPanel = false,
|
isListViewPanel = false,
|
||||||
listViewPanelSelectedFields,
|
listViewPanelSelectedFields,
|
||||||
handleChangeSelectedView,
|
handleChangeSelectedView,
|
||||||
logs,
|
|
||||||
onNavigateLog,
|
|
||||||
onScrollToLog,
|
|
||||||
}: LogDetailInnerProps): JSX.Element {
|
}: LogDetailInnerProps): JSX.Element {
|
||||||
const initialContextQuery = useInitialQuery(log);
|
const initialContextQuery = useInitialQuery(log);
|
||||||
const [contextQuery, setContextQuery] = useState<Query | undefined>(
|
const [contextQuery, setContextQuery] = useState<Query | undefined>(
|
||||||
@@ -81,78 +74,6 @@ function LogDetailInner({
|
|||||||
const [isEdit, setIsEdit] = useState<boolean>(false);
|
const [isEdit, setIsEdit] = useState<boolean>(false);
|
||||||
const { stagedQuery, updateAllQueriesOperators } = useQueryBuilder();
|
const { stagedQuery, updateAllQueriesOperators } = useQueryBuilder();
|
||||||
|
|
||||||
// Handle clicks outside to close drawer, except on explicitly ignored regions
|
|
||||||
useEffect(() => {
|
|
||||||
const handleClickOutside = (e: MouseEvent): void => {
|
|
||||||
const target = e.target as HTMLElement;
|
|
||||||
|
|
||||||
// Don't close if clicking on explicitly ignored regions
|
|
||||||
if (target.closest('[data-log-detail-ignore="true"]')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close the drawer for any other outside click
|
|
||||||
onClose?.(e as any);
|
|
||||||
};
|
|
||||||
|
|
||||||
document.addEventListener('mousedown', handleClickOutside);
|
|
||||||
|
|
||||||
return (): void => {
|
|
||||||
document.removeEventListener('mousedown', handleClickOutside);
|
|
||||||
};
|
|
||||||
}, [onClose]);
|
|
||||||
|
|
||||||
// Keyboard navigation - handle up/down arrow keys
|
|
||||||
// Only listen when in OVERVIEW tab
|
|
||||||
useEffect(() => {
|
|
||||||
if (
|
|
||||||
!logs ||
|
|
||||||
!onNavigateLog ||
|
|
||||||
logs.length === 0 ||
|
|
||||||
selectedView !== VIEW_TYPES.OVERVIEW
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleKeyDown = (e: KeyboardEvent): void => {
|
|
||||||
const currentIndex = logs.findIndex((l) => l.id === log.id);
|
|
||||||
if (currentIndex === -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.key === 'ArrowUp') {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
// Navigate to previous log
|
|
||||||
if (currentIndex > 0) {
|
|
||||||
const prevLog = logs[currentIndex - 1];
|
|
||||||
onNavigateLog(prevLog);
|
|
||||||
// Trigger scroll to the log element
|
|
||||||
if (onScrollToLog) {
|
|
||||||
onScrollToLog(prevLog.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (e.key === 'ArrowDown') {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
// Navigate to next log
|
|
||||||
if (currentIndex < logs.length - 1) {
|
|
||||||
const nextLog = logs[currentIndex + 1];
|
|
||||||
onNavigateLog(nextLog);
|
|
||||||
// Trigger scroll to the log element
|
|
||||||
if (onScrollToLog) {
|
|
||||||
onScrollToLog(nextLog.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
document.addEventListener('keydown', handleKeyDown);
|
|
||||||
return (): void => {
|
|
||||||
document.removeEventListener('keydown', handleKeyDown);
|
|
||||||
};
|
|
||||||
}, [log.id, logs, onNavigateLog, onScrollToLog, selectedView]);
|
|
||||||
|
|
||||||
const listQuery = useMemo(() => {
|
const listQuery = useMemo(() => {
|
||||||
if (!stagedQuery || stagedQuery.builder.queryData.length < 1) {
|
if (!stagedQuery || stagedQuery.builder.queryData.length < 1) {
|
||||||
return null;
|
return null;
|
||||||
@@ -306,87 +227,32 @@ function LogDetailInner({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const logType = log?.attributes_string?.log_level || LogType.INFO;
|
const logType = log?.attributes_string?.log_level || LogType.INFO;
|
||||||
const currentLogIndex = logs ? logs.findIndex((l) => l.id === log.id) : -1;
|
|
||||||
const isPrevDisabled =
|
|
||||||
!logs || !onNavigateLog || logs.length === 0 || currentLogIndex <= 0;
|
|
||||||
const isNextDisabled =
|
|
||||||
!logs ||
|
|
||||||
!onNavigateLog ||
|
|
||||||
logs.length === 0 ||
|
|
||||||
currentLogIndex === logs.length - 1;
|
|
||||||
|
|
||||||
type HandleNavigateLogParams = {
|
|
||||||
direction: 'next' | 'previous';
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleNavigateLog = ({ direction }: HandleNavigateLogParams): void => {
|
|
||||||
if (!logs || !onNavigateLog || currentLogIndex === -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (direction === 'previous' && !isPrevDisabled) {
|
|
||||||
const prevLog = logs[currentLogIndex - 1];
|
|
||||||
onNavigateLog(prevLog);
|
|
||||||
onScrollToLog?.(prevLog.id);
|
|
||||||
} else if (direction === 'next' && !isNextDisabled) {
|
|
||||||
const nextLog = logs[currentLogIndex + 1];
|
|
||||||
onNavigateLog(nextLog);
|
|
||||||
onScrollToLog?.(nextLog.id);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Drawer
|
<Drawer
|
||||||
width="60%"
|
width="60%"
|
||||||
mask={false}
|
maskStyle={{ background: 'none' }}
|
||||||
maskClosable={false}
|
|
||||||
title={
|
title={
|
||||||
<div className="log-detail-drawer__title" data-log-detail-ignore="true">
|
<div className="log-detail-drawer__title">
|
||||||
<div className="log-detail-drawer__title-left">
|
<div className="log-detail-drawer__title-left">
|
||||||
<Divider type="vertical" className={cx('log-type-indicator', LogType)} />
|
<Divider type="vertical" className={cx('log-type-indicator', LogType)} />
|
||||||
<Typography.Text className="title">Log details</Typography.Text>
|
<Typography.Text className="title">Log details</Typography.Text>
|
||||||
</div>
|
</div>
|
||||||
<div className="log-detail-drawer__title-right">
|
{showOpenInExplorerBtn && (
|
||||||
<div className="log-arrows">
|
<div className="log-detail-drawer__title-right">
|
||||||
<Tooltip
|
<Button
|
||||||
title={isPrevDisabled ? '' : 'Move to previous log'}
|
className="open-in-explorer-btn"
|
||||||
placement="top"
|
icon={<Compass size={16} />}
|
||||||
mouseLeaveDelay={0}
|
onClick={handleOpenInExplorer}
|
||||||
>
|
>
|
||||||
<Button
|
Open in Explorer
|
||||||
icon={<ChevronUp size={14} />}
|
</Button>
|
||||||
className="log-arrow-btn log-arrow-btn-up"
|
|
||||||
disabled={isPrevDisabled}
|
|
||||||
onClick={(): void => handleNavigateLog({ direction: 'previous' })}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
<Tooltip
|
|
||||||
title={isNextDisabled ? '' : 'Move to next log'}
|
|
||||||
placement="top"
|
|
||||||
mouseLeaveDelay={0}
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
icon={<ChevronDown size={14} />}
|
|
||||||
className="log-arrow-btn log-arrow-btn-down"
|
|
||||||
disabled={isNextDisabled}
|
|
||||||
onClick={(): void => handleNavigateLog({ direction: 'next' })}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
</div>
|
||||||
{showOpenInExplorerBtn && (
|
)}
|
||||||
<div>
|
|
||||||
<Button
|
|
||||||
className="open-in-explorer-btn"
|
|
||||||
icon={<Compass size={16} />}
|
|
||||||
onClick={handleOpenInExplorer}
|
|
||||||
>
|
|
||||||
Open in Explorer
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
placement="right"
|
placement="right"
|
||||||
|
// closable
|
||||||
onClose={drawerCloseHandler}
|
onClose={drawerCloseHandler}
|
||||||
open={log !== null}
|
open={log !== null}
|
||||||
style={{
|
style={{
|
||||||
@@ -397,164 +263,138 @@ function LogDetailInner({
|
|||||||
destroyOnClose
|
destroyOnClose
|
||||||
closeIcon={<X size={16} style={{ marginTop: Spacing.MARGIN_1 }} />}
|
closeIcon={<X size={16} style={{ marginTop: Spacing.MARGIN_1 }} />}
|
||||||
>
|
>
|
||||||
<div className="log-detail-drawer__content" data-log-detail-ignore="true">
|
<div className="log-detail-drawer__log">
|
||||||
<div className="log-detail-drawer__log">
|
<Divider type="vertical" className={cx('log-type-indicator', logType)} />
|
||||||
<Divider type="vertical" className={cx('log-type-indicator', logType)} />
|
<Tooltip title={removeEscapeCharacters(log?.body)} placement="left">
|
||||||
<Tooltip title={removeEscapeCharacters(log?.body)} placement="left">
|
<div className="log-body" dangerouslySetInnerHTML={htmlBody} />
|
||||||
<div className="log-body" dangerouslySetInnerHTML={htmlBody} />
|
</Tooltip>
|
||||||
</Tooltip>
|
|
||||||
|
|
||||||
<div className="log-overflow-shadow"> </div>
|
<div className="log-overflow-shadow"> </div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="tabs-and-search">
|
<div className="tabs-and-search">
|
||||||
<Radio.Group
|
<Radio.Group
|
||||||
className="views-tabs"
|
className="views-tabs"
|
||||||
onChange={handleModeChange}
|
onChange={handleModeChange}
|
||||||
value={selectedView}
|
value={selectedView}
|
||||||
|
>
|
||||||
|
<Radio.Button
|
||||||
|
className={
|
||||||
|
// eslint-disable-next-line sonarjs/no-duplicate-string
|
||||||
|
selectedView === VIEW_TYPES.OVERVIEW ? 'selected_view tab' : 'tab'
|
||||||
|
}
|
||||||
|
value={VIEW_TYPES.OVERVIEW}
|
||||||
>
|
>
|
||||||
<Radio.Button
|
<div className="view-title">
|
||||||
className={
|
<Table size={14} />
|
||||||
// eslint-disable-next-line sonarjs/no-duplicate-string
|
Overview
|
||||||
selectedView === VIEW_TYPES.OVERVIEW ? 'selected_view tab' : 'tab'
|
</div>
|
||||||
}
|
</Radio.Button>
|
||||||
value={VIEW_TYPES.OVERVIEW}
|
<Radio.Button
|
||||||
>
|
className={selectedView === VIEW_TYPES.JSON ? 'selected_view tab' : 'tab'}
|
||||||
<div className="view-title">
|
value={VIEW_TYPES.JSON}
|
||||||
<Table size={14} />
|
>
|
||||||
Overview
|
<div className="view-title">
|
||||||
</div>
|
<Braces size={14} />
|
||||||
</Radio.Button>
|
JSON
|
||||||
<Radio.Button
|
</div>
|
||||||
className={
|
</Radio.Button>
|
||||||
selectedView === VIEW_TYPES.JSON ? 'selected_view tab' : 'tab'
|
<Radio.Button
|
||||||
}
|
className={
|
||||||
value={VIEW_TYPES.JSON}
|
selectedView === VIEW_TYPES.CONTEXT ? 'selected_view tab' : 'tab'
|
||||||
>
|
}
|
||||||
<div className="view-title">
|
value={VIEW_TYPES.CONTEXT}
|
||||||
<Braces size={14} />
|
>
|
||||||
JSON
|
<div className="view-title">
|
||||||
</div>
|
<TextSelect size={14} />
|
||||||
</Radio.Button>
|
Context
|
||||||
<Radio.Button
|
</div>
|
||||||
className={
|
</Radio.Button>
|
||||||
selectedView === VIEW_TYPES.CONTEXT ? 'selected_view tab' : 'tab'
|
<Radio.Button
|
||||||
}
|
className={
|
||||||
value={VIEW_TYPES.CONTEXT}
|
selectedView === VIEW_TYPES.INFRAMETRICS ? 'selected_view tab' : 'tab'
|
||||||
>
|
}
|
||||||
<div className="view-title">
|
value={VIEW_TYPES.INFRAMETRICS}
|
||||||
<TextSelect size={14} />
|
>
|
||||||
Context
|
<div className="view-title">
|
||||||
</div>
|
<BarChart2 size={14} />
|
||||||
</Radio.Button>
|
Metrics
|
||||||
<Radio.Button
|
</div>
|
||||||
className={
|
</Radio.Button>
|
||||||
selectedView === VIEW_TYPES.INFRAMETRICS ? 'selected_view tab' : 'tab'
|
</Radio.Group>
|
||||||
}
|
|
||||||
value={VIEW_TYPES.INFRAMETRICS}
|
|
||||||
>
|
|
||||||
<div className="view-title">
|
|
||||||
<BarChart2 size={14} />
|
|
||||||
Metrics
|
|
||||||
</div>
|
|
||||||
</Radio.Button>
|
|
||||||
</Radio.Group>
|
|
||||||
|
|
||||||
<div className="log-detail-drawer__actions">
|
|
||||||
{selectedView === VIEW_TYPES.CONTEXT && (
|
|
||||||
<Tooltip
|
|
||||||
title="Show Filters"
|
|
||||||
placement="topLeft"
|
|
||||||
aria-label="Show Filters"
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
className="action-btn"
|
|
||||||
icon={<Filter size={16} />}
|
|
||||||
onClick={handleFilterVisible}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
)}
|
|
||||||
|
|
||||||
|
<div className="log-detail-drawer__actions">
|
||||||
|
{selectedView === VIEW_TYPES.CONTEXT && (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={selectedView === VIEW_TYPES.JSON ? 'Copy JSON' : 'Copy Log Link'}
|
title="Show Filters"
|
||||||
placement="topLeft"
|
placement="topLeft"
|
||||||
aria-label={
|
aria-label="Show Filters"
|
||||||
selectedView === VIEW_TYPES.JSON ? 'Copy JSON' : 'Copy Log Link'
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
className="action-btn"
|
className="action-btn"
|
||||||
icon={<Copy size={16} />}
|
icon={<Filter size={16} />}
|
||||||
onClick={selectedView === VIEW_TYPES.JSON ? handleJSONCopy : onLogCopy}
|
onClick={handleFilterVisible}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
)}
|
||||||
</div>
|
|
||||||
{isFilterVisible && contextQuery?.builder.queryData[0] && (
|
<Tooltip
|
||||||
<div className="log-detail-drawer-query-container">
|
title={selectedView === VIEW_TYPES.JSON ? 'Copy JSON' : 'Copy Log Link'}
|
||||||
<QuerySearch
|
placement="topLeft"
|
||||||
onChange={(value): void => handleQueryExpressionChange(value, 0)}
|
aria-label={
|
||||||
dataSource={DataSource.LOGS}
|
selectedView === VIEW_TYPES.JSON ? 'Copy JSON' : 'Copy Log Link'
|
||||||
queryData={contextQuery?.builder.queryData[0]}
|
}
|
||||||
onRun={handleRunQuery}
|
>
|
||||||
|
<Button
|
||||||
|
className="action-btn"
|
||||||
|
icon={<Copy size={16} />}
|
||||||
|
onClick={selectedView === VIEW_TYPES.JSON ? handleJSONCopy : onLogCopy}
|
||||||
/>
|
/>
|
||||||
</div>
|
</Tooltip>
|
||||||
)}
|
</div>
|
||||||
|
|
||||||
{selectedView === VIEW_TYPES.OVERVIEW && (
|
|
||||||
<Overview
|
|
||||||
logData={log}
|
|
||||||
onAddToQuery={onAddToQuery}
|
|
||||||
onClickActionItem={onClickActionItem}
|
|
||||||
isListViewPanel={isListViewPanel}
|
|
||||||
selectedOptions={options}
|
|
||||||
listViewPanelSelectedFields={listViewPanelSelectedFields}
|
|
||||||
handleChangeSelectedView={handleChangeSelectedView}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{selectedView === VIEW_TYPES.JSON && <JSONView logData={log} />}
|
|
||||||
|
|
||||||
{selectedView === VIEW_TYPES.CONTEXT && (
|
|
||||||
<ContextView
|
|
||||||
log={log}
|
|
||||||
filters={filters}
|
|
||||||
contextQuery={contextQuery}
|
|
||||||
isEdit={isEdit}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{selectedView === VIEW_TYPES.INFRAMETRICS && (
|
|
||||||
<InfraMetrics
|
|
||||||
clusterName={log.resources_string?.[RESOURCE_KEYS.CLUSTER_NAME] || ''}
|
|
||||||
podName={log.resources_string?.[RESOURCE_KEYS.POD_NAME] || ''}
|
|
||||||
nodeName={log.resources_string?.[RESOURCE_KEYS.NODE_NAME] || ''}
|
|
||||||
hostName={log.resources_string?.[RESOURCE_KEYS.HOST_NAME] || ''}
|
|
||||||
timestamp={log.timestamp.toString()}
|
|
||||||
dataSource={DataSource.LOGS}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{selectedView === VIEW_TYPES.OVERVIEW && (
|
|
||||||
<div className="log-detail-drawer__footer-hint">
|
|
||||||
<div className="log-detail-drawer__footer-hint-content">
|
|
||||||
<Typography.Text
|
|
||||||
type="secondary"
|
|
||||||
className="log-detail-drawer__footer-hint-text"
|
|
||||||
>
|
|
||||||
Use
|
|
||||||
</Typography.Text>
|
|
||||||
<ArrowUp size={14} className="log-detail-drawer__footer-hint-icon" />
|
|
||||||
<span>/</span>
|
|
||||||
<ArrowDown size={14} className="log-detail-drawer__footer-hint-icon" />
|
|
||||||
<Typography.Text
|
|
||||||
type="secondary"
|
|
||||||
className="log-detail-drawer__footer-hint-text"
|
|
||||||
>
|
|
||||||
to view previous/next log
|
|
||||||
</Typography.Text>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
{isFilterVisible && contextQuery?.builder.queryData[0] && (
|
||||||
|
<div className="log-detail-drawer-query-container">
|
||||||
|
<QuerySearch
|
||||||
|
onChange={(value): void => handleQueryExpressionChange(value, 0)}
|
||||||
|
dataSource={DataSource.LOGS}
|
||||||
|
queryData={contextQuery?.builder.queryData[0]}
|
||||||
|
onRun={handleRunQuery}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{selectedView === VIEW_TYPES.OVERVIEW && (
|
||||||
|
<Overview
|
||||||
|
logData={log}
|
||||||
|
onAddToQuery={onAddToQuery}
|
||||||
|
onClickActionItem={onClickActionItem}
|
||||||
|
isListViewPanel={isListViewPanel}
|
||||||
|
selectedOptions={options}
|
||||||
|
listViewPanelSelectedFields={listViewPanelSelectedFields}
|
||||||
|
handleChangeSelectedView={handleChangeSelectedView}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{selectedView === VIEW_TYPES.JSON && <JSONView logData={log} />}
|
||||||
|
|
||||||
|
{selectedView === VIEW_TYPES.CONTEXT && (
|
||||||
|
<ContextView
|
||||||
|
log={log}
|
||||||
|
filters={filters}
|
||||||
|
contextQuery={contextQuery}
|
||||||
|
isEdit={isEdit}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{selectedView === VIEW_TYPES.INFRAMETRICS && (
|
||||||
|
<InfraMetrics
|
||||||
|
clusterName={log.resources_string?.[RESOURCE_KEYS.CLUSTER_NAME] || ''}
|
||||||
|
podName={log.resources_string?.[RESOURCE_KEYS.POD_NAME] || ''}
|
||||||
|
nodeName={log.resources_string?.[RESOURCE_KEYS.NODE_NAME] || ''}
|
||||||
|
hostName={log.resources_string?.[RESOURCE_KEYS.HOST_NAME] || ''}
|
||||||
|
timestamp={log.timestamp.toString()}
|
||||||
|
dataSource={DataSource.LOGS}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</Drawer>
|
</Drawer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ import { memo, useCallback, useMemo } from 'react';
|
|||||||
import { blue } from '@ant-design/colors';
|
import { blue } from '@ant-design/colors';
|
||||||
import { Typography } from 'antd';
|
import { Typography } from 'antd';
|
||||||
import cx from 'classnames';
|
import cx from 'classnames';
|
||||||
|
import LogDetail from 'components/LogDetail';
|
||||||
import { VIEW_TYPES } from 'components/LogDetail/constants';
|
import { VIEW_TYPES } from 'components/LogDetail/constants';
|
||||||
import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
|
import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
|
||||||
import { ChangeViewFunctionType } from 'container/ExplorerOptions/types';
|
import { ChangeViewFunctionType } from 'container/ExplorerOptions/types';
|
||||||
import { getSanitizedLogBody } from 'container/LogDetailedView/utils';
|
import { getSanitizedLogBody } from 'container/LogDetailedView/utils';
|
||||||
import { FontSize } from 'container/OptionsMenu/types';
|
import { FontSize } from 'container/OptionsMenu/types';
|
||||||
|
import { useActiveLog } from 'hooks/logs/useActiveLog';
|
||||||
import { useCopyLogLink } from 'hooks/logs/useCopyLogLink';
|
import { useCopyLogLink } from 'hooks/logs/useCopyLogLink';
|
||||||
import { useIsDarkMode } from 'hooks/useDarkMode';
|
import { useIsDarkMode } from 'hooks/useDarkMode';
|
||||||
// utils
|
// utils
|
||||||
@@ -102,17 +104,12 @@ function LogSelectedField({
|
|||||||
type ListLogViewProps = {
|
type ListLogViewProps = {
|
||||||
logData: ILog;
|
logData: ILog;
|
||||||
selectedFields: IField[];
|
selectedFields: IField[];
|
||||||
onSetActiveLog: (
|
onSetActiveLog: (log: ILog) => void;
|
||||||
log: ILog,
|
|
||||||
selectedTab?: typeof VIEW_TYPES[keyof typeof VIEW_TYPES],
|
|
||||||
) => void;
|
|
||||||
onAddToQuery: AddToQueryHOCProps['onAddToQuery'];
|
onAddToQuery: AddToQueryHOCProps['onAddToQuery'];
|
||||||
activeLog?: ILog | null;
|
activeLog?: ILog | null;
|
||||||
linesPerRow: number;
|
linesPerRow: number;
|
||||||
fontSize: FontSize;
|
fontSize: FontSize;
|
||||||
handleChangeSelectedView?: ChangeViewFunctionType;
|
handleChangeSelectedView?: ChangeViewFunctionType;
|
||||||
isActiveLog?: boolean;
|
|
||||||
onClearActiveLog?: () => void;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function ListLogView({
|
function ListLogView({
|
||||||
@@ -123,8 +120,7 @@ function ListLogView({
|
|||||||
activeLog,
|
activeLog,
|
||||||
linesPerRow,
|
linesPerRow,
|
||||||
fontSize,
|
fontSize,
|
||||||
isActiveLog,
|
handleChangeSelectedView,
|
||||||
onClearActiveLog,
|
|
||||||
}: ListLogViewProps): JSX.Element {
|
}: ListLogViewProps): JSX.Element {
|
||||||
const flattenLogData = useMemo(() => FlatLogData(logData), [logData]);
|
const flattenLogData = useMemo(() => FlatLogData(logData), [logData]);
|
||||||
|
|
||||||
@@ -133,24 +129,35 @@ function ListLogView({
|
|||||||
);
|
);
|
||||||
const isReadOnlyLog = !isLogsExplorerPage;
|
const isReadOnlyLog = !isLogsExplorerPage;
|
||||||
|
|
||||||
|
const {
|
||||||
|
activeLog: activeContextLog,
|
||||||
|
onAddToQuery: handleAddToQuery,
|
||||||
|
onSetActiveLog: handleSetActiveContextLog,
|
||||||
|
onClearActiveLog: handleClearActiveContextLog,
|
||||||
|
} = useActiveLog();
|
||||||
|
|
||||||
const isDarkMode = useIsDarkMode();
|
const isDarkMode = useIsDarkMode();
|
||||||
|
|
||||||
const handleDetailedView = useCallback(() => {
|
const handlerClearActiveContextLog = useCallback(
|
||||||
if (isActiveLog) {
|
(event: React.MouseEvent | React.KeyboardEvent) => {
|
||||||
onClearActiveLog?.();
|
event.preventDefault();
|
||||||
return;
|
event.stopPropagation();
|
||||||
}
|
handleClearActiveContextLog();
|
||||||
|
},
|
||||||
|
[handleClearActiveContextLog],
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleDetailedView = useCallback(() => {
|
||||||
onSetActiveLog(logData);
|
onSetActiveLog(logData);
|
||||||
}, [logData, onSetActiveLog, isActiveLog, onClearActiveLog]);
|
}, [logData, onSetActiveLog]);
|
||||||
|
|
||||||
const handleShowContext = useCallback(
|
const handleShowContext = useCallback(
|
||||||
(event: React.MouseEvent) => {
|
(event: React.MouseEvent) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
onSetActiveLog(logData, VIEW_TYPES.CONTEXT);
|
handleSetActiveContextLog(logData);
|
||||||
},
|
},
|
||||||
[logData, onSetActiveLog],
|
[logData, handleSetActiveContextLog],
|
||||||
);
|
);
|
||||||
|
|
||||||
const updatedSelecedFields = useMemo(
|
const updatedSelecedFields = useMemo(
|
||||||
@@ -179,7 +186,11 @@ function ListLogView({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Container
|
<Container
|
||||||
$isActiveLog={isHighlighted || activeLog?.id === logData.id}
|
$isActiveLog={
|
||||||
|
isHighlighted ||
|
||||||
|
activeLog?.id === logData.id ||
|
||||||
|
activeContextLog?.id === logData.id
|
||||||
|
}
|
||||||
$isDarkMode={isDarkMode}
|
$isDarkMode={isDarkMode}
|
||||||
$logType={logType}
|
$logType={logType}
|
||||||
onClick={handleDetailedView}
|
onClick={handleDetailedView}
|
||||||
@@ -240,6 +251,15 @@ function ListLogView({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Container>
|
</Container>
|
||||||
|
{activeContextLog && (
|
||||||
|
<LogDetail
|
||||||
|
log={activeContextLog}
|
||||||
|
onAddToQuery={handleAddToQuery}
|
||||||
|
selectedTab={VIEW_TYPES.CONTEXT}
|
||||||
|
onClose={handlerClearActiveContextLog}
|
||||||
|
handleChangeSelectedView={handleChangeSelectedView}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
import {
|
import {
|
||||||
|
KeyboardEvent,
|
||||||
memo,
|
memo,
|
||||||
MouseEvent,
|
MouseEvent,
|
||||||
MouseEventHandler,
|
MouseEventHandler,
|
||||||
useCallback,
|
useCallback,
|
||||||
useMemo,
|
useMemo,
|
||||||
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { Color } from '@signozhq/design-tokens';
|
import { Color } from '@signozhq/design-tokens';
|
||||||
import { Tooltip } from 'antd';
|
import { DrawerProps, Tooltip } from 'antd';
|
||||||
import { VIEW_TYPES } from 'components/LogDetail/constants';
|
import LogDetail from 'components/LogDetail';
|
||||||
|
import { VIEW_TYPES, VIEWS } from 'components/LogDetail/constants';
|
||||||
import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
|
import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
|
||||||
import { getSanitizedLogBody } from 'container/LogDetailedView/utils';
|
import { getSanitizedLogBody } from 'container/LogDetailedView/utils';
|
||||||
|
import { useActiveLog } from 'hooks/logs/useActiveLog';
|
||||||
import { useCopyLogLink } from 'hooks/logs/useCopyLogLink';
|
import { useCopyLogLink } from 'hooks/logs/useCopyLogLink';
|
||||||
// hooks
|
// hooks
|
||||||
import { useIsDarkMode } from 'hooks/useDarkMode';
|
import { useIsDarkMode } from 'hooks/useDarkMode';
|
||||||
@@ -35,8 +39,7 @@ function RawLogView({
|
|||||||
selectedFields = [],
|
selectedFields = [],
|
||||||
fontSize,
|
fontSize,
|
||||||
onLogClick,
|
onLogClick,
|
||||||
onSetActiveLog,
|
handleChangeSelectedView,
|
||||||
onClearActiveLog,
|
|
||||||
}: RawLogViewProps): JSX.Element {
|
}: RawLogViewProps): JSX.Element {
|
||||||
const {
|
const {
|
||||||
isHighlighted: isUrlHighlighted,
|
isHighlighted: isUrlHighlighted,
|
||||||
@@ -45,6 +48,15 @@ function RawLogView({
|
|||||||
} = useCopyLogLink(data.id);
|
} = useCopyLogLink(data.id);
|
||||||
const flattenLogData = useMemo(() => FlatLogData(data), [data]);
|
const flattenLogData = useMemo(() => FlatLogData(data), [data]);
|
||||||
|
|
||||||
|
const {
|
||||||
|
activeLog,
|
||||||
|
onSetActiveLog,
|
||||||
|
onClearActiveLog,
|
||||||
|
onAddToQuery,
|
||||||
|
} = useActiveLog();
|
||||||
|
|
||||||
|
const [selectedTab, setSelectedTab] = useState<VIEWS | undefined>();
|
||||||
|
|
||||||
const isDarkMode = useIsDarkMode();
|
const isDarkMode = useIsDarkMode();
|
||||||
const isReadOnlyLog = !isLogsExplorerPage || isReadOnly;
|
const isReadOnlyLog = !isLogsExplorerPage || isReadOnly;
|
||||||
|
|
||||||
@@ -122,24 +134,34 @@ function RawLogView({
|
|||||||
// Use custom click handler if provided, otherwise use default behavior
|
// Use custom click handler if provided, otherwise use default behavior
|
||||||
if (onLogClick) {
|
if (onLogClick) {
|
||||||
onLogClick(data, event);
|
onLogClick(data, event);
|
||||||
return;
|
} else {
|
||||||
|
onSetActiveLog(data);
|
||||||
|
setSelectedTab(VIEW_TYPES.OVERVIEW);
|
||||||
}
|
}
|
||||||
if (isActiveLog) {
|
|
||||||
onClearActiveLog?.();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
onSetActiveLog?.(data);
|
|
||||||
},
|
},
|
||||||
[isReadOnly, onLogClick, isActiveLog, onSetActiveLog, data, onClearActiveLog],
|
[isReadOnly, data, onSetActiveLog, onLogClick],
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleCloseLogDetail: DrawerProps['onClose'] = useCallback(
|
||||||
|
(
|
||||||
|
event: MouseEvent<Element, globalThis.MouseEvent> | KeyboardEvent<Element>,
|
||||||
|
) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
onClearActiveLog();
|
||||||
|
setSelectedTab(undefined);
|
||||||
|
},
|
||||||
|
[onClearActiveLog],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleShowContext: MouseEventHandler<HTMLElement> = useCallback(
|
const handleShowContext: MouseEventHandler<HTMLElement> = useCallback(
|
||||||
(event) => {
|
(event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
// handleSetActiveContextLog(data);
|
||||||
onSetActiveLog?.(data, VIEW_TYPES.CONTEXT);
|
setSelectedTab(VIEW_TYPES.CONTEXT);
|
||||||
|
onSetActiveLog(data);
|
||||||
},
|
},
|
||||||
[data, onSetActiveLog],
|
[data, onSetActiveLog],
|
||||||
);
|
);
|
||||||
@@ -159,7 +181,7 @@ function RawLogView({
|
|||||||
$isDarkMode={isDarkMode}
|
$isDarkMode={isDarkMode}
|
||||||
$isReadOnly={isReadOnly}
|
$isReadOnly={isReadOnly}
|
||||||
$isHightlightedLog={isUrlHighlighted}
|
$isHightlightedLog={isUrlHighlighted}
|
||||||
$isActiveLog={isActiveLog}
|
$isActiveLog={activeLog?.id === data.id || isActiveLog}
|
||||||
$isCustomHighlighted={isHighlighted}
|
$isCustomHighlighted={isHighlighted}
|
||||||
$logType={logType}
|
$logType={logType}
|
||||||
fontSize={fontSize}
|
fontSize={fontSize}
|
||||||
@@ -196,6 +218,17 @@ function RawLogView({
|
|||||||
onLogCopy={onLogCopy}
|
onLogCopy={onLogCopy}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{selectedTab && (
|
||||||
|
<LogDetail
|
||||||
|
selectedTab={selectedTab}
|
||||||
|
log={activeLog}
|
||||||
|
onClose={handleCloseLogDetail}
|
||||||
|
onAddToQuery={onAddToQuery}
|
||||||
|
onClickActionItem={onAddToQuery}
|
||||||
|
handleChangeSelectedView={handleChangeSelectedView}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</RawLogViewContainer>
|
</RawLogViewContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ export const RawLogViewContainer = styled(Row)<{
|
|||||||
: `margin: 2px 0;`}
|
: `margin: 2px 0;`}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
${({ $isActiveLog, $logType }): string =>
|
||||||
|
getActiveLogBackground($isActiveLog, true, $logType)}
|
||||||
|
|
||||||
${({ $isReadOnly, $isActiveLog, $isDarkMode, $logType }): string =>
|
${({ $isReadOnly, $isActiveLog, $isDarkMode, $logType }): string =>
|
||||||
$isActiveLog
|
$isActiveLog
|
||||||
? getActiveLogBackground($isActiveLog, $isDarkMode, $logType)
|
? getActiveLogBackground($isActiveLog, $isDarkMode, $logType)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { MouseEvent } from 'react';
|
import { MouseEvent } from 'react';
|
||||||
import { VIEW_TYPES } from 'components/LogDetail/constants';
|
|
||||||
import { ChangeViewFunctionType } from 'container/ExplorerOptions/types';
|
import { ChangeViewFunctionType } from 'container/ExplorerOptions/types';
|
||||||
import { FontSize } from 'container/OptionsMenu/types';
|
import { FontSize } from 'container/OptionsMenu/types';
|
||||||
import { IField } from 'types/api/logs/fields';
|
import { IField } from 'types/api/logs/fields';
|
||||||
@@ -17,11 +16,6 @@ export interface RawLogViewProps {
|
|||||||
selectedFields?: IField[];
|
selectedFields?: IField[];
|
||||||
onLogClick?: (log: ILog, event: MouseEvent) => void;
|
onLogClick?: (log: ILog, event: MouseEvent) => void;
|
||||||
handleChangeSelectedView?: ChangeViewFunctionType;
|
handleChangeSelectedView?: ChangeViewFunctionType;
|
||||||
onSetActiveLog?: (
|
|
||||||
log: ILog,
|
|
||||||
selectedTab?: typeof VIEW_TYPES[keyof typeof VIEW_TYPES],
|
|
||||||
) => void;
|
|
||||||
onClearActiveLog?: () => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RawLogContentProps {
|
export interface RawLogContentProps {
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
|
|||||||
enableRegexOption = false,
|
enableRegexOption = false,
|
||||||
isDynamicVariable = false,
|
isDynamicVariable = false,
|
||||||
showRetryButton = true,
|
showRetryButton = true,
|
||||||
waitingMessage,
|
|
||||||
...rest
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
// ===== State & Refs =====
|
// ===== State & Refs =====
|
||||||
@@ -1682,7 +1681,6 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
|
|||||||
{!loading &&
|
{!loading &&
|
||||||
!errorMessage &&
|
!errorMessage &&
|
||||||
!noDataMessage &&
|
!noDataMessage &&
|
||||||
!waitingMessage &&
|
|
||||||
!(showIncompleteDataMessage && isScrolledToBottom) && (
|
!(showIncompleteDataMessage && isScrolledToBottom) && (
|
||||||
<section className="navigate">
|
<section className="navigate">
|
||||||
<ArrowDown size={8} className="icons" />
|
<ArrowDown size={8} className="icons" />
|
||||||
@@ -1700,17 +1698,7 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
|
|||||||
<div className="navigation-text">Refreshing values...</div>
|
<div className="navigation-text">Refreshing values...</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!loading && waitingMessage && (
|
{errorMessage && !loading && (
|
||||||
<div className="navigation-loading">
|
|
||||||
<div className="navigation-icons">
|
|
||||||
<LoadingOutlined />
|
|
||||||
</div>
|
|
||||||
<div className="navigation-text" title={waitingMessage}>
|
|
||||||
{waitingMessage}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{errorMessage && !loading && !waitingMessage && (
|
|
||||||
<div className="navigation-error">
|
<div className="navigation-error">
|
||||||
<div className="navigation-text">
|
<div className="navigation-text">
|
||||||
{errorMessage || SOMETHING_WENT_WRONG}
|
{errorMessage || SOMETHING_WENT_WRONG}
|
||||||
@@ -1732,7 +1720,6 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
|
|||||||
{showIncompleteDataMessage &&
|
{showIncompleteDataMessage &&
|
||||||
isScrolledToBottom &&
|
isScrolledToBottom &&
|
||||||
!loading &&
|
!loading &&
|
||||||
!waitingMessage &&
|
|
||||||
!errorMessage && (
|
!errorMessage && (
|
||||||
<div className="navigation-text-incomplete">
|
<div className="navigation-text-incomplete">
|
||||||
Don't see the value? Use search
|
Don't see the value? Use search
|
||||||
@@ -1775,7 +1762,6 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
|
|||||||
isDarkMode,
|
isDarkMode,
|
||||||
isDynamicVariable,
|
isDynamicVariable,
|
||||||
showRetryButton,
|
showRetryButton,
|
||||||
waitingMessage,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Custom handler for dropdown visibility changes
|
// Custom handler for dropdown visibility changes
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
|
|||||||
showIncompleteDataMessage = false,
|
showIncompleteDataMessage = false,
|
||||||
showRetryButton = true,
|
showRetryButton = true,
|
||||||
isDynamicVariable = false,
|
isDynamicVariable = false,
|
||||||
waitingMessage,
|
|
||||||
...rest
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
// ===== State & Refs =====
|
// ===== State & Refs =====
|
||||||
@@ -569,7 +568,6 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
|
|||||||
{!loading &&
|
{!loading &&
|
||||||
!errorMessage &&
|
!errorMessage &&
|
||||||
!noDataMessage &&
|
!noDataMessage &&
|
||||||
!waitingMessage &&
|
|
||||||
!(showIncompleteDataMessage && isScrolledToBottom) && (
|
!(showIncompleteDataMessage && isScrolledToBottom) && (
|
||||||
<section className="navigate">
|
<section className="navigate">
|
||||||
<ArrowDown size={8} className="icons" />
|
<ArrowDown size={8} className="icons" />
|
||||||
@@ -585,16 +583,6 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
|
|||||||
<div className="navigation-text">Refreshing values...</div>
|
<div className="navigation-text">Refreshing values...</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!loading && waitingMessage && (
|
|
||||||
<div className="navigation-loading">
|
|
||||||
<div className="navigation-icons">
|
|
||||||
<LoadingOutlined />
|
|
||||||
</div>
|
|
||||||
<div className="navigation-text" title={waitingMessage}>
|
|
||||||
{waitingMessage}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{errorMessage && !loading && (
|
{errorMessage && !loading && (
|
||||||
<div className="navigation-error">
|
<div className="navigation-error">
|
||||||
<div className="navigation-text">
|
<div className="navigation-text">
|
||||||
@@ -617,7 +605,6 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
|
|||||||
{showIncompleteDataMessage &&
|
{showIncompleteDataMessage &&
|
||||||
isScrolledToBottom &&
|
isScrolledToBottom &&
|
||||||
!loading &&
|
!loading &&
|
||||||
!waitingMessage &&
|
|
||||||
!errorMessage && (
|
!errorMessage && (
|
||||||
<div className="navigation-text-incomplete">
|
<div className="navigation-text-incomplete">
|
||||||
Don't see the value? Use search
|
Don't see the value? Use search
|
||||||
@@ -654,7 +641,6 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
|
|||||||
showRetryButton,
|
showRetryButton,
|
||||||
isDarkMode,
|
isDarkMode,
|
||||||
isDynamicVariable,
|
isDynamicVariable,
|
||||||
waitingMessage,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Handle dropdown visibility changes
|
// Handle dropdown visibility changes
|
||||||
|
|||||||
@@ -78,10 +78,12 @@ function TestWrapper({ children }: { children: React.ReactNode }): JSX.Element {
|
|||||||
describe('VariableItem Integration Tests', () => {
|
describe('VariableItem Integration Tests', () => {
|
||||||
let user: ReturnType<typeof userEvent.setup>;
|
let user: ReturnType<typeof userEvent.setup>;
|
||||||
let mockOnValueUpdate: jest.Mock;
|
let mockOnValueUpdate: jest.Mock;
|
||||||
|
let mockSetVariablesToGetUpdated: jest.Mock;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
user = userEvent.setup();
|
user = userEvent.setup();
|
||||||
mockOnValueUpdate = jest.fn();
|
mockOnValueUpdate = jest.fn();
|
||||||
|
mockSetVariablesToGetUpdated = jest.fn();
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -100,6 +102,9 @@ describe('VariableItem Integration Tests', () => {
|
|||||||
variableData={variable}
|
variableData={variable}
|
||||||
existingVariables={{}}
|
existingVariables={{}}
|
||||||
onValueUpdate={mockOnValueUpdate}
|
onValueUpdate={mockOnValueUpdate}
|
||||||
|
variablesToGetUpdated={[]}
|
||||||
|
setVariablesToGetUpdated={mockSetVariablesToGetUpdated}
|
||||||
|
dependencyData={null}
|
||||||
/>
|
/>
|
||||||
</TestWrapper>,
|
</TestWrapper>,
|
||||||
);
|
);
|
||||||
@@ -145,6 +150,9 @@ describe('VariableItem Integration Tests', () => {
|
|||||||
variableData={variable}
|
variableData={variable}
|
||||||
existingVariables={{}}
|
existingVariables={{}}
|
||||||
onValueUpdate={mockOnValueUpdate}
|
onValueUpdate={mockOnValueUpdate}
|
||||||
|
variablesToGetUpdated={[]}
|
||||||
|
setVariablesToGetUpdated={mockSetVariablesToGetUpdated}
|
||||||
|
dependencyData={null}
|
||||||
/>
|
/>
|
||||||
</TestWrapper>,
|
</TestWrapper>,
|
||||||
);
|
);
|
||||||
@@ -187,6 +195,9 @@ describe('VariableItem Integration Tests', () => {
|
|||||||
variableData={variable}
|
variableData={variable}
|
||||||
existingVariables={{}}
|
existingVariables={{}}
|
||||||
onValueUpdate={mockOnValueUpdate}
|
onValueUpdate={mockOnValueUpdate}
|
||||||
|
variablesToGetUpdated={[]}
|
||||||
|
setVariablesToGetUpdated={mockSetVariablesToGetUpdated}
|
||||||
|
dependencyData={null}
|
||||||
/>
|
/>
|
||||||
</TestWrapper>,
|
</TestWrapper>,
|
||||||
);
|
);
|
||||||
@@ -236,6 +247,9 @@ describe('VariableItem Integration Tests', () => {
|
|||||||
variableData={variable}
|
variableData={variable}
|
||||||
existingVariables={{}}
|
existingVariables={{}}
|
||||||
onValueUpdate={mockOnValueUpdate}
|
onValueUpdate={mockOnValueUpdate}
|
||||||
|
variablesToGetUpdated={[]}
|
||||||
|
setVariablesToGetUpdated={mockSetVariablesToGetUpdated}
|
||||||
|
dependencyData={null}
|
||||||
/>
|
/>
|
||||||
</TestWrapper>,
|
</TestWrapper>,
|
||||||
);
|
);
|
||||||
@@ -258,6 +272,9 @@ describe('VariableItem Integration Tests', () => {
|
|||||||
variableData={variable}
|
variableData={variable}
|
||||||
existingVariables={{}}
|
existingVariables={{}}
|
||||||
onValueUpdate={mockOnValueUpdate}
|
onValueUpdate={mockOnValueUpdate}
|
||||||
|
variablesToGetUpdated={[]}
|
||||||
|
setVariablesToGetUpdated={mockSetVariablesToGetUpdated}
|
||||||
|
dependencyData={null}
|
||||||
/>
|
/>
|
||||||
</TestWrapper>,
|
</TestWrapper>,
|
||||||
);
|
);
|
||||||
@@ -291,6 +308,9 @@ describe('VariableItem Integration Tests', () => {
|
|||||||
variableData={variable}
|
variableData={variable}
|
||||||
existingVariables={{}}
|
existingVariables={{}}
|
||||||
onValueUpdate={mockOnValueUpdate}
|
onValueUpdate={mockOnValueUpdate}
|
||||||
|
variablesToGetUpdated={[]}
|
||||||
|
setVariablesToGetUpdated={mockSetVariablesToGetUpdated}
|
||||||
|
dependencyData={null}
|
||||||
/>
|
/>
|
||||||
</TestWrapper>,
|
</TestWrapper>,
|
||||||
);
|
);
|
||||||
@@ -324,6 +344,9 @@ describe('VariableItem Integration Tests', () => {
|
|||||||
variableData={variable}
|
variableData={variable}
|
||||||
existingVariables={{}}
|
existingVariables={{}}
|
||||||
onValueUpdate={mockOnValueUpdate}
|
onValueUpdate={mockOnValueUpdate}
|
||||||
|
variablesToGetUpdated={[]}
|
||||||
|
setVariablesToGetUpdated={mockSetVariablesToGetUpdated}
|
||||||
|
dependencyData={null}
|
||||||
/>
|
/>
|
||||||
</TestWrapper>,
|
</TestWrapper>,
|
||||||
);
|
);
|
||||||
@@ -346,6 +369,9 @@ describe('VariableItem Integration Tests', () => {
|
|||||||
variableData={variable}
|
variableData={variable}
|
||||||
existingVariables={{}}
|
existingVariables={{}}
|
||||||
onValueUpdate={mockOnValueUpdate}
|
onValueUpdate={mockOnValueUpdate}
|
||||||
|
variablesToGetUpdated={[]}
|
||||||
|
setVariablesToGetUpdated={mockSetVariablesToGetUpdated}
|
||||||
|
dependencyData={null}
|
||||||
/>
|
/>
|
||||||
</TestWrapper>,
|
</TestWrapper>,
|
||||||
);
|
);
|
||||||
@@ -379,6 +405,9 @@ describe('VariableItem Integration Tests', () => {
|
|||||||
variableData={variable}
|
variableData={variable}
|
||||||
existingVariables={{}}
|
existingVariables={{}}
|
||||||
onValueUpdate={mockOnValueUpdate}
|
onValueUpdate={mockOnValueUpdate}
|
||||||
|
variablesToGetUpdated={[]}
|
||||||
|
setVariablesToGetUpdated={mockSetVariablesToGetUpdated}
|
||||||
|
dependencyData={null}
|
||||||
/>
|
/>
|
||||||
</TestWrapper>,
|
</TestWrapper>,
|
||||||
);
|
);
|
||||||
@@ -432,6 +461,9 @@ describe('VariableItem Integration Tests', () => {
|
|||||||
variableData={variable}
|
variableData={variable}
|
||||||
existingVariables={{}}
|
existingVariables={{}}
|
||||||
onValueUpdate={mockOnValueUpdate}
|
onValueUpdate={mockOnValueUpdate}
|
||||||
|
variablesToGetUpdated={[]}
|
||||||
|
setVariablesToGetUpdated={mockSetVariablesToGetUpdated}
|
||||||
|
dependencyData={null}
|
||||||
/>
|
/>
|
||||||
</TestWrapper>,
|
</TestWrapper>,
|
||||||
);
|
);
|
||||||
@@ -476,6 +508,9 @@ describe('VariableItem Integration Tests', () => {
|
|||||||
variableData={variable}
|
variableData={variable}
|
||||||
existingVariables={{}}
|
existingVariables={{}}
|
||||||
onValueUpdate={mockOnValueUpdate}
|
onValueUpdate={mockOnValueUpdate}
|
||||||
|
variablesToGetUpdated={[]}
|
||||||
|
setVariablesToGetUpdated={mockSetVariablesToGetUpdated}
|
||||||
|
dependencyData={null}
|
||||||
/>
|
/>
|
||||||
</TestWrapper>,
|
</TestWrapper>,
|
||||||
);
|
);
|
||||||
@@ -513,6 +548,9 @@ describe('VariableItem Integration Tests', () => {
|
|||||||
variableData={variable}
|
variableData={variable}
|
||||||
existingVariables={{}}
|
existingVariables={{}}
|
||||||
onValueUpdate={mockOnValueUpdate}
|
onValueUpdate={mockOnValueUpdate}
|
||||||
|
variablesToGetUpdated={[]}
|
||||||
|
setVariablesToGetUpdated={mockSetVariablesToGetUpdated}
|
||||||
|
dependencyData={null}
|
||||||
/>
|
/>
|
||||||
</TestWrapper>,
|
</TestWrapper>,
|
||||||
);
|
);
|
||||||
@@ -544,6 +582,9 @@ describe('VariableItem Integration Tests', () => {
|
|||||||
variableData={variable}
|
variableData={variable}
|
||||||
existingVariables={{}}
|
existingVariables={{}}
|
||||||
onValueUpdate={mockOnValueUpdate}
|
onValueUpdate={mockOnValueUpdate}
|
||||||
|
variablesToGetUpdated={[]}
|
||||||
|
setVariablesToGetUpdated={mockSetVariablesToGetUpdated}
|
||||||
|
dependencyData={null}
|
||||||
/>
|
/>
|
||||||
</TestWrapper>,
|
</TestWrapper>,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ export interface CustomSelectProps extends Omit<SelectProps, 'options'> {
|
|||||||
showIncompleteDataMessage?: boolean;
|
showIncompleteDataMessage?: boolean;
|
||||||
showRetryButton?: boolean;
|
showRetryButton?: boolean;
|
||||||
isDynamicVariable?: boolean;
|
isDynamicVariable?: boolean;
|
||||||
waitingMessage?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CustomTagProps {
|
export interface CustomTagProps {
|
||||||
@@ -67,5 +66,4 @@ export interface CustomMultiSelectProps
|
|||||||
enableRegexOption?: boolean;
|
enableRegexOption?: boolean;
|
||||||
isDynamicVariable?: boolean;
|
isDynamicVariable?: boolean;
|
||||||
showRetryButton?: boolean;
|
showRetryButton?: boolean;
|
||||||
waitingMessage?: string;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -282,11 +282,11 @@ export default function QuickFilters(props: IQuickFiltersProps): JSX.Element {
|
|||||||
size="small"
|
size="small"
|
||||||
style={{ marginLeft: 'auto' }}
|
style={{ marginLeft: 'auto' }}
|
||||||
checked={showIP ?? true}
|
checked={showIP ?? true}
|
||||||
onChange={(checked): void => {
|
onClick={(): void => {
|
||||||
logEvent('API Monitoring: Show IP addresses clicked', {
|
logEvent('API Monitoring: Show IP addresses clicked', {
|
||||||
showIP: checked,
|
showIP: !(showIP ?? true),
|
||||||
});
|
});
|
||||||
setParams({ showIP: checked });
|
setParams({ showIP });
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
import { ENVIRONMENT } from 'constants/env';
|
import { ENVIRONMENT } from 'constants/env';
|
||||||
import {
|
|
||||||
ApiMonitoringParams,
|
|
||||||
useApiMonitoringParams,
|
|
||||||
} from 'container/ApiMonitoring/queryParams';
|
|
||||||
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
||||||
import {
|
import {
|
||||||
otherFiltersResponse,
|
otherFiltersResponse,
|
||||||
@@ -22,15 +18,10 @@ import { QuickFiltersConfig } from './constants';
|
|||||||
jest.mock('hooks/queryBuilder/useQueryBuilder', () => ({
|
jest.mock('hooks/queryBuilder/useQueryBuilder', () => ({
|
||||||
useQueryBuilder: jest.fn(),
|
useQueryBuilder: jest.fn(),
|
||||||
}));
|
}));
|
||||||
jest.mock('container/ApiMonitoring/queryParams');
|
|
||||||
|
|
||||||
const handleFilterVisibilityChange = jest.fn();
|
const handleFilterVisibilityChange = jest.fn();
|
||||||
const redirectWithQueryBuilderData = jest.fn();
|
const redirectWithQueryBuilderData = jest.fn();
|
||||||
const putHandler = jest.fn();
|
const putHandler = jest.fn();
|
||||||
const mockSetApiMonitoringParams = jest.fn() as jest.MockedFunction<
|
|
||||||
(newParams: Partial<ApiMonitoringParams>, replace?: boolean) => void
|
|
||||||
>;
|
|
||||||
const mockUseApiMonitoringParams = jest.mocked(useApiMonitoringParams);
|
|
||||||
|
|
||||||
const BASE_URL = ENVIRONMENT.baseURL;
|
const BASE_URL = ENVIRONMENT.baseURL;
|
||||||
const SIGNAL = SignalType.LOGS;
|
const SIGNAL = SignalType.LOGS;
|
||||||
@@ -93,28 +84,6 @@ TestQuickFilters.defaultProps = {
|
|||||||
config: QuickFiltersConfig,
|
config: QuickFiltersConfig,
|
||||||
};
|
};
|
||||||
|
|
||||||
function TestQuickFiltersApiMonitoring({
|
|
||||||
signal = SignalType.LOGS,
|
|
||||||
config = QuickFiltersConfig,
|
|
||||||
}: {
|
|
||||||
signal?: SignalType;
|
|
||||||
config?: IQuickFiltersConfig[];
|
|
||||||
}): JSX.Element {
|
|
||||||
return (
|
|
||||||
<QuickFilters
|
|
||||||
source={QuickFiltersSource.API_MONITORING}
|
|
||||||
config={config}
|
|
||||||
handleFilterVisibilityChange={handleFilterVisibilityChange}
|
|
||||||
signal={signal}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
TestQuickFiltersApiMonitoring.defaultProps = {
|
|
||||||
signal: '',
|
|
||||||
config: QuickFiltersConfig,
|
|
||||||
};
|
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
server.listen();
|
server.listen();
|
||||||
});
|
});
|
||||||
@@ -143,10 +112,6 @@ beforeEach(() => {
|
|||||||
lastUsedQuery: 0,
|
lastUsedQuery: 0,
|
||||||
redirectWithQueryBuilderData,
|
redirectWithQueryBuilderData,
|
||||||
});
|
});
|
||||||
mockUseApiMonitoringParams.mockReturnValue([
|
|
||||||
{ showIP: true } as ApiMonitoringParams,
|
|
||||||
mockSetApiMonitoringParams,
|
|
||||||
]);
|
|
||||||
setupServer();
|
setupServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -286,24 +251,6 @@ describe('Quick Filters', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('toggles Show IP addresses and updates API Monitoring params', async () => {
|
|
||||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
|
||||||
|
|
||||||
render(<TestQuickFiltersApiMonitoring />);
|
|
||||||
|
|
||||||
// Switch should be rendered and initially checked
|
|
||||||
expect(screen.getByText('Show IP addresses')).toBeInTheDocument();
|
|
||||||
const toggle = screen.getByRole('switch');
|
|
||||||
expect(toggle).toHaveAttribute('aria-checked', 'true');
|
|
||||||
|
|
||||||
await user.click(toggle);
|
|
||||||
|
|
||||||
await waitFor(() => {
|
|
||||||
expect(mockSetApiMonitoringParams).toHaveBeenCalledWith(
|
|
||||||
expect.objectContaining({ showIP: false }),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Quick Filters with custom filters', () => {
|
describe('Quick Filters with custom filters', () => {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { YAxisCategoryNames } from '../constants';
|
import { UniversalYAxisUnit } from '../types';
|
||||||
import { UniversalYAxisUnit, YAxisCategory } from '../types';
|
|
||||||
import {
|
import {
|
||||||
getUniversalNameFromMetricUnit,
|
getUniversalNameFromMetricUnit,
|
||||||
mapMetricUnitToUniversalUnit,
|
mapMetricUnitToUniversalUnit,
|
||||||
@@ -42,29 +41,29 @@ describe('YAxisUnitSelector utils', () => {
|
|||||||
|
|
||||||
describe('mergeCategories', () => {
|
describe('mergeCategories', () => {
|
||||||
it('merges categories correctly', () => {
|
it('merges categories correctly', () => {
|
||||||
const categories1: YAxisCategory[] = [
|
const categories1 = [
|
||||||
{
|
{
|
||||||
name: YAxisCategoryNames.Data,
|
name: '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: YAxisCategory[] = [
|
const categories2 = [
|
||||||
{
|
{
|
||||||
name: YAxisCategoryNames.Data,
|
name: 'Data',
|
||||||
units: [{ name: 'bits', id: UniversalYAxisUnit.BITS }],
|
units: [{ name: 'bits', id: UniversalYAxisUnit.BITS }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: YAxisCategoryNames.Time,
|
name: '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: YAxisCategoryNames.Data,
|
name: 'Data',
|
||||||
units: [
|
units: [
|
||||||
{ name: 'bytes', id: UniversalYAxisUnit.BYTES },
|
{ name: 'bytes', id: UniversalYAxisUnit.BYTES },
|
||||||
{ name: 'kilobytes', id: UniversalYAxisUnit.KILOBYTES },
|
{ name: 'kilobytes', id: UniversalYAxisUnit.KILOBYTES },
|
||||||
@@ -72,7 +71,7 @@ describe('YAxisUnitSelector utils', () => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: YAxisCategoryNames.Time,
|
name: 'Time',
|
||||||
units: [{ name: 'seconds', id: UniversalYAxisUnit.SECONDS }],
|
units: [{ name: 'seconds', id: UniversalYAxisUnit.SECONDS }],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -1,36 +1,5 @@
|
|||||||
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>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user