mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-02 14:00:58 +00:00
Compare commits
1 Commits
main
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e0654705f |
@@ -37,8 +37,3 @@ flags:
|
|||||||
disable_signup_without_invite: true
|
disable_signup_without_invite: true
|
||||||
disable_user_create_org: false
|
disable_user_create_org: false
|
||||||
allow_raw_resources: true
|
allow_raw_resources: true
|
||||||
|
|
||||||
{{if .IsPostgreSQL}}
|
|
||||||
postgres:
|
|
||||||
connection_string: postgresql://pangolin:{{.IsPostgreSQLPass}}@postgres:5432/pangolin
|
|
||||||
{{end}}
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: pangolin
|
name: pangolin
|
||||||
services:
|
services:
|
||||||
pangolin:
|
pangolin:
|
||||||
image: docker.io/fosrl/pangolin:{{if .IsEnterprise}}ee-{{end}}{{if .IsPostgreSQL}}postgresql-{{end}}{{.PangolinVersion}}
|
image: docker.io/fosrl/pangolin:{{if .IsEnterprise}}ee-{{end}}{{.PangolinVersion}}
|
||||||
container_name: pangolin
|
container_name: pangolin
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
deploy:
|
deploy:
|
||||||
@@ -10,20 +10,6 @@ services:
|
|||||||
memory: 1g
|
memory: 1g
|
||||||
reservations:
|
reservations:
|
||||||
memory: 256m
|
memory: 256m
|
||||||
{{if or .IsPostgreSQL .IsRedis}}
|
|
||||||
depends_on:
|
|
||||||
{{if .IsPostgreSQL}}
|
|
||||||
postgres:
|
|
||||||
condition: service_healthy
|
|
||||||
{{end}}
|
|
||||||
{{if .IsRedis}}
|
|
||||||
redis:
|
|
||||||
condition: service_healthy
|
|
||||||
{{end}}
|
|
||||||
networks:
|
|
||||||
- default
|
|
||||||
- backend
|
|
||||||
{{end}}
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/app/config
|
- ./config:/app/config
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@@ -74,56 +60,8 @@ services:
|
|||||||
- ./config/letsencrypt:/letsencrypt # Volume to store the Let's Encrypt certificates
|
- ./config/letsencrypt:/letsencrypt # Volume to store the Let's Encrypt certificates
|
||||||
- ./config/traefik/logs:/var/log/traefik # Volume to store Traefik logs
|
- ./config/traefik/logs:/var/log/traefik # Volume to store Traefik logs
|
||||||
|
|
||||||
{{if .IsPostgreSQL}}
|
|
||||||
postgres:
|
|
||||||
image: postgres:18
|
|
||||||
container_name: postgres
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
POSTGRES_USER: pangolin
|
|
||||||
POSTGRES_PASSWORD: {{.IsPostgreSQLPass}}
|
|
||||||
POSTGRES_DB: pangolin
|
|
||||||
volumes:
|
|
||||||
- ./postgres18:/var/lib/postgresql
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready -U pangolin"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
networks:
|
|
||||||
- backend
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{if .IsRedis}}
|
|
||||||
redis:
|
|
||||||
image: redis:8-trixie
|
|
||||||
container_name: redis
|
|
||||||
restart: unless-stopped
|
|
||||||
command: >
|
|
||||||
redis-server
|
|
||||||
--save 3600 1000
|
|
||||||
--appendonly yes
|
|
||||||
--requirepass {{.IsRedisPass}}
|
|
||||||
volumes:
|
|
||||||
- ./redis8:/data
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "redis-cli", "-a", "{{.IsRedisPass}}", "ping"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 3s
|
|
||||||
retries: 3
|
|
||||||
start_period: 10s
|
|
||||||
networks:
|
|
||||||
- backend
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
default:
|
default:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
name: pangolin_frontend
|
name: pangolin
|
||||||
{{if .EnableIPv6}} enable_ipv6: true{{end}}
|
{{if .EnableIPv6}} enable_ipv6: true{{end}}
|
||||||
{{if or .IsPostgreSQL .IsRedis}}
|
|
||||||
backend:
|
|
||||||
driver: bridge
|
|
||||||
name: pangolin_backend
|
|
||||||
internal: true
|
|
||||||
{{end}}
|
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
{{if .IsRedis}}
|
|
||||||
redis:
|
|
||||||
host: "redis"
|
|
||||||
port: 6379
|
|
||||||
password: "{{.IsRedisPass}}"
|
|
||||||
{{end}}
|
|
||||||
@@ -57,10 +57,6 @@ type Config struct {
|
|||||||
EnableMaxMind bool
|
EnableMaxMind bool
|
||||||
Secret string
|
Secret string
|
||||||
IsEnterprise bool
|
IsEnterprise bool
|
||||||
IsPostgreSQL bool
|
|
||||||
IsPostgreSQLPass string
|
|
||||||
IsRedis bool
|
|
||||||
IsRedisPass string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type SupportedContainer string
|
type SupportedContainer string
|
||||||
@@ -490,17 +486,6 @@ func collectUserInput() Config {
|
|||||||
fmt.Println("\n=== Basic Configuration ===")
|
fmt.Println("\n=== Basic Configuration ===")
|
||||||
|
|
||||||
config.IsEnterprise = readBoolNoDefault("Do you want to install the Enterprise version of Pangolin? The EE is free for personal use or for businesses making less than 100k USD annually.")
|
config.IsEnterprise = readBoolNoDefault("Do you want to install the Enterprise version of Pangolin? The EE is free for personal use or for businesses making less than 100k USD annually.")
|
||||||
if config.IsEnterprise {
|
|
||||||
config.IsRedis = readBool("Do you want to run the Redis containers locally? Required for HA.")
|
|
||||||
if config.IsRedis {
|
|
||||||
config.IsRedisPass = readPassword("Enter a unique password for the Redis service.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
config.IsPostgreSQL = readBool("Do you want to run the PostgreSQL containers locally? Otherwise, default to the local SQLite database only.", false)
|
|
||||||
if config.IsPostgreSQL {
|
|
||||||
config.IsPostgreSQLPass = readPassword("Enter a unique password for the PostgreSQL pangolin user.")
|
|
||||||
}
|
|
||||||
|
|
||||||
config.BaseDomain = readString("Enter your base domain (no subdomain e.g. example.com)", "")
|
config.BaseDomain = readString("Enter your base domain (no subdomain e.g. example.com)", "")
|
||||||
|
|
||||||
|
|||||||
33
package-lock.json
generated
33
package-lock.json
generated
@@ -81,7 +81,7 @@
|
|||||||
"posthog-node": "5.35.6",
|
"posthog-node": "5.35.6",
|
||||||
"qrcode.react": "4.2.0",
|
"qrcode.react": "4.2.0",
|
||||||
"react": "19.2.6",
|
"react": "19.2.6",
|
||||||
"react-day-picker": "9.14.0",
|
"react-day-picker": "10.0.1",
|
||||||
"react-dom": "19.2.6",
|
"react-dom": "19.2.6",
|
||||||
"react-easy-sort": "1.8.0",
|
"react-easy-sort": "1.8.0",
|
||||||
"react-hook-form": "7.76.1",
|
"react-hook-form": "7.76.1",
|
||||||
@@ -6963,15 +6963,6 @@
|
|||||||
"@swc/counter": "^0.1.3"
|
"@swc/counter": "^0.1.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tabby_ai/hijri-converter": {
|
|
||||||
"version": "1.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/@tabby_ai/hijri-converter/-/hijri-converter-1.0.5.tgz",
|
|
||||||
"integrity": "sha512-r5bClKrcIusDoo049dSL8CawnHR6mRdDwhlQuIgZRNty68q0x8k3Lf1BtPAMxRf/GgnHBnIO4ujd3+GQdLWzxQ==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=16.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@tailwindcss/forms": {
|
"node_modules/@tailwindcss/forms": {
|
||||||
"version": "0.5.11",
|
"version": "0.5.11",
|
||||||
"resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.11.tgz",
|
"resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.11.tgz",
|
||||||
@@ -10284,12 +10275,6 @@
|
|||||||
"url": "https://github.com/sponsors/kossnocorp"
|
"url": "https://github.com/sponsors/kossnocorp"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/date-fns-jalali": {
|
|
||||||
"version": "4.1.0-0",
|
|
||||||
"resolved": "https://registry.npmjs.org/date-fns-jalali/-/date-fns-jalali-4.1.0-0.tgz",
|
|
||||||
"integrity": "sha512-hTIP/z+t+qKwBDcmmsnmjWTduxCg+5KfdqWQvb2X/8C9+knYY6epN/pfxdDuyVlSVeFz0sM5eEfwIUQ70U4ckg==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/debounce": {
|
"node_modules/debounce": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/debounce/-/debounce-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/debounce/-/debounce-2.2.0.tgz",
|
||||||
@@ -15765,15 +15750,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-day-picker": {
|
"node_modules/react-day-picker": {
|
||||||
"version": "9.14.0",
|
"version": "10.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-day-picker/-/react-day-picker-9.14.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-day-picker/-/react-day-picker-10.0.1.tgz",
|
||||||
"integrity": "sha512-tBaoDWjPwe0M5pGrum4H0SR6Lyk+BO9oHnp9JbKpGKW2mlraNPgP9BMfsg5pWpwrssARmeqk7YBl2oXutZTaHA==",
|
"integrity": "sha512-eNh6BlwcYInWaJtRv18mXQ06Ys/H6rdTZAnTaSdOYJuTpwP1JMCHNd1FDRadA+gbeinq+psdULN5Xnowy9mV8w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@date-fns/tz": "^1.4.1",
|
"@date-fns/tz": "^1.4.1",
|
||||||
"@tabby_ai/hijri-converter": "1.0.5",
|
"date-fns": "^4.1.0"
|
||||||
"date-fns": "^4.1.0",
|
|
||||||
"date-fns-jalali": "4.1.0-0"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
@@ -15783,7 +15766,13 @@
|
|||||||
"url": "https://github.com/sponsors/gpbl"
|
"url": "https://github.com/sponsors/gpbl"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
"@types/react": ">=16.8.0",
|
||||||
"react": ">=16.8.0"
|
"react": ">=16.8.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@types/react": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-dom": {
|
"node_modules/react-dom": {
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
"posthog-node": "5.35.6",
|
"posthog-node": "5.35.6",
|
||||||
"qrcode.react": "4.2.0",
|
"qrcode.react": "4.2.0",
|
||||||
"react": "19.2.6",
|
"react": "19.2.6",
|
||||||
"react-day-picker": "9.14.0",
|
"react-day-picker": "10.0.1",
|
||||||
"react-dom": "19.2.6",
|
"react-dom": "19.2.6",
|
||||||
"react-easy-sort": "1.8.0",
|
"react-easy-sort": "1.8.0",
|
||||||
"react-hook-form": "7.76.1",
|
"react-hook-form": "7.76.1",
|
||||||
|
|||||||
@@ -152,17 +152,11 @@ function getOpenApiDocumentation() {
|
|||||||
|
|
||||||
if (!hasExistingResponses) {
|
if (!hasExistingResponses) {
|
||||||
def.route.responses = {
|
def.route.responses = {
|
||||||
"200": {
|
"*": {
|
||||||
description: "Successful response",
|
description: "",
|
||||||
content: {
|
content: {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
schema: z.object({
|
schema: z.object({})
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -873,13 +873,7 @@ export const portRangeStringSchema = z
|
|||||||
message:
|
message:
|
||||||
'Port range must be "*" for all ports, or a comma-separated list of ports and ranges (e.g., "80,443,8000-9000"). Ports must be between 1 and 65535, and ranges must have start <= end.'
|
'Port range must be "*" for all ports, or a comma-separated list of ports and ranges (e.g., "80,443,8000-9000"). Ports must be between 1 and 65535, and ranges must have start <= end.'
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
.openapi({
|
|
||||||
type: "string",
|
|
||||||
description:
|
|
||||||
'Port range string. Use "*" for all ports, a comma-separated list of ports, or ranges (e.g., "80,443,8000-9000"). Ports must be between 1 and 65535.',
|
|
||||||
example: "80,443,8000-9000"
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a port range string into an array of port range objects
|
* Parses a port range string into an array of port range objects
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
import { z } from "zod";
|
|
||||||
|
|
||||||
export function createApiResponseSchema<T extends z.ZodTypeAny>(dataSchema: T) {
|
|
||||||
return z.object({
|
|
||||||
data: dataSchema.nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -202,22 +202,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function createAlertRule(
|
export async function createAlertRule(
|
||||||
|
|||||||
@@ -38,22 +38,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function deleteAlertRule(
|
export async function deleteAlertRule(
|
||||||
|
|||||||
@@ -49,22 +49,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function getAlertRule(
|
export async function getAlertRule(
|
||||||
|
|||||||
@@ -95,22 +95,7 @@ registry.registerPath({
|
|||||||
query: querySchema,
|
query: querySchema,
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function listAlertRules(
|
export async function listAlertRules(
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
import { db } from "@server/db";
|
import { db } from "@server/db";
|
||||||
import {
|
import {
|
||||||
alertRules,
|
alertRules,
|
||||||
@@ -149,10 +148,6 @@ const bodySchema = z
|
|||||||
export type UpdateAlertRuleResponse = {
|
export type UpdateAlertRuleResponse = {
|
||||||
alertRuleId: number;
|
alertRuleId: number;
|
||||||
};
|
};
|
||||||
const UpdateAlertRuleResponseDataSchema = z.object({
|
|
||||||
alertRuleId: z.number()
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "post",
|
method: "post",
|
||||||
@@ -169,16 +164,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(UpdateAlertRuleResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function updateAlertRule(
|
export async function updateAlertRule(
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import type { NextFunction, Request, Response } from "express";
|
|||||||
|
|
||||||
const paramsSchema = z.strictObject({
|
const paramsSchema = z.strictObject({
|
||||||
orgId: z.string(),
|
orgId: z.string(),
|
||||||
approvalId: z.coerce.number().int().positive()
|
approvalId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
});
|
});
|
||||||
|
|
||||||
const bodySchema = z.strictObject({
|
const bodySchema = z.strictObject({
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import { OpenAPITags } from "@server/openApi";
|
|||||||
import createHttpError from "http-errors";
|
import createHttpError from "http-errors";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import { z } from "zod";
|
|
||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
import {
|
import {
|
||||||
queryAccessAuditLogsParams,
|
queryAccessAuditLogsParams,
|
||||||
@@ -38,22 +37,7 @@ registry.registerPath({
|
|||||||
query: queryAccessAuditLogsQuery,
|
query: queryAccessAuditLogsQuery,
|
||||||
params: queryAccessAuditLogsParams
|
params: queryAccessAuditLogsParams
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function exportAccessAuditLogs(
|
export async function exportAccessAuditLogs(
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import { OpenAPITags } from "@server/openApi";
|
|||||||
import createHttpError from "http-errors";
|
import createHttpError from "http-errors";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import { z } from "zod";
|
|
||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
import {
|
import {
|
||||||
queryActionAuditLogsParams,
|
queryActionAuditLogsParams,
|
||||||
@@ -38,22 +37,7 @@ registry.registerPath({
|
|||||||
query: queryActionAuditLogsQuery,
|
query: queryActionAuditLogsQuery,
|
||||||
params: queryActionAuditLogsParams
|
params: queryActionAuditLogsParams
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function exportActionAuditLogs(
|
export async function exportActionAuditLogs(
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import { OpenAPITags } from "@server/openApi";
|
|||||||
import createHttpError from "http-errors";
|
import createHttpError from "http-errors";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import { z } from "zod";
|
|
||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
import {
|
import {
|
||||||
queryConnectionAuditLogsParams,
|
queryConnectionAuditLogsParams,
|
||||||
@@ -38,22 +37,7 @@ registry.registerPath({
|
|||||||
query: queryConnectionAuditLogsQuery,
|
query: queryConnectionAuditLogsQuery,
|
||||||
params: queryConnectionAuditLogsParams
|
params: queryConnectionAuditLogsParams
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function exportConnectionAuditLogs(
|
export async function exportConnectionAuditLogs(
|
||||||
|
|||||||
@@ -338,22 +338,7 @@ registry.registerPath({
|
|||||||
query: queryAccessAuditLogsQuery,
|
query: queryAccessAuditLogsQuery,
|
||||||
params: queryAccessAuditLogsParams
|
params: queryAccessAuditLogsParams
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function queryAccessAuditLogs(
|
export async function queryAccessAuditLogs(
|
||||||
|
|||||||
@@ -165,22 +165,7 @@ registry.registerPath({
|
|||||||
query: queryActionAuditLogsQuery,
|
query: queryActionAuditLogsQuery,
|
||||||
params: queryActionAuditLogsParams
|
params: queryActionAuditLogsParams
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function queryActionAuditLogs(
|
export async function queryActionAuditLogs(
|
||||||
|
|||||||
@@ -453,22 +453,7 @@ registry.registerPath({
|
|||||||
query: queryConnectionAuditLogsQuery,
|
query: queryConnectionAuditLogsQuery,
|
||||||
params: queryConnectionAuditLogsParams
|
params: queryConnectionAuditLogsParams
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function queryConnectionAuditLogs(
|
export async function queryConnectionAuditLogs(
|
||||||
|
|||||||
@@ -39,22 +39,7 @@ const getOrgSchema = z.strictObject({
|
|||||||
// request: {
|
// request: {
|
||||||
// params: getOrgSchema
|
// params: getOrgSchema
|
||||||
// },
|
// },
|
||||||
// responses: {
|
// responses: {}
|
||||||
// 200: {
|
|
||||||
// description: "Successful response",
|
|
||||||
// content: {
|
|
||||||
// "application/json": {
|
|
||||||
// schema: z.object({
|
|
||||||
// data: z.unknown().nullable(),
|
|
||||||
// success: z.boolean(),
|
|
||||||
// error: z.boolean(),
|
|
||||||
// message: z.string(),
|
|
||||||
// status: z.number()
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
// });
|
||||||
|
|
||||||
export async function getOrgUsage(
|
export async function getOrgUsage(
|
||||||
|
|||||||
@@ -115,22 +115,7 @@ registry.registerPath({
|
|||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function getCertificate(
|
export async function getCertificate(
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import { fromError } from "zod-validation-error";
|
|||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
|
|
||||||
const restartCertificateParamsSchema = z.strictObject({
|
const restartCertificateParamsSchema = z.strictObject({
|
||||||
certId: z.coerce.number().int().positive(),
|
certId: z.string().transform(stoi).pipe(z.int().positive()),
|
||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -36,26 +36,11 @@ registry.registerPath({
|
|||||||
tags: ["Certificate"],
|
tags: ["Certificate"],
|
||||||
request: {
|
request: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
certId: z.coerce.number().int().positive(),
|
certId: z.string().transform(stoi).pipe(z.int().positive()),
|
||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function restartCertificate(
|
export async function restartCertificate(
|
||||||
|
|||||||
@@ -42,22 +42,7 @@ registry.registerPath({
|
|||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
query: querySchema
|
query: querySchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function checkDomainNamespaceAvailability(
|
export async function checkDomainNamespaceAvailability(
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import { OpenAPITags, registry } from "@server/openApi";
|
|||||||
import { isSubscribed } from "#private/lib/isSubscribed";
|
import { isSubscribed } from "#private/lib/isSubscribed";
|
||||||
import { build } from "@server/build";
|
import { build } from "@server/build";
|
||||||
import { tierMatrix } from "@server/lib/billing/tierMatrix";
|
import { tierMatrix } from "@server/lib/billing/tierMatrix";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
|
|
||||||
const paramsSchema = z.strictObject({});
|
const paramsSchema = z.strictObject({});
|
||||||
|
|
||||||
@@ -66,20 +65,6 @@ export type ListDomainNamespacesResponse = {
|
|||||||
pagination: { total: number; limit: number; offset: number };
|
pagination: { total: number; limit: number; offset: number };
|
||||||
};
|
};
|
||||||
|
|
||||||
const ListDomainNamespacesResponseDataSchema = z.object({
|
|
||||||
domainNamespaces: z.array(
|
|
||||||
z.object({
|
|
||||||
domainNamespaceId: z.string(),
|
|
||||||
domainId: z.string()
|
|
||||||
})
|
|
||||||
),
|
|
||||||
pagination: z.object({
|
|
||||||
total: z.number(),
|
|
||||||
limit: z.number(),
|
|
||||||
offset: z.number()
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "get",
|
method: "get",
|
||||||
path: "/domains/namepaces",
|
path: "/domains/namepaces",
|
||||||
@@ -88,18 +73,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
query: querySchema
|
query: querySchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(
|
|
||||||
ListDomainNamespacesResponseDataSchema
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function listDomainNamespaces(
|
export async function listDomainNamespaces(
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
import { db } from "@server/db";
|
import { db } from "@server/db";
|
||||||
import { eventStreamingDestinations } from "@server/db";
|
import { eventStreamingDestinations } from "@server/db";
|
||||||
import { logStreamingManager } from "#private/lib/logStreaming";
|
import { logStreamingManager } from "#private/lib/logStreaming";
|
||||||
@@ -43,10 +42,6 @@ const bodySchema = z.strictObject({
|
|||||||
export type CreateEventStreamingDestinationResponse = {
|
export type CreateEventStreamingDestinationResponse = {
|
||||||
destinationId: number;
|
destinationId: number;
|
||||||
};
|
};
|
||||||
const CreateEventStreamingDestinationResponseDataSchema = z.object({
|
|
||||||
destinationId: z.number()
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "put",
|
method: "put",
|
||||||
@@ -63,16 +58,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(CreateEventStreamingDestinationResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function createEventStreamingDestination(
|
export async function createEventStreamingDestination(
|
||||||
|
|||||||
@@ -38,22 +38,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function deleteEventStreamingDestination(
|
export async function deleteEventStreamingDestination(
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import { OpenAPITags, registry } from "@server/openApi";
|
|||||||
import { eq, sql } from "drizzle-orm";
|
import { eq, sql } from "drizzle-orm";
|
||||||
import { decrypt } from "@server/lib/crypto";
|
import { decrypt } from "@server/lib/crypto";
|
||||||
import config from "@server/lib/config";
|
import config from "@server/lib/config";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
|
|
||||||
const paramsSchema = z.strictObject({
|
const paramsSchema = z.strictObject({
|
||||||
orgId: z.string().nonempty()
|
orgId: z.string().nonempty()
|
||||||
@@ -68,31 +67,6 @@ export type ListEventStreamingDestinationsResponse = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const ListEventStreamingDestinationsResponseDataSchema = z.object({
|
|
||||||
destinations: z.array(
|
|
||||||
z.object({
|
|
||||||
destinationId: z.number(),
|
|
||||||
orgId: z.string(),
|
|
||||||
type: z.string(),
|
|
||||||
config: z.string(),
|
|
||||||
enabled: z.boolean(),
|
|
||||||
lastError: z.string().nullable(),
|
|
||||||
lastErrorAt: z.number().nullable(),
|
|
||||||
createdAt: z.number(),
|
|
||||||
updatedAt: z.number(),
|
|
||||||
sendConnectionLogs: z.boolean(),
|
|
||||||
sendRequestLogs: z.boolean(),
|
|
||||||
sendActionLogs: z.boolean(),
|
|
||||||
sendAccessLogs: z.boolean()
|
|
||||||
})
|
|
||||||
),
|
|
||||||
pagination: z.object({
|
|
||||||
total: z.number(),
|
|
||||||
limit: z.number(),
|
|
||||||
offset: z.number()
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
async function query(orgId: string, limit: number, offset: number) {
|
async function query(orgId: string, limit: number, offset: number) {
|
||||||
const res = await db
|
const res = await db
|
||||||
.select()
|
.select()
|
||||||
@@ -114,18 +88,7 @@ registry.registerPath({
|
|||||||
query: querySchema,
|
query: querySchema,
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(
|
|
||||||
ListEventStreamingDestinationsResponseDataSchema
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function listEventStreamingDestinations(
|
export async function listEventStreamingDestinations(
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
import { db } from "@server/db";
|
import { db } from "@server/db";
|
||||||
import { eventStreamingDestinations } from "@server/db";
|
import { eventStreamingDestinations } from "@server/db";
|
||||||
import response from "@server/lib/response";
|
import response from "@server/lib/response";
|
||||||
@@ -46,10 +45,6 @@ const bodySchema = z.strictObject({
|
|||||||
export type UpdateEventStreamingDestinationResponse = {
|
export type UpdateEventStreamingDestinationResponse = {
|
||||||
destinationId: number;
|
destinationId: number;
|
||||||
};
|
};
|
||||||
const UpdateEventStreamingDestinationResponseDataSchema = z.object({
|
|
||||||
destinationId: z.number()
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "post",
|
method: "post",
|
||||||
@@ -66,16 +61,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(UpdateEventStreamingDestinationResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function updateEventStreamingDestination(
|
export async function updateEventStreamingDestination(
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
import { db, targetHealthCheck, newts, sites } from "@server/db";
|
import { db, targetHealthCheck, newts, sites } from "@server/db";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import response from "@server/lib/response";
|
import response from "@server/lib/response";
|
||||||
@@ -53,10 +52,6 @@ const bodySchema = z.strictObject({
|
|||||||
export type CreateHealthCheckResponse = {
|
export type CreateHealthCheckResponse = {
|
||||||
targetHealthCheckId: number;
|
targetHealthCheckId: number;
|
||||||
};
|
};
|
||||||
const CreateHealthCheckResponseDataSchema = z.object({
|
|
||||||
targetHealthCheckId: z.number()
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "put",
|
method: "put",
|
||||||
@@ -73,16 +68,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(CreateHealthCheckResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function createHealthCheck(
|
export async function createHealthCheck(
|
||||||
|
|||||||
@@ -41,22 +41,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function deleteHealthCheck(
|
export async function deleteHealthCheck(
|
||||||
|
|||||||
@@ -68,22 +68,7 @@ registry.registerPath({
|
|||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
query: querySchema
|
query: querySchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function listHealthChecks(
|
export async function listHealthChecks(
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
import { db, targetHealthCheck, newts, sites } from "@server/db";
|
import { db, targetHealthCheck, newts, sites } from "@server/db";
|
||||||
import response from "@server/lib/response";
|
import response from "@server/lib/response";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
@@ -82,29 +81,6 @@ export type UpdateHealthCheckResponse = {
|
|||||||
hcHealthyThreshold: number | null;
|
hcHealthyThreshold: number | null;
|
||||||
hcUnhealthyThreshold: number | null;
|
hcUnhealthyThreshold: number | null;
|
||||||
};
|
};
|
||||||
const UpdateHealthCheckResponseDataSchema = z.object({
|
|
||||||
targetHealthCheckId: z.number(),
|
|
||||||
name: z.string().nullable(),
|
|
||||||
siteId: z.number().nullable(),
|
|
||||||
hcEnabled: z.boolean(),
|
|
||||||
hcHealth: z.string().nullable(),
|
|
||||||
hcMode: z.string().nullable(),
|
|
||||||
hcHostname: z.string().nullable(),
|
|
||||||
hcPort: z.number().nullable(),
|
|
||||||
hcPath: z.string().nullable(),
|
|
||||||
hcScheme: z.string().nullable(),
|
|
||||||
hcMethod: z.string().nullable(),
|
|
||||||
hcInterval: z.number().nullable(),
|
|
||||||
hcUnhealthyInterval: z.number().nullable(),
|
|
||||||
hcTimeout: z.number().nullable(),
|
|
||||||
hcHeaders: z.string().nullable(),
|
|
||||||
hcFollowRedirects: z.boolean().nullable(),
|
|
||||||
hcStatus: z.number().nullable(),
|
|
||||||
hcTlsServerName: z.string().nullable(),
|
|
||||||
hcHealthyThreshold: z.number().nullable(),
|
|
||||||
hcUnhealthyThreshold: z.number().nullable()
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "post",
|
method: "post",
|
||||||
@@ -121,16 +97,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(UpdateHealthCheckResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function updateHealthCheck(
|
export async function updateHealthCheck(
|
||||||
|
|||||||
@@ -63,22 +63,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function createOrgOidcIdp(
|
export async function createOrgOidcIdp(
|
||||||
|
|||||||
@@ -38,22 +38,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function deleteOrgIdp(
|
export async function deleteOrgIdp(
|
||||||
|
|||||||
@@ -56,22 +56,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function getOrgIdp(
|
export async function getOrgIdp(
|
||||||
|
|||||||
@@ -72,22 +72,7 @@ registry.registerPath({
|
|||||||
query: querySchema,
|
query: querySchema,
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function listOrgIdps(
|
export async function listOrgIdps(
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
import { db, idpOrg } from "@server/db";
|
import { db, idpOrg } from "@server/db";
|
||||||
import response from "@server/lib/response";
|
import response from "@server/lib/response";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
@@ -55,10 +54,6 @@ const bodySchema = z.strictObject({
|
|||||||
export type UpdateOrgIdpResponse = {
|
export type UpdateOrgIdpResponse = {
|
||||||
idpId: number;
|
idpId: number;
|
||||||
};
|
};
|
||||||
const UpdateOrgIdpResponseDataSchema = z.object({
|
|
||||||
idpId: z.number()
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "post",
|
method: "post",
|
||||||
@@ -75,16 +70,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(UpdateOrgIdpResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function updateOrgOidcIdp(
|
export async function updateOrgOidcIdp(
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import { OlmErrorCodes, sendOlmError } from "@server/routers/olm/error";
|
|||||||
import { sendTerminateClient } from "@server/routers/client/terminate";
|
import { sendTerminateClient } from "@server/routers/client/terminate";
|
||||||
|
|
||||||
const reGenerateSecretParamsSchema = z.strictObject({
|
const reGenerateSecretParamsSchema = z.strictObject({
|
||||||
clientId: z.coerce.number().int().positive()
|
clientId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
});
|
});
|
||||||
|
|
||||||
const reGenerateSecretBodySchema = z.strictObject({
|
const reGenerateSecretBodySchema = z.strictObject({
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import { getAllowedIps } from "@server/routers/target/helpers";
|
|||||||
import { disconnectClient, sendToClient } from "#private/routers/ws";
|
import { disconnectClient, sendToClient } from "#private/routers/ws";
|
||||||
|
|
||||||
const updateSiteParamsSchema = z.strictObject({
|
const updateSiteParamsSchema = z.strictObject({
|
||||||
siteId: z.coerce.number().int().positive()
|
siteId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
});
|
});
|
||||||
|
|
||||||
const updateSiteBodySchema = z.strictObject({
|
const updateSiteBodySchema = z.strictObject({
|
||||||
|
|||||||
@@ -93,22 +93,7 @@ export type SignSshKeyResponse = {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
// responses: {
|
// responses: {}
|
||||||
// 200: {
|
|
||||||
// description: "Successful response",
|
|
||||||
// content: {
|
|
||||||
// "application/json": {
|
|
||||||
// schema: z.object({
|
|
||||||
// data: z.unknown().nullable(),
|
|
||||||
// success: z.boolean(),
|
|
||||||
// error: z.boolean(),
|
|
||||||
// message: z.string(),
|
|
||||||
// status: z.number()
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
// });
|
||||||
|
|
||||||
export async function signSshKey(
|
export async function signSshKey(
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import { rebuildClientAssociationsFromClient } from "@server/lib/rebuildClientAs
|
|||||||
|
|
||||||
const addUserRoleParamsSchema = z.strictObject({
|
const addUserRoleParamsSchema = z.strictObject({
|
||||||
userId: z.string(),
|
userId: z.string(),
|
||||||
roleId: z.coerce.number()
|
roleId: z.string().transform(stoi).pipe(z.number())
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
@@ -38,22 +38,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: addUserRoleParamsSchema
|
params: addUserRoleParamsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function addUserRole(
|
export async function addUserRole(
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import { rebuildClientAssociationsFromClient } from "@server/lib/rebuildClientAs
|
|||||||
|
|
||||||
const removeUserRoleParamsSchema = z.strictObject({
|
const removeUserRoleParamsSchema = z.strictObject({
|
||||||
userId: z.string(),
|
userId: z.string(),
|
||||||
roleId: z.coerce.number()
|
roleId: z.string().transform(stoi).pipe(z.number())
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
@@ -39,22 +39,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: removeUserRoleParamsSchema
|
params: removeUserRoleParamsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function removeUserRole(
|
export async function removeUserRole(
|
||||||
|
|||||||
@@ -22,22 +22,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: deleteAccessTokenParamsSchema
|
params: deleteAccessTokenParamsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function deleteAccessToken(
|
export async function deleteAccessToken(
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export const generateAccessTokenBodySchema = z.strictObject({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const generateAccssTokenParamsSchema = z.strictObject({
|
export const generateAccssTokenParamsSchema = z.strictObject({
|
||||||
resourceId: z.coerce.number().int().positive()
|
resourceId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
});
|
});
|
||||||
|
|
||||||
export type GenerateAccessTokenResponse = Omit<
|
export type GenerateAccessTokenResponse = Omit<
|
||||||
@@ -54,22 +54,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function generateAccessToken(
|
export async function generateAccessToken(
|
||||||
|
|||||||
@@ -129,22 +129,7 @@ registry.registerPath({
|
|||||||
}),
|
}),
|
||||||
query: listAccessTokensSchema
|
query: listAccessTokensSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
@@ -158,22 +143,7 @@ registry.registerPath({
|
|||||||
}),
|
}),
|
||||||
query: listAccessTokensSchema
|
query: listAccessTokensSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function listAccessTokens(
|
export async function listAccessTokens(
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { NextFunction, Request, Response } from "express";
|
|||||||
import { db } from "@server/db";
|
import { db } from "@server/db";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
import { apiKeyOrg, apiKeys } from "@server/db";
|
import { apiKeyOrg, apiKeys } from "@server/db";
|
||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import createHttpError from "http-errors";
|
import createHttpError from "http-errors";
|
||||||
@@ -33,14 +32,6 @@ export type CreateOrgApiKeyResponse = {
|
|||||||
lastChars: string;
|
lastChars: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
};
|
};
|
||||||
const CreateOrgApiKeyResponseDataSchema = z.object({
|
|
||||||
apiKeyId: z.string(),
|
|
||||||
name: z.string(),
|
|
||||||
apiKey: z.string(),
|
|
||||||
lastChars: z.string(),
|
|
||||||
createdAt: z.string()
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "put",
|
method: "put",
|
||||||
@@ -57,16 +48,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(CreateOrgApiKeyResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function createOrgApiKey(
|
export async function createOrgApiKey(
|
||||||
|
|||||||
@@ -22,22 +22,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function deleteApiKey(
|
export async function deleteApiKey(
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import { z } from "zod";
|
|||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
|
|
||||||
const paramsSchema = z.object({
|
const paramsSchema = z.object({
|
||||||
apiKeyId: z.string().nonempty()
|
apiKeyId: z.string().nonempty()
|
||||||
@@ -45,19 +44,6 @@ export type ListApiKeyActionsResponse = {
|
|||||||
pagination: { total: number; limit: number; offset: number };
|
pagination: { total: number; limit: number; offset: number };
|
||||||
};
|
};
|
||||||
|
|
||||||
const ListApiKeyActionsResponseDataSchema = z.object({
|
|
||||||
actions: z.array(
|
|
||||||
z.object({
|
|
||||||
actionId: z.string()
|
|
||||||
})
|
|
||||||
),
|
|
||||||
pagination: z.object({
|
|
||||||
total: z.number(),
|
|
||||||
limit: z.number(),
|
|
||||||
offset: z.number()
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/api-key/{apiKeyId}/actions",
|
path: "/org/{orgId}/api-key/{apiKeyId}/actions",
|
||||||
@@ -67,18 +53,7 @@ registry.registerPath({
|
|||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
query: querySchema
|
query: querySchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(
|
|
||||||
ListApiKeyActionsResponseDataSchema
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function listApiKeyActions(
|
export async function listApiKeyActions(
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import { z } from "zod";
|
|||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import { eq, and } from "drizzle-orm";
|
import { eq, and } from "drizzle-orm";
|
||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
|
|
||||||
const querySchema = z.object({
|
const querySchema = z.object({
|
||||||
limit: z
|
limit: z
|
||||||
@@ -49,23 +48,6 @@ export type ListOrgApiKeysResponse = {
|
|||||||
pagination: { total: number; limit: number; offset: number };
|
pagination: { total: number; limit: number; offset: number };
|
||||||
};
|
};
|
||||||
|
|
||||||
const ListOrgApiKeysResponseDataSchema = z.object({
|
|
||||||
apiKeys: z.array(
|
|
||||||
z.object({
|
|
||||||
apiKeyId: z.string(),
|
|
||||||
orgId: z.string(),
|
|
||||||
lastChars: z.string(),
|
|
||||||
createdAt: z.string(),
|
|
||||||
name: z.string()
|
|
||||||
})
|
|
||||||
),
|
|
||||||
pagination: z.object({
|
|
||||||
total: z.number(),
|
|
||||||
limit: z.number(),
|
|
||||||
offset: z.number()
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/api-keys",
|
path: "/org/{orgId}/api-keys",
|
||||||
@@ -75,18 +57,7 @@ registry.registerPath({
|
|||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
query: querySchema
|
query: querySchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(
|
|
||||||
ListOrgApiKeysResponseDataSchema
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function listOrgApiKeys(
|
export async function listOrgApiKeys(
|
||||||
|
|||||||
@@ -36,22 +36,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function setApiKeyActions(
|
export async function setApiKeyActions(
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { OpenAPITags } from "@server/openApi";
|
|||||||
import createHttpError from "http-errors";
|
import createHttpError from "http-errors";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import { z } from "zod";
|
|
||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
import {
|
import {
|
||||||
queryAccessAuditLogsQuery,
|
queryAccessAuditLogsQuery,
|
||||||
@@ -29,22 +28,7 @@ registry.registerPath({
|
|||||||
}),
|
}),
|
||||||
params: queryRequestAuditLogsParams
|
params: queryRequestAuditLogsParams
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function exportRequestAuditLogs(
|
export async function exportRequestAuditLogs(
|
||||||
|
|||||||
@@ -156,22 +156,7 @@ registry.registerPath({
|
|||||||
query: queryAccessAuditLogsQuery,
|
query: queryAccessAuditLogsQuery,
|
||||||
params: queryRequestAuditLogsParams
|
params: queryRequestAuditLogsParams
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export type QueryRequestAnalyticsResponse = Awaited<ReturnType<typeof query>>;
|
export type QueryRequestAnalyticsResponse = Awaited<ReturnType<typeof query>>;
|
||||||
|
|||||||
@@ -241,22 +241,7 @@ registry.registerPath({
|
|||||||
query: queryAccessAuditLogsQuery,
|
query: queryAccessAuditLogsQuery,
|
||||||
params: queryRequestAuditLogsParams
|
params: queryRequestAuditLogsParams
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
async function queryUniqueFilterAttributes(
|
async function queryUniqueFilterAttributes(
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import logger from "@server/logger";
|
|||||||
|
|
||||||
export const params = z.strictObject({
|
export const params = z.strictObject({
|
||||||
token: z.string(),
|
token: z.string(),
|
||||||
resourceId: z.coerce.number().int().positive()
|
resourceId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
});
|
});
|
||||||
|
|
||||||
export type CheckResourceSessionParams = z.infer<typeof params>;
|
export type CheckResourceSessionParams = z.infer<typeof params>;
|
||||||
|
|||||||
@@ -51,22 +51,7 @@ export type LookupUserResponse = {
|
|||||||
// request: {
|
// request: {
|
||||||
// body: lookupBodySchema
|
// body: lookupBodySchema
|
||||||
// },
|
// },
|
||||||
// responses: {
|
// responses: {}
|
||||||
// 200: {
|
|
||||||
// description: "Successful response",
|
|
||||||
// content: {
|
|
||||||
// "application/json": {
|
|
||||||
// schema: z.object({
|
|
||||||
// data: z.unknown().nullable(),
|
|
||||||
// success: z.boolean(),
|
|
||||||
// error: z.boolean(),
|
|
||||||
// message: z.string(),
|
|
||||||
// status: z.number()
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
// });
|
||||||
|
|
||||||
export async function lookupUser(
|
export async function lookupUser(
|
||||||
|
|||||||
@@ -31,22 +31,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function applyJSONBlueprint(
|
export async function applyJSONBlueprint(
|
||||||
|
|||||||
@@ -54,22 +54,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function applyYAMLBlueprint(
|
export async function applyYAMLBlueprint(
|
||||||
|
|||||||
@@ -7,12 +7,13 @@ import response from "@server/lib/response";
|
|||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
import createHttpError from "http-errors";
|
import createHttpError from "http-errors";
|
||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
|
import stoi from "@server/lib/stoi";
|
||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
import { BlueprintData } from "./types";
|
import { BlueprintData } from "./types";
|
||||||
|
|
||||||
const getBlueprintSchema = z.strictObject({
|
const getBlueprintSchema = z.strictObject({
|
||||||
blueprintId: z.coerce.number().int().positive(),
|
blueprintId: z.string().transform(stoi).pipe(z.int().positive()),
|
||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -56,22 +57,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: getBlueprintSchema
|
params: getBlueprintSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function getBlueprint(
|
export async function getBlueprint(
|
||||||
|
|||||||
@@ -74,22 +74,7 @@ registry.registerPath({
|
|||||||
}),
|
}),
|
||||||
query: listBluePrintsSchema
|
query: listBluePrintsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function listBlueprints(
|
export async function listBlueprints(
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { fromError } from "zod-validation-error";
|
|||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
|
|
||||||
const archiveClientSchema = z.strictObject({
|
const archiveClientSchema = z.strictObject({
|
||||||
clientId: z.coerce.number().int().positive()
|
clientId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
@@ -22,22 +22,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: archiveClientSchema
|
params: archiveClientSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function archiveClient(
|
export async function archiveClient(
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { sendTerminateClient } from "./terminate";
|
|||||||
import { OlmErrorCodes } from "../olm/error";
|
import { OlmErrorCodes } from "../olm/error";
|
||||||
|
|
||||||
const blockClientSchema = z.strictObject({
|
const blockClientSchema = z.strictObject({
|
||||||
clientId: z.coerce.number().int().positive()
|
clientId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
@@ -24,22 +24,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: blockClientSchema
|
params: blockClientSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function blockClient(
|
export async function blockClient(
|
||||||
|
|||||||
@@ -59,22 +59,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function createClient(
|
export async function createClient(
|
||||||
|
|||||||
@@ -60,22 +60,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function createUserClient(
|
export async function createUserClient(
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { sendTerminateClient } from "./terminate";
|
|||||||
import { OlmErrorCodes } from "../olm/error";
|
import { OlmErrorCodes } from "../olm/error";
|
||||||
|
|
||||||
const deleteClientSchema = z.strictObject({
|
const deleteClientSchema = z.strictObject({
|
||||||
clientId: z.coerce.number().int().positive()
|
clientId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
@@ -25,22 +25,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: deleteClientSchema
|
params: deleteClientSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function deleteClient(
|
export async function deleteClient(
|
||||||
|
|||||||
@@ -253,22 +253,7 @@ registry.registerPath({
|
|||||||
niceId: z.string()
|
niceId: z.string()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
@@ -281,22 +266,7 @@ registry.registerPath({
|
|||||||
clientId: z.number()
|
clientId: z.number()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function getClient(
|
export async function getClient(
|
||||||
|
|||||||
@@ -186,22 +186,7 @@ registry.registerPath({
|
|||||||
query: listClientsSchema,
|
query: listClientsSchema,
|
||||||
params: listClientsParamsSchema
|
params: listClientsParamsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function listClients(
|
export async function listClients(
|
||||||
|
|||||||
@@ -213,22 +213,7 @@ registry.registerPath({
|
|||||||
query: listUserDevicesSchema,
|
query: listUserDevicesSchema,
|
||||||
params: listUserDevicesParamsSchema
|
params: listUserDevicesParamsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function listUserDevices(
|
export async function listUserDevices(
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import logger from "@server/logger";
|
|||||||
import { generateId } from "@server/auth/sessions/app";
|
import { generateId } from "@server/auth/sessions/app";
|
||||||
import { getNextAvailableClientSubnet } from "@server/lib/ip";
|
import { getNextAvailableClientSubnet } from "@server/lib/ip";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
|
|
||||||
@@ -15,12 +14,6 @@ export type PickClientDefaultsResponse = {
|
|||||||
olmSecret: string;
|
olmSecret: string;
|
||||||
subnet: string;
|
subnet: string;
|
||||||
};
|
};
|
||||||
const PickClientDefaultsResponseDataSchema = z.object({
|
|
||||||
olmId: z.string(),
|
|
||||||
olmSecret: z.string(),
|
|
||||||
subnet: z.string()
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
const pickClientDefaultsSchema = z.strictObject({
|
const pickClientDefaultsSchema = z.strictObject({
|
||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
@@ -34,16 +27,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: pickClientDefaultsSchema
|
params: pickClientDefaultsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(PickClientDefaultsResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function pickClientDefaults(
|
export async function pickClientDefaults(
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { fromError } from "zod-validation-error";
|
|||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
|
|
||||||
const unarchiveClientSchema = z.strictObject({
|
const unarchiveClientSchema = z.strictObject({
|
||||||
clientId: z.coerce.number().int().positive()
|
clientId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
@@ -22,22 +22,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: unarchiveClientSchema
|
params: unarchiveClientSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function unarchiveClient(
|
export async function unarchiveClient(
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { fromError } from "zod-validation-error";
|
|||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
|
|
||||||
const unblockClientSchema = z.strictObject({
|
const unblockClientSchema = z.strictObject({
|
||||||
clientId: z.coerce.number().int().positive()
|
clientId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
@@ -22,22 +22,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: unblockClientSchema
|
params: unblockClientSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function unblockClient(
|
export async function unblockClient(
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { fromError } from "zod-validation-error";
|
|||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
|
|
||||||
const updateClientParamsSchema = z.strictObject({
|
const updateClientParamsSchema = z.strictObject({
|
||||||
clientId: z.coerce.number().int().positive()
|
clientId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
});
|
});
|
||||||
|
|
||||||
const updateClientSchema = z.strictObject({
|
const updateClientSchema = z.strictObject({
|
||||||
@@ -36,22 +36,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function updateClient(
|
export async function updateClient(
|
||||||
|
|||||||
@@ -37,22 +37,7 @@ registry.registerPath({
|
|||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function getDNSRecords(
|
export async function getDNSRecords(
|
||||||
|
|||||||
@@ -38,22 +38,7 @@ registry.registerPath({
|
|||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function getDomain(
|
export async function getDomain(
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import { eq, sql } from "drizzle-orm";
|
|||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
|
|
||||||
const listDomainsParamsSchema = z.strictObject({
|
const listDomainsParamsSchema = z.strictObject({
|
||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
@@ -57,28 +56,6 @@ export type ListDomainsResponse = {
|
|||||||
pagination: { total: number; limit: number; offset: number };
|
pagination: { total: number; limit: number; offset: number };
|
||||||
};
|
};
|
||||||
|
|
||||||
const ListDomainsResponseDataSchema = z.object({
|
|
||||||
domains: z.array(
|
|
||||||
z.object({
|
|
||||||
domainId: z.string(),
|
|
||||||
baseDomain: z.string(),
|
|
||||||
verified: z.boolean(),
|
|
||||||
type: z.string().nullable(),
|
|
||||||
failed: z.boolean(),
|
|
||||||
tries: z.number(),
|
|
||||||
configManaged: z.boolean(),
|
|
||||||
certResolver: z.string().nullable(),
|
|
||||||
preferWildcardCert: z.boolean().nullable(),
|
|
||||||
errorMessage: z.string().nullable()
|
|
||||||
})
|
|
||||||
),
|
|
||||||
pagination: z.object({
|
|
||||||
total: z.number(),
|
|
||||||
limit: z.number(),
|
|
||||||
offset: z.number()
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/domains",
|
path: "/org/{orgId}/domains",
|
||||||
@@ -90,16 +67,7 @@ registry.registerPath({
|
|||||||
}),
|
}),
|
||||||
query: listDomainsSchema
|
query: listDomainsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(ListDomainsResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function listDomains(
|
export async function listDomains(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
import { db, domains, orgDomains } from "@server/db";
|
import { db, domains, orgDomains } from "@server/db";
|
||||||
import response from "@server/lib/response";
|
import response from "@server/lib/response";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
@@ -25,12 +24,6 @@ export type UpdateDomainResponse = {
|
|||||||
certResolver: string | null;
|
certResolver: string | null;
|
||||||
preferWildcardCert: boolean | null;
|
preferWildcardCert: boolean | null;
|
||||||
};
|
};
|
||||||
const UpdateDomainResponseDataSchema = z.object({
|
|
||||||
domainId: z.string(),
|
|
||||||
certResolver: z.string().nullable(),
|
|
||||||
preferWildcardCert: z.boolean().nullable()
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "patch",
|
method: "patch",
|
||||||
@@ -43,16 +36,7 @@ registry.registerPath({
|
|||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(UpdateDomainResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function updateOrgDomain(
|
export async function updateOrgDomain(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
import { db } from "@server/db";
|
import { db } from "@server/db";
|
||||||
import response from "@server/lib/response";
|
import response from "@server/lib/response";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
@@ -23,8 +22,6 @@ const bodySchema = z.strictObject({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export type CreateIdpOrgPolicyResponse = {};
|
export type CreateIdpOrgPolicyResponse = {};
|
||||||
const CreateIdpOrgPolicyResponseDataSchema = z.object({});
|
|
||||||
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "put",
|
method: "put",
|
||||||
@@ -41,16 +38,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(CreateIdpOrgPolicyResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function createIdpOrgPolicy(
|
export async function createIdpOrgPolicy(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
import { db } from "@server/db";
|
import { db } from "@server/db";
|
||||||
import response from "@server/lib/response";
|
import response from "@server/lib/response";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
@@ -34,11 +33,6 @@ export type CreateIdpResponse = {
|
|||||||
idpId: number;
|
idpId: number;
|
||||||
redirectUrl: string;
|
redirectUrl: string;
|
||||||
};
|
};
|
||||||
const CreateIdpResponseDataSchema = z.object({
|
|
||||||
idpId: z.number(),
|
|
||||||
redirectUrl: z.string()
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "put",
|
method: "put",
|
||||||
@@ -54,16 +48,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(CreateIdpResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function createOidcIdp(
|
export async function createOidcIdp(
|
||||||
|
|||||||
@@ -25,22 +25,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function deleteIdp(
|
export async function deleteIdp(
|
||||||
|
|||||||
@@ -23,22 +23,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function deleteIdpOrgPolicy(
|
export async function deleteIdpOrgPolicy(
|
||||||
|
|||||||
@@ -38,22 +38,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function getIdp(
|
export async function getIdp(
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import { eq, sql } from "drizzle-orm";
|
|||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
|
|
||||||
const paramsSchema = z.object({
|
const paramsSchema = z.object({
|
||||||
idpId: z.coerce.number<number>()
|
idpId: z.coerce.number<number>()
|
||||||
@@ -45,21 +44,6 @@ export type ListIdpOrgPoliciesResponse = {
|
|||||||
pagination: { total: number; limit: number; offset: number };
|
pagination: { total: number; limit: number; offset: number };
|
||||||
};
|
};
|
||||||
|
|
||||||
const ListIdpOrgPoliciesResponseDataSchema = z.object({
|
|
||||||
policies: z.array(
|
|
||||||
z.object({
|
|
||||||
idpId: z.number(),
|
|
||||||
orgId: z.string(),
|
|
||||||
assignDefaultOrgRoleId: z.number().nullable()
|
|
||||||
})
|
|
||||||
),
|
|
||||||
pagination: z.object({
|
|
||||||
total: z.number(),
|
|
||||||
limit: z.number(),
|
|
||||||
offset: z.number()
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "get",
|
method: "get",
|
||||||
path: "/idp/{idpId}/org",
|
path: "/idp/{idpId}/org",
|
||||||
@@ -69,18 +53,7 @@ registry.registerPath({
|
|||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
query: querySchema
|
query: querySchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(
|
|
||||||
ListIdpOrgPoliciesResponseDataSchema
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function listIdpOrgPolicies(
|
export async function listIdpOrgPolicies(
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import { eq, sql } from "drizzle-orm";
|
|||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
|
|
||||||
const querySchema = z.strictObject({
|
const querySchema = z.strictObject({
|
||||||
limit: z
|
limit: z
|
||||||
@@ -55,25 +54,6 @@ export type ListIdpsResponse = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const ListIdpsResponseDataSchema = z.object({
|
|
||||||
idps: z.array(
|
|
||||||
z.object({
|
|
||||||
idpId: z.number(),
|
|
||||||
name: z.string(),
|
|
||||||
type: z.string(),
|
|
||||||
variant: z.string().nullable(),
|
|
||||||
orgCount: z.number(),
|
|
||||||
autoProvision: z.boolean().nullable(),
|
|
||||||
tags: z.string().nullable()
|
|
||||||
})
|
|
||||||
),
|
|
||||||
pagination: z.object({
|
|
||||||
total: z.number(),
|
|
||||||
limit: z.number(),
|
|
||||||
offset: z.number()
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "get",
|
method: "get",
|
||||||
path: "/idp",
|
path: "/idp",
|
||||||
@@ -82,16 +62,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
query: querySchema
|
query: querySchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(ListIdpsResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function listIdps(
|
export async function listIdps(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
import { db } from "@server/db";
|
import { db } from "@server/db";
|
||||||
import response from "@server/lib/response";
|
import response from "@server/lib/response";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
@@ -22,8 +21,6 @@ const bodySchema = z.strictObject({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export type UpdateIdpOrgPolicyResponse = {};
|
export type UpdateIdpOrgPolicyResponse = {};
|
||||||
const UpdateIdpOrgPolicyResponseDataSchema = z.object({});
|
|
||||||
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "post",
|
method: "post",
|
||||||
@@ -40,16 +37,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(UpdateIdpOrgPolicyResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function updateIdpOrgPolicy(
|
export async function updateIdpOrgPolicy(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
import { db } from "@server/db";
|
import { db } from "@server/db";
|
||||||
import response from "@server/lib/response";
|
import response from "@server/lib/response";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
@@ -39,10 +38,6 @@ const bodySchema = z.strictObject({
|
|||||||
export type UpdateIdpResponse = {
|
export type UpdateIdpResponse = {
|
||||||
idpId: number;
|
idpId: number;
|
||||||
};
|
};
|
||||||
const UpdateIdpResponseDataSchema = z.object({
|
|
||||||
idpId: z.number()
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "post",
|
method: "post",
|
||||||
@@ -59,16 +54,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(UpdateIdpResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function updateOidcIdp(
|
export async function updateOidcIdp(
|
||||||
|
|||||||
@@ -43,22 +43,7 @@ export type CreateOlmResponse = {
|
|||||||
// },
|
// },
|
||||||
// params: paramsSchema
|
// params: paramsSchema
|
||||||
// },
|
// },
|
||||||
// responses: {
|
// responses: {}
|
||||||
// 200: {
|
|
||||||
// description: "Successful response",
|
|
||||||
// content: {
|
|
||||||
// "application/json": {
|
|
||||||
// schema: z.object({
|
|
||||||
// data: z.unknown().nullable(),
|
|
||||||
// success: z.boolean(),
|
|
||||||
// error: z.boolean(),
|
|
||||||
// message: z.string(),
|
|
||||||
// status: z.number()
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
// });
|
||||||
|
|
||||||
export async function createUserOlm(
|
export async function createUserOlm(
|
||||||
|
|||||||
@@ -28,22 +28,7 @@ const paramsSchema = z
|
|||||||
// request: {
|
// request: {
|
||||||
// params: paramsSchema
|
// params: paramsSchema
|
||||||
// },
|
// },
|
||||||
// responses: {
|
// responses: {}
|
||||||
// 200: {
|
|
||||||
// description: "Successful response",
|
|
||||||
// content: {
|
|
||||||
// "application/json": {
|
|
||||||
// schema: z.object({
|
|
||||||
// data: z.unknown().nullable(),
|
|
||||||
// success: z.boolean(),
|
|
||||||
// error: z.boolean(),
|
|
||||||
// message: z.string(),
|
|
||||||
// status: z.number()
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
// });
|
||||||
|
|
||||||
export async function deleteUserOlm(
|
export async function deleteUserOlm(
|
||||||
|
|||||||
@@ -30,22 +30,7 @@ const querySchema = z.object({
|
|||||||
// request: {
|
// request: {
|
||||||
// params: paramsSchema
|
// params: paramsSchema
|
||||||
// },
|
// },
|
||||||
// responses: {
|
// responses: {}
|
||||||
// 200: {
|
|
||||||
// description: "Successful response",
|
|
||||||
// content: {
|
|
||||||
// "application/json": {
|
|
||||||
// schema: z.object({
|
|
||||||
// data: z.unknown().nullable(),
|
|
||||||
// success: z.boolean(),
|
|
||||||
// error: z.boolean(),
|
|
||||||
// message: z.string(),
|
|
||||||
// status: z.number()
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
// });
|
||||||
|
|
||||||
export async function getUserOlm(
|
export async function getUserOlm(
|
||||||
|
|||||||
@@ -41,22 +41,7 @@ const paramsSchema = z
|
|||||||
// query: querySchema,
|
// query: querySchema,
|
||||||
// params: paramsSchema
|
// params: paramsSchema
|
||||||
// },
|
// },
|
||||||
// responses: {
|
// responses: {}
|
||||||
// 200: {
|
|
||||||
// description: "Successful response",
|
|
||||||
// content: {
|
|
||||||
// "application/json": {
|
|
||||||
// schema: z.object({
|
|
||||||
// data: z.unknown().nullable(),
|
|
||||||
// success: z.boolean(),
|
|
||||||
// error: z.boolean(),
|
|
||||||
// message: z.string(),
|
|
||||||
// status: z.number()
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
// });
|
||||||
|
|
||||||
export type ListUserOlmsResponse = {
|
export type ListUserOlmsResponse = {
|
||||||
|
|||||||
@@ -83,22 +83,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function checkOrgUserAccess(
|
export async function checkOrgUserAccess(
|
||||||
|
|||||||
@@ -74,22 +74,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function createOrg(
|
export async function createOrg(
|
||||||
|
|||||||
@@ -24,22 +24,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: deleteOrgSchema
|
params: deleteOrgSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function deleteOrg(
|
export async function deleteOrg(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
import { db } from "@server/db";
|
import { db } from "@server/db";
|
||||||
import { Org, orgs } from "@server/db";
|
import { Org, orgs } from "@server/db";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
@@ -18,10 +17,6 @@ const getOrgSchema = z.strictObject({
|
|||||||
export type GetOrgResponse = {
|
export type GetOrgResponse = {
|
||||||
org: Org;
|
org: Org;
|
||||||
};
|
};
|
||||||
const GetOrgResponseDataSchema = z.object({
|
|
||||||
org: z.object({}).passthrough()
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "get",
|
method: "get",
|
||||||
@@ -31,16 +26,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: getOrgSchema
|
params: getOrgSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(GetOrgResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function getOrg(
|
export async function getOrg(
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import { sql, inArray, eq } from "drizzle-orm";
|
|||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
import { fromZodError } from "zod-validation-error";
|
import { fromZodError } from "zod-validation-error";
|
||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
import { createApiResponseSchema } from "@server/lib/openapi/createApiResponseSchema";
|
|
||||||
|
|
||||||
const listOrgsSchema = z.object({
|
const listOrgsSchema = z.object({
|
||||||
limit: z
|
limit: z
|
||||||
@@ -34,16 +33,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
query: listOrgsSchema
|
query: listOrgsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: createApiResponseSchema(ListOrgsResponseDataSchema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export type ListOrgsResponse = {
|
export type ListOrgsResponse = {
|
||||||
@@ -51,15 +41,6 @@ export type ListOrgsResponse = {
|
|||||||
pagination: { total: number; limit: number; offset: number };
|
pagination: { total: number; limit: number; offset: number };
|
||||||
};
|
};
|
||||||
|
|
||||||
const ListOrgsResponseDataSchema = z.object({
|
|
||||||
orgs: z.array(z.object({}).passthrough()),
|
|
||||||
pagination: z.object({
|
|
||||||
total: z.number(),
|
|
||||||
limit: z.number(),
|
|
||||||
offset: z.number()
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
export async function listOrgs(
|
export async function listOrgs(
|
||||||
req: Request,
|
req: Request,
|
||||||
res: Response,
|
res: Response,
|
||||||
|
|||||||
@@ -37,22 +37,7 @@ const listOrgsSchema = z.object({
|
|||||||
// request: {
|
// request: {
|
||||||
// query: listOrgsSchema
|
// query: listOrgsSchema
|
||||||
// },
|
// },
|
||||||
// responses: {
|
// responses: {}
|
||||||
// 200: {
|
|
||||||
// description: "Successful response",
|
|
||||||
// content: {
|
|
||||||
// "application/json": {
|
|
||||||
// schema: z.object({
|
|
||||||
// data: z.unknown().nullable(),
|
|
||||||
// success: z.boolean(),
|
|
||||||
// error: z.boolean(),
|
|
||||||
// message: z.string(),
|
|
||||||
// status: z.number()
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
// });
|
||||||
|
|
||||||
type ResponseOrg = Org & {
|
type ResponseOrg = Org & {
|
||||||
|
|||||||
@@ -21,22 +21,7 @@ registry.registerPath({
|
|||||||
request: {
|
request: {
|
||||||
params: resetOrgBandwidthParamsSchema
|
params: resetOrgBandwidthParamsSchema
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function resetOrgBandwidth(
|
export async function resetOrgBandwidth(
|
||||||
|
|||||||
@@ -61,22 +61,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function updateOrg(
|
export async function updateOrg(
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const addEmailToResourceWhitelistBodySchema = z.strictObject({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const addEmailToResourceWhitelistParamsSchema = z.strictObject({
|
const addEmailToResourceWhitelistParamsSchema = z.strictObject({
|
||||||
resourceId: z.coerce.number().int().positive()
|
resourceId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
@@ -40,22 +40,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function addEmailToResourceWhitelist(
|
export async function addEmailToResourceWhitelist(
|
||||||
|
|||||||
@@ -40,22 +40,7 @@ registry.registerPath({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
responses: {
|
responses: {}
|
||||||
200: {
|
|
||||||
description: "Successful response",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: z.object({
|
|
||||||
data: z.unknown().nullable(),
|
|
||||||
success: z.boolean(),
|
|
||||||
error: z.boolean(),
|
|
||||||
message: z.string(),
|
|
||||||
status: z.number()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function addRoleToResource(
|
export async function addRoleToResource(
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user