mirror of
https://github.com/yusing/godoxy.git
synced 2025-07-12 09:04:02 +02:00
fix schemas
This commit is contained in:
parent
322878b0b7
commit
9b66772a12
14 changed files with 79 additions and 40 deletions
1
Makefile
1
Makefile
|
@ -100,6 +100,7 @@ gen-schema-single:
|
||||||
python3 -c "import json; f=open('schemas/${OUT}', 'r'); j=json.load(f); f.close(); f=open('schemas/${OUT}', 'w'); json.dump(j, f, separators=(',', ':'));"
|
python3 -c "import json; f=open('schemas/${OUT}', 'r'); j=json.load(f); f.close(); f=open('schemas/${OUT}', 'w'); json.dump(j, f, separators=(',', ':'));"
|
||||||
|
|
||||||
gen-schema:
|
gen-schema:
|
||||||
|
bun --bun tsc
|
||||||
make IN=config/config.ts \
|
make IN=config/config.ts \
|
||||||
CLASS=Config \
|
CLASS=Config \
|
||||||
OUT=config.schema.json \
|
OUT=config.schema.json \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "godoxy-schemas",
|
"name": "godoxy-schemas",
|
||||||
"version": "0.9.0-13",
|
"version": "0.9.0-20",
|
||||||
"description": "JSON Schema and typescript types for GoDoxy configuration",
|
"description": "JSON Schema and typescript types for GoDoxy configuration",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
File diff suppressed because one or more lines are too long
2
schemas/config/entrypoint.d.ts
vendored
2
schemas/config/entrypoint.d.ts
vendored
|
@ -5,7 +5,7 @@ export type EntrypointConfig = {
|
||||||
*
|
*
|
||||||
* @examples require(".").middlewaresExamples
|
* @examples require(".").middlewaresExamples
|
||||||
*/
|
*/
|
||||||
middlewares: MiddlewareCompose;
|
middlewares?: MiddlewareCompose;
|
||||||
/** Entrypoint access log configuration
|
/** Entrypoint access log configuration
|
||||||
*
|
*
|
||||||
* @examples require(".").accessLogExamples
|
* @examples require(".").accessLogExamples
|
||||||
|
|
|
@ -6,7 +6,7 @@ export type EntrypointConfig = {
|
||||||
*
|
*
|
||||||
* @examples require(".").middlewaresExamples
|
* @examples require(".").middlewaresExamples
|
||||||
*/
|
*/
|
||||||
middlewares: MiddlewareCompose;
|
middlewares?: MiddlewareCompose;
|
||||||
/** Entrypoint access log configuration
|
/** Entrypoint access log configuration
|
||||||
*
|
*
|
||||||
* @examples require(".").accessLogExamples
|
* @examples require(".").accessLogExamples
|
||||||
|
|
File diff suppressed because one or more lines are too long
15
schemas/middlewares/middlewares.d.ts
vendored
15
schemas/middlewares/middlewares.d.ts
vendored
|
@ -1,15 +1,18 @@
|
||||||
import * as types from "../types";
|
import * as types from "../types";
|
||||||
export type MiddlewareComposeObjectRef = `${string}@file`;
|
|
||||||
export type KeyOptMapping<T extends {
|
export type KeyOptMapping<T extends {
|
||||||
use: string;
|
use: string;
|
||||||
}> = {
|
}> = {
|
||||||
[key in T["use"]]: Omit<T, "use">;
|
[key in T["use"]]?: Omit<T, "use">;
|
||||||
} | {
|
|
||||||
use: MiddlewareComposeObjectRef;
|
|
||||||
};
|
};
|
||||||
export type MiddlewaresMap = KeyOptMapping<CustomErrorPage> | KeyOptMapping<RedirectHTTP> | KeyOptMapping<SetXForwarded> | KeyOptMapping<HideXForwarded> | KeyOptMapping<CIDRWhitelist> | KeyOptMapping<CloudflareRealIP> | KeyOptMapping<ModifyRequest> | KeyOptMapping<ModifyResponse> | KeyOptMapping<OIDC> | KeyOptMapping<RateLimit> | KeyOptMapping<RealIP> | {
|
export declare const ALL_MIDDLEWARES: readonly ["ErrorPage", "RedirectHTTP", "SetXForwarded", "HideXForwarded", "CIDRWhitelist", "CloudflareRealIP", "ModifyRequest", "ModifyResponse", "OIDC", "RateLimit", "RealIP"];
|
||||||
[key in MiddlewareComposeObjectRef]: types.NullOrEmptyMap;
|
/**
|
||||||
|
* @type object
|
||||||
|
* @patternProperties {"^.*@file$": {"type": "null"}}
|
||||||
|
*/
|
||||||
|
export type MiddlewareFileRef = {
|
||||||
|
[key: `${string}@file`]: null;
|
||||||
};
|
};
|
||||||
|
export type MiddlewaresMap = (KeyOptMapping<CustomErrorPage> & KeyOptMapping<RedirectHTTP> & KeyOptMapping<SetXForwarded> & KeyOptMapping<HideXForwarded> & KeyOptMapping<CIDRWhitelist> & KeyOptMapping<CloudflareRealIP> & KeyOptMapping<ModifyRequest> & KeyOptMapping<ModifyResponse> & KeyOptMapping<OIDC> & KeyOptMapping<RateLimit> & KeyOptMapping<RealIP>) | MiddlewareFileRef;
|
||||||
export type MiddlewareComposeMap = CustomErrorPage | RedirectHTTP | SetXForwarded | HideXForwarded | CIDRWhitelist | CloudflareRealIP | ModifyRequest | ModifyResponse | OIDC | RateLimit | RealIP;
|
export type MiddlewareComposeMap = CustomErrorPage | RedirectHTTP | SetXForwarded | HideXForwarded | CIDRWhitelist | CloudflareRealIP | ModifyRequest | ModifyResponse | OIDC | RateLimit | RealIP;
|
||||||
export type CustomErrorPage = {
|
export type CustomErrorPage = {
|
||||||
use: "error_page" | "errorPage" | "ErrorPage" | "custom_error_page" | "customErrorPage" | "CustomErrorPage";
|
use: "error_page" | "errorPage" | "ErrorPage" | "custom_error_page" | "customErrorPage" | "CustomErrorPage";
|
||||||
|
|
|
@ -1 +1,13 @@
|
||||||
export {};
|
export const ALL_MIDDLEWARES = [
|
||||||
|
"ErrorPage",
|
||||||
|
"RedirectHTTP",
|
||||||
|
"SetXForwarded",
|
||||||
|
"HideXForwarded",
|
||||||
|
"CIDRWhitelist",
|
||||||
|
"CloudflareRealIP",
|
||||||
|
"ModifyRequest",
|
||||||
|
"ModifyResponse",
|
||||||
|
"OIDC",
|
||||||
|
"RateLimit",
|
||||||
|
"RealIP",
|
||||||
|
];
|
||||||
|
|
|
@ -1,26 +1,44 @@
|
||||||
import * as types from "../types";
|
import * as types from "../types";
|
||||||
|
|
||||||
export type MiddlewareComposeObjectRef = `${string}@file`;
|
export type KeyOptMapping<T extends { use: string }> = {
|
||||||
|
[key in T["use"]]?: Omit<T, "use">;
|
||||||
|
};
|
||||||
|
|
||||||
export type KeyOptMapping<T extends { use: string }> =
|
export const ALL_MIDDLEWARES = [
|
||||||
| {
|
"ErrorPage",
|
||||||
[key in T["use"]]: Omit<T, "use">;
|
"RedirectHTTP",
|
||||||
}
|
"SetXForwarded",
|
||||||
| { use: MiddlewareComposeObjectRef };
|
"HideXForwarded",
|
||||||
|
"CIDRWhitelist",
|
||||||
|
"CloudflareRealIP",
|
||||||
|
"ModifyRequest",
|
||||||
|
"ModifyResponse",
|
||||||
|
"OIDC",
|
||||||
|
"RateLimit",
|
||||||
|
"RealIP",
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type object
|
||||||
|
* @patternProperties {"^.*@file$": {"type": "null"}}
|
||||||
|
*/
|
||||||
|
export type MiddlewareFileRef = {
|
||||||
|
[key: `${string}@file`]: null;
|
||||||
|
};
|
||||||
|
|
||||||
export type MiddlewaresMap =
|
export type MiddlewaresMap =
|
||||||
| KeyOptMapping<CustomErrorPage>
|
| (KeyOptMapping<CustomErrorPage> &
|
||||||
| KeyOptMapping<RedirectHTTP>
|
KeyOptMapping<RedirectHTTP> &
|
||||||
| KeyOptMapping<SetXForwarded>
|
KeyOptMapping<SetXForwarded> &
|
||||||
| KeyOptMapping<HideXForwarded>
|
KeyOptMapping<HideXForwarded> &
|
||||||
| KeyOptMapping<CIDRWhitelist>
|
KeyOptMapping<CIDRWhitelist> &
|
||||||
| KeyOptMapping<CloudflareRealIP>
|
KeyOptMapping<CloudflareRealIP> &
|
||||||
| KeyOptMapping<ModifyRequest>
|
KeyOptMapping<ModifyRequest> &
|
||||||
| KeyOptMapping<ModifyResponse>
|
KeyOptMapping<ModifyResponse> &
|
||||||
| KeyOptMapping<OIDC>
|
KeyOptMapping<OIDC> &
|
||||||
| KeyOptMapping<RateLimit>
|
KeyOptMapping<RateLimit> &
|
||||||
| KeyOptMapping<RealIP>
|
KeyOptMapping<RealIP>)
|
||||||
| { [key in MiddlewareComposeObjectRef]: types.NullOrEmptyMap };
|
| MiddlewareFileRef;
|
||||||
|
|
||||||
export type MiddlewareComposeMap =
|
export type MiddlewareComposeMap =
|
||||||
| CustomErrorPage
|
| CustomErrorPage
|
||||||
|
|
7
schemas/providers/homepage.d.ts
vendored
7
schemas/providers/homepage.d.ts
vendored
|
@ -17,6 +17,11 @@ export type HomepageConfig = {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
export type WalkxcodeIcon = `${"png" | "svg" | "webp"}/${string}/${string}.${string}`;
|
/** Walkxcode icon
|
||||||
|
*
|
||||||
|
* @pattern ^(png|svg|webp)\/[\w\d\-_]+\.\1
|
||||||
|
* @type string
|
||||||
|
*/
|
||||||
|
export type WalkxcodeIcon = string & {};
|
||||||
export type ExternalIcon = `@${"selfhst" | "walkxcode"}/${string}.${string}`;
|
export type ExternalIcon = `@${"selfhst" | "walkxcode"}/${string}.${string}`;
|
||||||
export type TargetRelativeIconPath = `@target/${string}` | `/${string}`;
|
export type TargetRelativeIconPath = `@target/${string}` | `/${string}`;
|
||||||
|
|
|
@ -25,11 +25,12 @@ export type HomepageConfig = {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Walkxcode icon */
|
/** Walkxcode icon
|
||||||
export type WalkxcodeIcon = `${
|
*
|
||||||
| "png"
|
* @pattern ^(png|svg|webp)\/[\w\d\-_]+\.\1
|
||||||
| "svg"
|
* @type string
|
||||||
| "webp"}/${string}/${string}.${string}`;
|
*/
|
||||||
|
export type WalkxcodeIcon = string & {};
|
||||||
|
|
||||||
/* Walkxcode / selfh.st icon */
|
/* Walkxcode / selfh.st icon */
|
||||||
export type ExternalIcon = `@${"selfhst" | "walkxcode"}/${string}.${string}`;
|
export type ExternalIcon = `@${"selfhst" | "walkxcode"}/${string}.${string}`;
|
||||||
|
|
File diff suppressed because one or more lines are too long
3
schemas/types.d.ts
vendored
3
schemas/types.d.ts
vendored
|
@ -1,8 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* @type "null"
|
* @type "null"
|
||||||
*/
|
*/
|
||||||
export interface Null {
|
export type Null = null;
|
||||||
}
|
|
||||||
export type Nullable<T> = T | Null;
|
export type Nullable<T> = T | Null;
|
||||||
export type NullOrEmptyMap = {} | Null;
|
export type NullOrEmptyMap = {} | Null;
|
||||||
export declare const HTTP_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "CONNECT", "HEAD", "OPTIONS", "TRACE"];
|
export declare const HTTP_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "CONNECT", "HEAD", "OPTIONS", "TRACE"];
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* @type "null"
|
* @type "null"
|
||||||
*/
|
*/
|
||||||
export interface Null {}
|
export type Null = null;
|
||||||
export type Nullable<T> = T | Null;
|
export type Nullable<T> = T | Null;
|
||||||
export type NullOrEmptyMap = {} | Null;
|
export type NullOrEmptyMap = {} | Null;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue