@stacksjs/server 0.70.86 → 0.70.88

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.
@@ -1,91 +0,0 @@
1
- /**
2
- * Get the path to the maintenance file
3
- */
4
- export declare function maintenanceFilePath(): string;
5
- export declare function comingSoonFilePath(): string;
6
- export declare function siteModeFilePath(mode: SiteMode): string;
7
- /**
8
- * Check if the application is in maintenance mode
9
- */
10
- export declare function isDownForMaintenance(): Promise<boolean>;
11
- export declare function isComingSoon(): Promise<boolean>;
12
- /**
13
- * Get the maintenance mode payload
14
- */
15
- export declare function maintenancePayload(): Promise<MaintenancePayload | null>;
16
- export declare function comingSoonPayload(): Promise<MaintenancePayload | null>;
17
- export declare function siteModePayload(mode: SiteMode): Promise<MaintenancePayload | null>;
18
- export declare function activeSiteModePayload(): Promise<MaintenancePayload | null>;
19
- /**
20
- * Put the application into maintenance mode
21
- */
22
- export declare function down(options?: Partial<MaintenancePayload>): Promise<void>;
23
- export declare function comingSoon(options?: Partial<MaintenancePayload>): Promise<void>;
24
- /**
25
- * Bring the application out of maintenance mode
26
- */
27
- export declare function up(): Promise<void>;
28
- export declare function launch(): Promise<void>;
29
- /**
30
- * Check if an IP address is allowed during maintenance
31
- */
32
- export declare function isAllowedIp(ip: string, allowed?: string[]): boolean;
33
- /**
34
- * Check if a request has a valid bypass cookie
35
- */
36
- export declare function bypassCookieName(mode?: SiteMode): string;
37
- export declare function hasValidBypassCookie(cookies: Record<string, string>, secret: string, mode?: SiteMode): boolean;
38
- /**
39
- * Check if a request path matches the bypass secret
40
- */
41
- export declare function isSecretPath(path: string, secret: string): boolean;
42
- /**
43
- * Generate maintenance mode HTML response
44
- */
45
- export declare function maintenanceHtml(payload: MaintenancePayload): string;
46
- /**
47
- * Create a maintenance mode response
48
- */
49
- export declare function maintenanceResponse(payload: MaintenancePayload): Response;
50
- export declare function siteModeResponse(payload: MaintenancePayload): Response;
51
- /**
52
- * Create bypass cookie
53
- */
54
- export declare function bypassCookieValue(secret: string, mode?: SiteMode): string;
55
- /**
56
- * Single source of truth for the maintenance / coming-soon gate.
57
- *
58
- * Returns a `Response` to short-circuit the request, or `null` to let
59
- * normal request handling continue.
60
- *
61
- * Used by:
62
- * - the dev server's `onRequest` hook (so the gate runs before the
63
- * stx-serve view router or the API proxy ever sees the request);
64
- * - the global `Maintenance` middleware in production.
65
- *
66
- * Order of checks (mirrors Laravel):
67
- * 1. No active site-mode (no down file, no coming-soon file, no env
68
- * override) → pass through.
69
- * 2. Path is always-allowed (the holding page itself, email
70
- * subscribe, static assets) → pass through.
71
- * 3. Path matches the secret token → set mode-aware bypass cookie,
72
- * redirect home.
73
- * 4. Bypass cookie present OR client IP allowed → pass through.
74
- * 5. Otherwise → return the active mode's response (redirect for
75
- * coming-soon when a redirect URL is configured; HTML page for
76
- * maintenance).
77
- */
78
- export declare function maintenanceGate(req: Request): Promise<Response | null>;
79
- export declare interface MaintenancePayload {
80
- mode?: SiteMode
81
- time: number
82
- message?: string
83
- title?: string
84
- retry?: number
85
- secret?: string
86
- allowed?: string[]
87
- status?: number
88
- template?: string
89
- redirect?: string
90
- }
91
- export type SiteMode = 'maintenance' | 'coming-soon';
package/dist/proxy.d.ts DELETED
@@ -1,7 +0,0 @@
1
- /**` prefix, or uses a verb that never matches a
2
- * static stx page render. Without the verb rule,
3
- * `route.post('/subscribe', ...)` declared at the root hits stx-serve
4
- * and 404s.
5
- */
6
- export declare function isApiBoundRequest(req: Request, pathname: string): boolean;
7
- export declare function proxyToBackend(req: Request, backendBase: string, stripPrefix?: string): Promise<Response>;