stitchkit 0.48.0 → 0.49.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/README.md +1 -2
- package/dist/browser/client.d.ts +3 -0
- package/dist/browser/client.d.ts.map +1 -1
- package/dist/browser/http.d.ts +7 -4
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/cli.js +3 -2
- package/dist/{index-nrytvb30.js → index-03j2t778.js} +5 -8
- package/dist/{index-kp8xamqp.js → index-0hj37z43.js} +4 -2
- package/dist/index-48ffdxgk.js +6 -0
- package/dist/{index-44xysy8r.js → index-fjfzsq6y.js} +383 -26
- package/dist/index-h05ygjqx.js +149 -0
- package/dist/{index-ee621cmy.js → index-jewp9r0a.js} +5 -139
- package/dist/index-p9d4cxt5.js +436 -0
- package/dist/{index-8ekq6res.js → index-v58mwa19.js} +4 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -3
- package/dist/node.d.ts +4 -3
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +109 -14
- package/dist/observability/audit.d.ts +4 -1
- package/dist/observability/audit.d.ts.map +1 -1
- package/dist/observability/index.d.ts +1 -0
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js +150 -16
- package/dist/observability/status.d.ts +105 -0
- package/dist/observability/status.d.ts.map +1 -0
- package/dist/server/bun.d.ts +7 -8
- package/dist/server/bun.d.ts.map +1 -1
- package/dist/server/implement.d.ts +16 -6
- package/dist/server/implement.d.ts.map +1 -1
- package/dist/server/index.d.ts +4 -3
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +132 -11
- package/dist/server/node.d.ts +12 -13
- package/dist/server/node.d.ts.map +1 -1
- package/dist/server/router.d.ts +4 -1
- package/dist/server/router.d.ts.map +1 -1
- package/dist/server/shutdown.d.ts +76 -0
- package/dist/server/shutdown.d.ts.map +1 -0
- package/dist/server/socket-io-config.d.ts +5 -1
- package/dist/server/socket-io-config.d.ts.map +1 -1
- package/dist/server/socket-io-node.d.ts +4 -1
- package/dist/server/socket-io-node.d.ts.map +1 -1
- package/dist/server/socket-io.d.ts +12 -4
- package/dist/server/socket-io.d.ts.map +1 -1
- package/dist/testing.d.ts +34 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +36 -0
- package/dist/tools/mcp.d.ts +1 -0
- package/dist/tools/mcp.d.ts.map +1 -1
- package/dist/tools.js +21 -428
- package/llms-full.txt +290 -43
- package/package.json +8 -3
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Immutable operational snapshot for one bounded observability sink. */
|
|
3
|
+
export declare const ObservabilitySinkStatusSchema: z.ZodReadonly<z.ZodObject<{
|
|
4
|
+
capacity: z.ZodNumber;
|
|
5
|
+
received: z.ZodNumber;
|
|
6
|
+
accepted: z.ZodNumber;
|
|
7
|
+
filtered: z.ZodNumber;
|
|
8
|
+
completed: z.ZodNumber;
|
|
9
|
+
dropped: z.ZodNumber;
|
|
10
|
+
failed: z.ZodNumber;
|
|
11
|
+
preparationFailed: z.ZodNumber;
|
|
12
|
+
preparing: z.ZodNumber;
|
|
13
|
+
pending: z.ZodNumber;
|
|
14
|
+
closed: z.ZodBoolean;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
export type ObservabilitySinkStatus = z.infer<typeof ObservabilitySinkStatusSchema>;
|
|
17
|
+
export declare const ObservabilityStatusSchema: z.ZodReadonly<z.ZodObject<{
|
|
18
|
+
request: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
19
|
+
capacity: z.ZodNumber;
|
|
20
|
+
received: z.ZodNumber;
|
|
21
|
+
accepted: z.ZodNumber;
|
|
22
|
+
filtered: z.ZodNumber;
|
|
23
|
+
completed: z.ZodNumber;
|
|
24
|
+
dropped: z.ZodNumber;
|
|
25
|
+
failed: z.ZodNumber;
|
|
26
|
+
preparationFailed: z.ZodNumber;
|
|
27
|
+
preparing: z.ZodNumber;
|
|
28
|
+
pending: z.ZodNumber;
|
|
29
|
+
closed: z.ZodBoolean;
|
|
30
|
+
}, z.core.$strip>>>;
|
|
31
|
+
tools: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
32
|
+
capacity: z.ZodNumber;
|
|
33
|
+
received: z.ZodNumber;
|
|
34
|
+
accepted: z.ZodNumber;
|
|
35
|
+
filtered: z.ZodNumber;
|
|
36
|
+
completed: z.ZodNumber;
|
|
37
|
+
dropped: z.ZodNumber;
|
|
38
|
+
failed: z.ZodNumber;
|
|
39
|
+
preparationFailed: z.ZodNumber;
|
|
40
|
+
preparing: z.ZodNumber;
|
|
41
|
+
pending: z.ZodNumber;
|
|
42
|
+
closed: z.ZodBoolean;
|
|
43
|
+
}, z.core.$strip>>>;
|
|
44
|
+
total: z.ZodReadonly<z.ZodObject<{
|
|
45
|
+
capacity: z.ZodNumber;
|
|
46
|
+
received: z.ZodNumber;
|
|
47
|
+
accepted: z.ZodNumber;
|
|
48
|
+
filtered: z.ZodNumber;
|
|
49
|
+
completed: z.ZodNumber;
|
|
50
|
+
dropped: z.ZodNumber;
|
|
51
|
+
failed: z.ZodNumber;
|
|
52
|
+
preparationFailed: z.ZodNumber;
|
|
53
|
+
preparing: z.ZodNumber;
|
|
54
|
+
pending: z.ZodNumber;
|
|
55
|
+
closed: z.ZodBoolean;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
export type ObservabilityStatus = z.infer<typeof ObservabilityStatusSchema>;
|
|
59
|
+
/** Final immutable state returned after observability admission closes and drains. */
|
|
60
|
+
export declare const ObservabilityDrainReportSchema: z.ZodReadonly<z.ZodObject<{
|
|
61
|
+
request: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
62
|
+
capacity: z.ZodNumber;
|
|
63
|
+
received: z.ZodNumber;
|
|
64
|
+
accepted: z.ZodNumber;
|
|
65
|
+
filtered: z.ZodNumber;
|
|
66
|
+
completed: z.ZodNumber;
|
|
67
|
+
dropped: z.ZodNumber;
|
|
68
|
+
failed: z.ZodNumber;
|
|
69
|
+
preparationFailed: z.ZodNumber;
|
|
70
|
+
preparing: z.ZodNumber;
|
|
71
|
+
pending: z.ZodNumber;
|
|
72
|
+
closed: z.ZodBoolean;
|
|
73
|
+
}, z.core.$strip>>>;
|
|
74
|
+
tools: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
75
|
+
capacity: z.ZodNumber;
|
|
76
|
+
received: z.ZodNumber;
|
|
77
|
+
accepted: z.ZodNumber;
|
|
78
|
+
filtered: z.ZodNumber;
|
|
79
|
+
completed: z.ZodNumber;
|
|
80
|
+
dropped: z.ZodNumber;
|
|
81
|
+
failed: z.ZodNumber;
|
|
82
|
+
preparationFailed: z.ZodNumber;
|
|
83
|
+
preparing: z.ZodNumber;
|
|
84
|
+
pending: z.ZodNumber;
|
|
85
|
+
closed: z.ZodBoolean;
|
|
86
|
+
}, z.core.$strip>>>;
|
|
87
|
+
total: z.ZodReadonly<z.ZodObject<{
|
|
88
|
+
capacity: z.ZodNumber;
|
|
89
|
+
received: z.ZodNumber;
|
|
90
|
+
accepted: z.ZodNumber;
|
|
91
|
+
filtered: z.ZodNumber;
|
|
92
|
+
completed: z.ZodNumber;
|
|
93
|
+
dropped: z.ZodNumber;
|
|
94
|
+
failed: z.ZodNumber;
|
|
95
|
+
preparationFailed: z.ZodNumber;
|
|
96
|
+
preparing: z.ZodNumber;
|
|
97
|
+
pending: z.ZodNumber;
|
|
98
|
+
closed: z.ZodBoolean;
|
|
99
|
+
}, z.core.$strip>>;
|
|
100
|
+
durationMs: z.ZodNumber;
|
|
101
|
+
}, z.core.$strip>>;
|
|
102
|
+
export type ObservabilityDrainReport = z.infer<typeof ObservabilityDrainReportSchema>;
|
|
103
|
+
/** Build and freeze the aggregate without exposing mutable counters. */
|
|
104
|
+
export declare function aggregateObservabilityStatus(surfaces: readonly ObservabilitySinkStatus[], closed: boolean): ObservabilitySinkStatus;
|
|
105
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/observability/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,yEAAyE;AACzE,eAAO,MAAM,6BAA6B;;;;;;;;;;;;kBAc7B,CAAC;AAEd,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AASpF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAA6C,CAAC;AAEpF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,sFAAsF;AACtF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAE9B,CAAC;AAEd,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAiBtF,wEAAwE;AACxE,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,SAAS,uBAAuB,EAAE,EAC5C,MAAM,EAAE,OAAO,GACd,uBAAuB,CAiBzB"}
|
package/dist/server/bun.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type ManagedServerHandle } from './shutdown';
|
|
2
|
+
import type { SocketIOServerLifecycle } from './socket-io';
|
|
1
3
|
import type { FetchComposition, FetchHandler, HandlerConfig, RawRoute, RawRouteContext } from './types';
|
|
2
4
|
/** The concrete `Bun.serve` server instance passed to Bun raw routes. */
|
|
3
5
|
export type BunServer = ReturnType<typeof Bun.serve>;
|
|
@@ -7,12 +9,7 @@ export type BunFetchHandler = FetchHandler<BunServer>;
|
|
|
7
9
|
export type BunFetchComposition = FetchComposition<BunServer>;
|
|
8
10
|
export type BunHandlerConfig = HandlerConfig<BunServer>;
|
|
9
11
|
type BunServeOptions = Parameters<typeof Bun.serve>[0];
|
|
10
|
-
type BunWebSocketHandlers =
|
|
11
|
-
websocket?: infer T;
|
|
12
|
-
} ? T : never;
|
|
13
|
-
type BunRoutes = BunServeOptions extends {
|
|
14
|
-
routes?: infer T;
|
|
15
|
-
} ? T : never;
|
|
12
|
+
type BunWebSocketHandlers = Bun.WebSocketHandler<unknown>;
|
|
16
13
|
type BunDevelopmentOptions = BunServeOptions extends {
|
|
17
14
|
development?: infer T;
|
|
18
15
|
} ? T : never;
|
|
@@ -21,12 +18,14 @@ export type ServerPassthrough = Omit<BunServeOptions, 'fetch' | 'port' | 'hostna
|
|
|
21
18
|
export interface BunServerConfig extends BunHandlerConfig, BunFetchComposition {
|
|
22
19
|
port?: number;
|
|
23
20
|
hostname?: string;
|
|
24
|
-
routes?: BunRoutes;
|
|
25
21
|
websocket?: BunWebSocketHandlers;
|
|
22
|
+
/** Full Stitchkit Socket.IO lifecycle; route and default websocket are mounted automatically. */
|
|
23
|
+
socket?: SocketIOServerLifecycle;
|
|
26
24
|
development?: BunDevelopmentOptions;
|
|
27
25
|
bun?: ServerPassthrough;
|
|
28
26
|
}
|
|
27
|
+
export type BunServerHandle = ManagedServerHandle<BunServer>;
|
|
29
28
|
/** Start the contract router through `Bun.serve`. */
|
|
30
|
-
export declare function createServer(config: BunServerConfig):
|
|
29
|
+
export declare function createServer(config: BunServerConfig): BunServerHandle;
|
|
31
30
|
export {};
|
|
32
31
|
//# sourceMappingURL=bun.d.ts.map
|
package/dist/server/bun.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../../src/server/bun.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,yEAAyE;AACzE,MAAM,MAAM,SAAS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AO,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,KAAK,oBAAoB,GAAG,GAAG,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC1D,KAAK,qBAAqB,GAAG,eAAe,SAAS;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,CAAC,GAAG,KAAK,CAAC;AAE3F,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,eAAe,EACf,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,aAAa,CAChF,CAAC;AAEF,8EAA8E;AAC9E,MAAM,WAAW,eAAgB,SAAQ,gBAAgB,EAAE,mBAAmB;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,iGAAiG;IACjG,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,GAAG,CAAC,EAAE,iBAAiB,CAAC;CACzB;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;AAE7D,qDAAqD;AACrD,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CAqIrE"}
|
|
@@ -30,12 +30,6 @@ export declare function defineMultipartStream<const E extends StreamingEndpoint,
|
|
|
30
30
|
files: StreamedFiles<E, R>;
|
|
31
31
|
}) => StreamingReturn<E>;
|
|
32
32
|
}): StreamingMultipartImplementation;
|
|
33
|
-
/**
|
|
34
|
-
* Bind a contract to its typed `handlers`, producing a `ServiceDef` to mount on
|
|
35
|
-
* `createServer`. Every handler is type-checked against its endpoint's schemas.
|
|
36
|
-
* Pass `TCtx` for a typed handler context — or use `createImplement` to fix it
|
|
37
|
-
* once.
|
|
38
|
-
*/
|
|
39
33
|
export declare function implement<T extends Record<string, EndpointDef>, TCtx extends RuntimeContext = RuntimeContext>(contract: ContractDef<T, string>, handlers: Handlers<T, TCtx>): ServiceDef;
|
|
40
34
|
/**
|
|
41
35
|
* Fix the handler context type once — `const implement =
|
|
@@ -43,5 +37,21 @@ export declare function implement<T extends Record<string, EndpointDef>, TCtx ex
|
|
|
43
37
|
* the generic. The application declares its context shape in a single place.
|
|
44
38
|
*/
|
|
45
39
|
export declare function createImplement<TCtx extends RuntimeContext>(): <T extends Record<string, EndpointDef>>(contract: ContractDef<T, string>, handlers: Handlers<T, TCtx>) => ServiceDef;
|
|
40
|
+
export type ImplementationRegistry = Record<string, ContractDef<Record<string, EndpointDef>, string>>;
|
|
41
|
+
/** Exact handlers map derived from a literal contract registry. */
|
|
42
|
+
export type RegistryHandlers<TContracts extends ImplementationRegistry, TCtx extends RuntimeContext = RuntimeContext> = {
|
|
43
|
+
[K in keyof TContracts]: TContracts[K] extends ContractDef<infer TEndpoints, string> ? Handlers<TEndpoints, TCtx> : never;
|
|
44
|
+
};
|
|
45
|
+
export type ExactRegistryHandlers<TContracts extends ImplementationRegistry, THandlers extends RegistryHandlers<TContracts, TCtx>, TCtx extends RuntimeContext> = THandlers & RegistryHandlers<TContracts, TCtx> & Record<Exclude<keyof THandlers, keyof TContracts>, never> & {
|
|
46
|
+
[K in keyof THandlers & keyof TContracts]: THandlers[K] & Record<Exclude<keyof THandlers[K], keyof RegistryHandlers<TContracts, TCtx>[K]>, never>;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Bind an exact `name → contract` registry to its exact handlers map. Missing,
|
|
50
|
+
* extra and endpoint-incompatible implementations fail at compile time; loose
|
|
51
|
+
* JavaScript callers receive the same checks at runtime.
|
|
52
|
+
*/
|
|
53
|
+
export declare function implementRegistry<const TContracts extends ImplementationRegistry, const THandlers extends RegistryHandlers<TContracts>>(contracts: TContracts, handlers: ExactRegistryHandlers<TContracts, THandlers, RuntimeContext>): ServiceDef[];
|
|
54
|
+
/** Fix one handler context type for every entry in an implementation registry. */
|
|
55
|
+
export declare function createImplementRegistry<TCtx extends RuntimeContext>(): <const TContracts extends ImplementationRegistry, const THandlers extends RegistryHandlers<TContracts, TCtx>>(contracts: TContracts, handlers: ExactRegistryHandlers<TContracts, THandlers, TCtx>) => ServiceDef[];
|
|
46
56
|
export {};
|
|
47
57
|
//# sourceMappingURL=implement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implement.d.ts","sourceRoot":"","sources":["../../src/server/implement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,cAAc,EACf,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EACV,sBAAsB,EACtB,QAAQ,EAER,iBAAiB,EACjB,UAAU,EACV,gCAAgC,EACjC,MAAM,SAAS,CAAC;AAEjB,KAAK,iBAAiB,GAAG,WAAW,GAAG;IACrC,SAAS,EAAE,mBAAmB,GAAG;QAAE,QAAQ,EAAE,QAAQ,CAAA;KAAE,CAAC;CACzD,CAAC;AACF,KAAK,WAAW,CAAC,CAAC,SAAS,iBAAiB,IAAI;KAC7C,CAAC,IAAI,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,GAAG,iBAAiB;CACxD,CAAC;AACF,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACzE,KAAK,aAAa,CAAC,CAAC,SAAS,iBAAiB,EAAE,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,IAAI;KACzE,CAAC,IAAI,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;QACvE,QAAQ,EAAE,IAAI,CAAC;KAChB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CAAC,KAC3D,UAAU,EAAE,CAChB"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export { AppError, appError, badRequest, conflict, forbidden, isStitchErrorCode, notFound, rateLimited, STITCH_ERROR_STATUS, type StitchErrorCode, unauthorized, } from '../contract';
|
|
2
2
|
export { errorCode, formatZodError, normalizeError, type ZodIssueSummary, zodIssues, } from '../internal/errors';
|
|
3
3
|
export { isWithinDir } from '../internal/within-dir';
|
|
4
|
-
export { type BunFetchComposition as FetchComposition, type BunFetchHandler as FetchHandler, type BunHandlerConfig as HandlerConfig, type BunRawRoute as RawRoute, type BunRawRouteContext as RawRouteContext, type BunServer, type BunServerConfig, createServer, type ServerPassthrough, } from './bun';
|
|
4
|
+
export { type BunFetchComposition as FetchComposition, type BunFetchHandler as FetchHandler, type BunHandlerConfig as HandlerConfig, type BunRawRoute as RawRoute, type BunRawRouteContext as RawRouteContext, type BunServer, type BunServerConfig, type BunServerHandle, createServer, type ServerPassthrough, } from './bun';
|
|
5
5
|
export { type CacheOptions, cacheHeaders, createCache } from './cache';
|
|
6
6
|
export { createHandler } from './create';
|
|
7
7
|
export { createErrorHook, type ErrorHookConfig, type ResolvedError, } from './error-hook';
|
|
8
8
|
export { createEventBus, type DefaultEventMap, type EventBus, type EventBusOptions, type EventHandler, } from './event-bus';
|
|
9
9
|
export { type ByteRange, parseByteRange, type ServeFileOptions, serveFile, staticRoute, weakETag, } from './file';
|
|
10
|
-
export { createImplement, defineMultipartStream, implement } from './implement';
|
|
10
|
+
export { createImplement, createImplementRegistry, defineMultipartStream, type ExactRegistryHandlers, type ImplementationRegistry, implement, implementRegistry, type RegistryHandlers, } from './implement';
|
|
11
11
|
export type { LogFormat } from './logger';
|
|
12
12
|
export { type AuthHook, type AuthHookConfig, type AuthRule, type BearerResolverConfig, createAuthHook, createBearerResolver, extractToken, type JwtPayload, type SignJwtOptions, signJwt, type VerifyJwtOptions, verifyJwt, } from './middleware/auth';
|
|
13
13
|
export { type CookieDef, type CookieOptions, defineCookie, parseCookies, serializeCookie, } from './middleware/cookies';
|
|
@@ -19,7 +19,8 @@ export { createRateLimiter, type RateLimitConfig } from './rate-limit';
|
|
|
19
19
|
export { errorResponse, parseBody, respondJson } from './raw';
|
|
20
20
|
export { bindRealtimeServer, type RealtimeServer, type RealtimeServerConnection, type RealtimeServerHandle, } from './realtime';
|
|
21
21
|
export { type ClientIpOptions, extractIp, generateTraceId, getClientInfo, resolveSocketIp, resolveTraceId, } from './request';
|
|
22
|
-
export type
|
|
22
|
+
export { type ManagedServerHandle, type ShutdownOptions, ShutdownOptionsSchema, type ShutdownResult, ShutdownResultSchema, type ShutdownState, ShutdownStateSchema, type ShutdownStatus, ShutdownStatusSchema, } from './shutdown';
|
|
23
|
+
export type { SocketIORequestPolicy, SocketIOServerConfig, SocketIOServerHandle, SocketIOServerLifecycle, } from './socket-io';
|
|
23
24
|
export { createSocketIOServer, socketIoLane } from './socket-io';
|
|
24
25
|
export { type ParseSSEOptions, parseSSE, streamSSE } from './stream';
|
|
25
26
|
export type { AuthorizationContext, EndpointHandlerContext, Handlers, LifecycleHooks, LoggingConfig, LogOutcome, MethodDef, MultipartFileMetadata, MultipartReceiver, MultipartReceiverResult, OperationIdentity, RouteGroup, ServiceDef, StitchLogger, StreamingMultipartImplementation, } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,KAAK,eAAe,EACpB,YAAY,GACb,MAAM,aAAa,CAAC;AAIrB,OAAO,EACL,SAAS,EACT,cAAc,EACd,cAAc,EACd,KAAK,eAAe,EACpB,SAAS,GACV,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,WAAW,EAAE,MAA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U,EACV,SAAS,EACT,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,gCAAgC,GACjC,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,YAAY,EACjB,wBAAwB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,aAAa,GACd,MAAM,aAAa,CAAC"}
|
package/dist/server/index.js
CHANGED
|
@@ -1,28 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ShutdownOptionsSchema,
|
|
3
|
+
ShutdownResultSchema,
|
|
4
|
+
ShutdownStateSchema,
|
|
5
|
+
ShutdownStatusSchema,
|
|
2
6
|
bindRealtimeServer,
|
|
3
7
|
composeWebSocketHandlers,
|
|
4
8
|
createHandler,
|
|
5
9
|
createImplement,
|
|
10
|
+
createImplementRegistry,
|
|
11
|
+
createServerLifecycle,
|
|
6
12
|
createSocketIOServer,
|
|
7
13
|
defineMultipartStream,
|
|
8
14
|
implement,
|
|
15
|
+
implementRegistry,
|
|
9
16
|
parseMultipart,
|
|
10
17
|
socketIoLane,
|
|
11
18
|
webSocketLane
|
|
12
|
-
} from "../index-
|
|
19
|
+
} from "../index-fjfzsq6y.js";
|
|
13
20
|
import {
|
|
14
21
|
createAuthHook,
|
|
15
22
|
createBearerResolver,
|
|
16
23
|
defineCookie,
|
|
17
24
|
deriveCodeChallenge,
|
|
18
25
|
extractToken,
|
|
19
|
-
inputIsQuery,
|
|
20
26
|
parseCookies,
|
|
21
27
|
serializeCookie,
|
|
22
28
|
signJwt,
|
|
23
29
|
verifyJwt,
|
|
24
30
|
verifyPkce
|
|
25
|
-
} from "../index-
|
|
31
|
+
} from "../index-03j2t778.js";
|
|
26
32
|
import {
|
|
27
33
|
DEFAULT_CORS_ALLOW_HEADERS,
|
|
28
34
|
DEFAULT_CORS_EXPOSE_HEADERS,
|
|
@@ -35,6 +41,9 @@ import {
|
|
|
35
41
|
realPathWithinDir,
|
|
36
42
|
toJsonSchema
|
|
37
43
|
} from "../index-yxpe3phd.js";
|
|
44
|
+
import {
|
|
45
|
+
inputIsQuery
|
|
46
|
+
} from "../index-48ffdxgk.js";
|
|
38
47
|
import {
|
|
39
48
|
AppError,
|
|
40
49
|
STITCH_ERROR_STATUS,
|
|
@@ -48,29 +57,125 @@ import {
|
|
|
48
57
|
generateTraceId,
|
|
49
58
|
getClientInfo,
|
|
50
59
|
getTraceId,
|
|
51
|
-
isRecord,
|
|
52
60
|
isStitchErrorCode,
|
|
53
61
|
normalizeError,
|
|
54
62
|
notFound,
|
|
55
|
-
parseTrailingWildcard,
|
|
56
63
|
rateLimited,
|
|
57
64
|
resolveSocketIp,
|
|
58
65
|
resolveTraceId,
|
|
59
66
|
unauthorized,
|
|
60
67
|
zodIssues
|
|
61
|
-
} from "../index-
|
|
68
|
+
} from "../index-jewp9r0a.js";
|
|
69
|
+
import {
|
|
70
|
+
isRecord,
|
|
71
|
+
parseTrailingWildcard
|
|
72
|
+
} from "../index-h05ygjqx.js";
|
|
62
73
|
// src/server/bun.ts
|
|
63
74
|
function createServer(config) {
|
|
64
|
-
const {
|
|
75
|
+
const {
|
|
76
|
+
websocket: configuredWebSocket,
|
|
77
|
+
socket,
|
|
78
|
+
development,
|
|
79
|
+
bun: bunExtra,
|
|
80
|
+
port = 3000,
|
|
81
|
+
hostname
|
|
82
|
+
} = config;
|
|
83
|
+
const socketRoutePrefix = socket?.route.path.replace(/\*socketPath$/, "");
|
|
84
|
+
const websocket = configuredWebSocket ?? socket?.websocket;
|
|
85
|
+
const openSockets = new Set;
|
|
86
|
+
let hadWebSockets = false;
|
|
87
|
+
const trackedWebSocket = websocket ? {
|
|
88
|
+
...websocket,
|
|
89
|
+
open(ws) {
|
|
90
|
+
hadWebSockets = true;
|
|
91
|
+
openSockets.add(ws);
|
|
92
|
+
websocket.open?.(ws);
|
|
93
|
+
},
|
|
94
|
+
close(ws, code, reason) {
|
|
95
|
+
openSockets.delete(ws);
|
|
96
|
+
websocket.close?.(ws, code, reason);
|
|
97
|
+
}
|
|
98
|
+
} : undefined;
|
|
99
|
+
let runtime;
|
|
100
|
+
const requireRuntime = () => {
|
|
101
|
+
if (!runtime)
|
|
102
|
+
throw new Error("[stitchkit] Bun server lifecycle started before Bun.serve");
|
|
103
|
+
return runtime;
|
|
104
|
+
};
|
|
105
|
+
const adapter = {
|
|
106
|
+
beginShutdown: () => socket?.beginShutdown(),
|
|
107
|
+
pendingRequests: () => runtime?.pendingRequests ?? 0,
|
|
108
|
+
pendingWebSockets: () => openSockets.size,
|
|
109
|
+
async closeRealtime() {
|
|
110
|
+
const logicalClose = socket?.close();
|
|
111
|
+
for (const ws of openSockets)
|
|
112
|
+
ws.close(1001, "Server shutting down");
|
|
113
|
+
await Promise.all([
|
|
114
|
+
logicalClose,
|
|
115
|
+
new Promise((resolve) => {
|
|
116
|
+
if (openSockets.size === 0) {
|
|
117
|
+
resolve();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const timer = setInterval(() => {
|
|
121
|
+
if (openSockets.size === 0) {
|
|
122
|
+
clearInterval(timer);
|
|
123
|
+
resolve();
|
|
124
|
+
}
|
|
125
|
+
}, 5);
|
|
126
|
+
})
|
|
127
|
+
]);
|
|
128
|
+
},
|
|
129
|
+
async stopGracefully() {
|
|
130
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
131
|
+
const server2 = requireRuntime();
|
|
132
|
+
if (server2.pendingRequests === 0 && openSockets.size === 0) {
|
|
133
|
+
const stopping = server2.stop(true);
|
|
134
|
+
if (!hadWebSockets)
|
|
135
|
+
await stopping;
|
|
136
|
+
else
|
|
137
|
+
stopping.catch(() => {
|
|
138
|
+
return;
|
|
139
|
+
});
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
await server2.stop(false);
|
|
143
|
+
},
|
|
144
|
+
async forceStop() {
|
|
145
|
+
for (const ws of openSockets)
|
|
146
|
+
ws.terminate();
|
|
147
|
+
openSockets.clear();
|
|
148
|
+
const stopping = requireRuntime().stop(true);
|
|
149
|
+
if (!hadWebSockets)
|
|
150
|
+
await stopping;
|
|
151
|
+
else
|
|
152
|
+
stopping.catch(() => {
|
|
153
|
+
return;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const lifecycle = createServerLifecycle(() => adapter);
|
|
65
158
|
const handler = createHandler(config);
|
|
66
|
-
const
|
|
67
|
-
|
|
159
|
+
const consumerFetch = config.wrapFetch ? config.wrapFetch(handler) : handler;
|
|
160
|
+
const admittedFetch = lifecycle.wrapFetch(consumerFetch);
|
|
161
|
+
const fetch = async (request, server2) => {
|
|
162
|
+
if (socket && socketRoutePrefix) {
|
|
163
|
+
const pathname = new URL(request.url).pathname;
|
|
164
|
+
if (pathname.startsWith(socketRoutePrefix)) {
|
|
165
|
+
return await socket.route.handler(request, {
|
|
166
|
+
params: { socketPath: pathname.slice(socketRoutePrefix.length) },
|
|
167
|
+
server: server2
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return admittedFetch(request, server2);
|
|
172
|
+
};
|
|
173
|
+
runtime = trackedWebSocket ? Bun.serve({
|
|
68
174
|
...bunExtra,
|
|
69
|
-
...routes && { routes },
|
|
70
175
|
...development && { development },
|
|
71
176
|
port,
|
|
72
177
|
hostname,
|
|
73
|
-
websocket,
|
|
178
|
+
websocket: trackedWebSocket,
|
|
74
179
|
fetch
|
|
75
180
|
}) : Bun.serve({
|
|
76
181
|
...bunExtra,
|
|
@@ -79,6 +184,16 @@ function createServer(config) {
|
|
|
79
184
|
hostname,
|
|
80
185
|
fetch
|
|
81
186
|
});
|
|
187
|
+
const server = runtime;
|
|
188
|
+
return {
|
|
189
|
+
url: server.url.toString().replace(/\/$/, ""),
|
|
190
|
+
port: server.port ?? port,
|
|
191
|
+
runtime: server,
|
|
192
|
+
get status() {
|
|
193
|
+
return lifecycle.status;
|
|
194
|
+
},
|
|
195
|
+
shutdown: lifecycle.shutdown
|
|
196
|
+
};
|
|
82
197
|
}
|
|
83
198
|
// src/server/swept-map.ts
|
|
84
199
|
function createSweptMap(options) {
|
|
@@ -810,6 +925,7 @@ export {
|
|
|
810
925
|
normalizeError,
|
|
811
926
|
isWithinDir,
|
|
812
927
|
isStitchErrorCode,
|
|
928
|
+
implementRegistry,
|
|
813
929
|
implement,
|
|
814
930
|
getClientInfo,
|
|
815
931
|
generateTraceId,
|
|
@@ -826,6 +942,7 @@ export {
|
|
|
826
942
|
createSocketIOServer,
|
|
827
943
|
createServer,
|
|
828
944
|
createRateLimiter,
|
|
945
|
+
createImplementRegistry,
|
|
829
946
|
createImplement,
|
|
830
947
|
createHandler,
|
|
831
948
|
createEventBus,
|
|
@@ -841,6 +958,10 @@ export {
|
|
|
841
958
|
bindRealtimeServer,
|
|
842
959
|
badRequest,
|
|
843
960
|
appError,
|
|
961
|
+
ShutdownStatusSchema,
|
|
962
|
+
ShutdownStateSchema,
|
|
963
|
+
ShutdownResultSchema,
|
|
964
|
+
ShutdownOptionsSchema,
|
|
844
965
|
STITCH_ERROR_STATUS,
|
|
845
966
|
DEFAULT_CORS_EXPOSE_HEADERS,
|
|
846
967
|
DEFAULT_CORS_ALLOW_HEADERS,
|
package/dist/server/node.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import type { Server as HttpServer } from 'node:http';
|
|
2
|
+
import { serve } from 'srvx/node';
|
|
3
|
+
import { type ManagedServerHandle } from './shutdown';
|
|
2
4
|
import type { FetchComposition, HandlerConfig } from './types';
|
|
5
|
+
export interface NodeSocketLifecycle {
|
|
6
|
+
attach(server: HttpServer): void;
|
|
7
|
+
beginShutdown(): void;
|
|
8
|
+
close(): Promise<void>;
|
|
9
|
+
connections(): number;
|
|
10
|
+
}
|
|
3
11
|
export interface NodeServerConfig extends HandlerConfig, FetchComposition {
|
|
4
12
|
port?: number;
|
|
5
13
|
hostname?: string;
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
* `node:http.Server` (srvx `server.node.server`) once it is listening, so
|
|
9
|
-
* Socket.IO owns the HTTP `upgrade` event on the same port.
|
|
10
|
-
*/
|
|
11
|
-
socket?: {
|
|
12
|
-
attach(server: HttpServer): void;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export interface NodeServerHandle {
|
|
16
|
-
url: string;
|
|
17
|
-
port: number;
|
|
18
|
-
close(closeActive?: boolean): Promise<void>;
|
|
14
|
+
/** A full Socket.IO lifecycle from `createSocketIOServer`. */
|
|
15
|
+
socket?: NodeSocketLifecycle;
|
|
19
16
|
}
|
|
17
|
+
export type NodeRuntimeServer = ReturnType<typeof serve>;
|
|
18
|
+
export type NodeServerHandle = ManagedServerHandle<NodeRuntimeServer>;
|
|
20
19
|
export declare function serveNode(config: NodeServerConfig): Promise<NodeServerHandle>;
|
|
21
20
|
//# sourceMappingURL=node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/server/node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/server/node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAkB,MAAM,WAAW,CAAC;AAEtE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE/D,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IACjC,aAAa,IAAI,IAAI,CAAC;IACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,WAAW,IAAI,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAiB,SAAQ,aAAa,EAAE,gBAAgB;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACzD,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;AAEtE,wBAAsB,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAoHnF"}
|
package/dist/server/router.d.ts
CHANGED
|
@@ -58,7 +58,10 @@ export declare function matchRawRoute<TServer>(rawRoutes: RawRoute<TServer>[], h
|
|
|
58
58
|
route: RawRoute<TServer>;
|
|
59
59
|
params: Record<string, string>;
|
|
60
60
|
} | null;
|
|
61
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Validate raw route structure and reject routes that the ordered matcher can
|
|
63
|
+
* prove ambiguous or unreachable. Partial overlaps remain legal.
|
|
64
|
+
*/
|
|
62
65
|
export declare function validateRawRoutes<TServer>(rawRoutes: RawRoute<TServer>[] | undefined): void;
|
|
63
66
|
export {};
|
|
64
67
|
//# sourceMappingURL=router.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/server/router.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE/E,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,UAAU,CAAC;IACpB,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAED,UAAU,UAAU;IAClB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM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aAAa;IAC5B,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EACxC,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,SAAS,GACzC,aAAa,EAAE,CAyBjB;AAID,wBAAgB,aAAa,CAAC,OAAO,EACnC,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,EAC9B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf;IAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,IAAI,CAyBrE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,SAAS,GAAG,IAAI,CAwC3F"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { FetchHandler } from './types';
|
|
3
|
+
export declare const ShutdownStateSchema: z.ZodEnum<{
|
|
4
|
+
clean: "clean";
|
|
5
|
+
"closing-realtime": "closing-realtime";
|
|
6
|
+
"draining-http": "draining-http";
|
|
7
|
+
forced: "forced";
|
|
8
|
+
running: "running";
|
|
9
|
+
"stopping-runtime": "stopping-runtime";
|
|
10
|
+
}>;
|
|
11
|
+
export type ShutdownState = z.infer<typeof ShutdownStateSchema>;
|
|
12
|
+
export declare const ShutdownOptionsSchema: z.ZodObject<{
|
|
13
|
+
gracePeriodMs: z.ZodDefault<z.ZodNumber>;
|
|
14
|
+
retryAfterSeconds: z.ZodDefault<z.ZodNumber>;
|
|
15
|
+
signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type ShutdownOptions = z.input<typeof ShutdownOptionsSchema>;
|
|
18
|
+
export declare const ShutdownStatusSchema: z.ZodObject<{
|
|
19
|
+
state: z.ZodEnum<{
|
|
20
|
+
clean: "clean";
|
|
21
|
+
"closing-realtime": "closing-realtime";
|
|
22
|
+
"draining-http": "draining-http";
|
|
23
|
+
forced: "forced";
|
|
24
|
+
running: "running";
|
|
25
|
+
"stopping-runtime": "stopping-runtime";
|
|
26
|
+
}>;
|
|
27
|
+
acceptedRequests: z.ZodNumber;
|
|
28
|
+
completedRequests: z.ZodNumber;
|
|
29
|
+
pendingRequests: z.ZodNumber;
|
|
30
|
+
pendingWebSockets: z.ZodNumber;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
export type ShutdownStatus = z.infer<typeof ShutdownStatusSchema>;
|
|
33
|
+
export declare const ShutdownResultSchema: z.ZodObject<{
|
|
34
|
+
outcome: z.ZodEnum<{
|
|
35
|
+
clean: "clean";
|
|
36
|
+
forced: "forced";
|
|
37
|
+
}>;
|
|
38
|
+
reason: z.ZodOptional<z.ZodEnum<{
|
|
39
|
+
deadline: "deadline";
|
|
40
|
+
signal: "signal";
|
|
41
|
+
}>>;
|
|
42
|
+
acceptedRequests: z.ZodNumber;
|
|
43
|
+
completedRequests: z.ZodNumber;
|
|
44
|
+
pendingRequests: z.ZodNumber;
|
|
45
|
+
pendingWebSockets: z.ZodNumber;
|
|
46
|
+
pendingRequestsAtForce: z.ZodNumber;
|
|
47
|
+
pendingWebSocketsAtForce: z.ZodNumber;
|
|
48
|
+
abortedRequests: z.ZodNumber;
|
|
49
|
+
forcedWebSockets: z.ZodNumber;
|
|
50
|
+
durationMs: z.ZodNumber;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type ShutdownResult = z.infer<typeof ShutdownResultSchema>;
|
|
53
|
+
/** Shared lifecycle shape; only the explicit runtime escape hatch varies. */
|
|
54
|
+
export interface ManagedServerHandle<TRuntime> {
|
|
55
|
+
readonly url: string;
|
|
56
|
+
readonly port: number;
|
|
57
|
+
readonly runtime: TRuntime;
|
|
58
|
+
readonly status: ShutdownStatus;
|
|
59
|
+
shutdown(options?: ShutdownOptions): Promise<ShutdownResult>;
|
|
60
|
+
}
|
|
61
|
+
export interface ShutdownAdapter {
|
|
62
|
+
beginShutdown(retryAfterSeconds: number): void;
|
|
63
|
+
pendingRequests(): number;
|
|
64
|
+
pendingWebSockets(): number;
|
|
65
|
+
closeRealtime(): Promise<void>;
|
|
66
|
+
stopGracefully(): Promise<void>;
|
|
67
|
+
forceStop(): Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
interface ServerLifecycle {
|
|
70
|
+
wrapFetch<TServer>(handler: FetchHandler<TServer>): FetchHandler<TServer>;
|
|
71
|
+
readonly status: ShutdownStatus;
|
|
72
|
+
shutdown(options?: ShutdownOptions): Promise<ShutdownResult>;
|
|
73
|
+
}
|
|
74
|
+
export declare function createServerLifecycle(getAdapter: () => ShutdownAdapter): ServerLifecycle;
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=shutdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shutdown.d.ts","sourceRoot":"","sources":["../../src/server/shutdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,mBAAmB;;;;;;;EAO9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,qBAAqB;;;;iBAahC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO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,CA8HxF"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Runtime-neutral Socket.IO configuration shared by Bun and Node adapters. */
|
|
2
2
|
import type { ServerOptions } from 'socket.io';
|
|
3
|
+
/** Runtime-neutral Engine.IO handshake policy, evaluated before shutdown admission. */
|
|
4
|
+
export type SocketIORequestPolicy = (request: Request) => boolean | Promise<boolean>;
|
|
3
5
|
export interface SocketIOServerConfig {
|
|
4
6
|
/** CORS — the browser origin(s) allowed to open a socket. */
|
|
5
7
|
cors: {
|
|
@@ -14,7 +16,9 @@ export interface SocketIOServerConfig {
|
|
|
14
16
|
pingTimeout?: number;
|
|
15
17
|
/** Heartbeat: ms between pings. */
|
|
16
18
|
pingInterval?: number;
|
|
19
|
+
/** Runtime-neutral policy for accepting a new Engine.IO handshake. */
|
|
20
|
+
allowRequest?: SocketIORequestPolicy;
|
|
17
21
|
/** Typed Socket.IO options not owned by this wrapper. */
|
|
18
|
-
serverOptions?: Partial<ServerOptions>;
|
|
22
|
+
serverOptions?: Omit<Partial<ServerOptions>, 'allowRequest'>;
|
|
19
23
|
}
|
|
20
24
|
//# sourceMappingURL=socket-io-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket-io-config.d.ts","sourceRoot":"","sources":["../../src/server/socket-io-config.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,oBAAoB;IACnC,6DAA6D;IAC7D,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC3D,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,UAAU,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;IAC5C,qEAAqE;IACrE,WAAW,CAAC,EAAE,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