@dsh-plus/access-gate 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ import { Context, Service } from "@deepseek-ai/cordis";
2
+ import z from "@deepseek-ai/schemastery";
3
+ //#region src/config.d.ts
4
+ declare const Config: z<Schemastery.ObjectS<{
5
+ enabled: z<boolean, boolean>;
6
+ token: z<string, string>;
7
+ allowedIps: z<string[], string[]>;
8
+ trustForwardedFor: z<boolean, boolean>;
9
+ cookieMaxAgeHours: z<number, number>;
10
+ loginFailLimit: z<number, number>;
11
+ loginCooldownMs: z<number, number>;
12
+ }>, Schemastery.ObjectT<{
13
+ enabled: z<boolean, boolean>;
14
+ token: z<string, string>;
15
+ allowedIps: z<string[], string[]>;
16
+ trustForwardedFor: z<boolean, boolean>;
17
+ cookieMaxAgeHours: z<number, number>;
18
+ loginFailLimit: z<number, number>;
19
+ loginCooldownMs: z<number, number>;
20
+ }>>;
21
+ type AccessGateConfig = Schemastery.TypeT<typeof Config>;
22
+ //#endregion
23
+ //#region src/index.d.ts
24
+ declare const name = "dsh-plus-access-gate";
25
+ declare const inject: readonly ["webServer"];
26
+ declare module '@deepseek-ai/cordis' {
27
+ interface Context {
28
+ accessGate: AccessGateService;
29
+ }
30
+ }
31
+ /** 围栏服务:持有当前配置读取器(settings 用户层热更新经 setSource 注入)。 */
32
+ declare class AccessGateService extends Service {
33
+ private current;
34
+ constructor(ctx: Context, config: AccessGateConfig);
35
+ /** 当前生效配置(诊断用)。 */
36
+ policy(): AccessGateConfig;
37
+ }
38
+ declare function apply(ctx: Context, config: AccessGateConfig): void;
39
+ //#endregion
40
+ export { AccessGateService, Config, apply, inject, name };