mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-19 20:32:35 +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=(',', ':'));"
|
||||
|
||||
gen-schema:
|
||||
bun --bun tsc
|
||||
make IN=config/config.ts \
|
||||
CLASS=Config \
|
||||
OUT=config.schema.json \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "godoxy-schemas",
|
||||
"version": "0.9.0-13",
|
||||
"version": "0.9.0-20",
|
||||
"description": "JSON Schema and typescript types for GoDoxy configuration",
|
||||
"license": "MIT",
|
||||
"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
|
||||
*/
|
||||
middlewares: MiddlewareCompose;
|
||||
middlewares?: MiddlewareCompose;
|
||||
/** Entrypoint access log configuration
|
||||
*
|
||||
* @examples require(".").accessLogExamples
|
||||
|
|
|
@ -6,7 +6,7 @@ export type EntrypointConfig = {
|
|||
*
|
||||
* @examples require(".").middlewaresExamples
|
||||
*/
|
||||
middlewares: MiddlewareCompose;
|
||||
middlewares?: MiddlewareCompose;
|
||||
/** Entrypoint access log configuration
|
||||
*
|
||||
* @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";
|
||||
export type MiddlewareComposeObjectRef = `${string}@file`;
|
||||
export type KeyOptMapping<T extends {
|
||||
use: string;
|
||||
}> = {
|
||||
[key in T["use"]]: Omit<T, "use">;
|
||||
} | {
|
||||
use: MiddlewareComposeObjectRef;
|
||||
[key in T["use"]]?: Omit<T, "use">;
|
||||
};
|
||||
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> | {
|
||||
[key in MiddlewareComposeObjectRef]: types.NullOrEmptyMap;
|
||||
export declare const ALL_MIDDLEWARES: readonly ["ErrorPage", "RedirectHTTP", "SetXForwarded", "HideXForwarded", "CIDRWhitelist", "CloudflareRealIP", "ModifyRequest", "ModifyResponse", "OIDC", "RateLimit", "RealIP"];
|
||||
/**
|
||||
* @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 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";
|
||||
|
||||
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 }> =
|
||||
| {
|
||||
[key in T["use"]]: Omit<T, "use">;
|
||||
}
|
||||
| { use: MiddlewareComposeObjectRef };
|
||||
export const ALL_MIDDLEWARES = [
|
||||
"ErrorPage",
|
||||
"RedirectHTTP",
|
||||
"SetXForwarded",
|
||||
"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 =
|
||||
| KeyOptMapping<CustomErrorPage>
|
||||
| KeyOptMapping<RedirectHTTP>
|
||||
| KeyOptMapping<SetXForwarded>
|
||||
| KeyOptMapping<HideXForwarded>
|
||||
| KeyOptMapping<CIDRWhitelist>
|
||||
| KeyOptMapping<CloudflareRealIP>
|
||||
| KeyOptMapping<ModifyRequest>
|
||||
| KeyOptMapping<ModifyResponse>
|
||||
| KeyOptMapping<OIDC>
|
||||
| KeyOptMapping<RateLimit>
|
||||
| KeyOptMapping<RealIP>
|
||||
| { [key in MiddlewareComposeObjectRef]: types.NullOrEmptyMap };
|
||||
| (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
|
||||
|
|
7
schemas/providers/homepage.d.ts
vendored
7
schemas/providers/homepage.d.ts
vendored
|
@ -17,6 +17,11 @@ export type HomepageConfig = {
|
|||
[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 TargetRelativeIconPath = `@target/${string}` | `/${string}`;
|
||||
|
|
|
@ -25,11 +25,12 @@ export type HomepageConfig = {
|
|||
};
|
||||
};
|
||||
|
||||
/* Walkxcode icon */
|
||||
export type WalkxcodeIcon = `${
|
||||
| "png"
|
||||
| "svg"
|
||||
| "webp"}/${string}/${string}.${string}`;
|
||||
/** Walkxcode icon
|
||||
*
|
||||
* @pattern ^(png|svg|webp)\/[\w\d\-_]+\.\1
|
||||
* @type string
|
||||
*/
|
||||
export type WalkxcodeIcon = string & {};
|
||||
|
||||
/* Walkxcode / selfh.st icon */
|
||||
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"
|
||||
*/
|
||||
export interface Null {
|
||||
}
|
||||
export type Null = null;
|
||||
export type Nullable<T> = T | Null;
|
||||
export type NullOrEmptyMap = {} | Null;
|
||||
export declare const HTTP_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "CONNECT", "HEAD", "OPTIONS", "TRACE"];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* @type "null"
|
||||
*/
|
||||
export interface Null {}
|
||||
export type Null = null;
|
||||
export type Nullable<T> = T | Null;
|
||||
export type NullOrEmptyMap = {} | Null;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue