@zero-server/fetch 0.9.2 → 0.9.5
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 +2 -2
- package/index.d.ts +1 -1
- package/package.json +3 -2
- package/types/app.d.ts +223 -0
- package/types/auth.d.ts +520 -0
- package/types/body.d.ts +14 -0
- package/types/cli.d.ts +2 -0
- package/types/cluster.d.ts +75 -0
- package/types/env.d.ts +80 -0
- package/types/errors.d.ts +316 -0
- package/types/fetch.d.ts +43 -0
- package/types/grpc.d.ts +432 -0
- package/types/index.d.ts +384 -0
- package/types/lifecycle.d.ts +60 -0
- package/types/middleware.d.ts +320 -0
- package/types/observe.d.ts +304 -0
- package/types/orm.d.ts +1887 -0
- package/types/request.d.ts +109 -0
- package/types/response.d.ts +157 -0
- package/types/router.d.ts +78 -0
- package/types/sse.d.ts +78 -0
- package/types/websocket.d.ts +126 -0
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
// Type definitions for zero-server
|
|
2
|
+
// Project: https://github.com/tonywied17/zero-server
|
|
3
|
+
// Definitions by: zero-server contributors
|
|
4
|
+
|
|
5
|
+
/// <reference types="node" />
|
|
6
|
+
|
|
7
|
+
// --- Re-exports from individual type modules ---------------------
|
|
8
|
+
|
|
9
|
+
export { App, ListenOptions } from './app';
|
|
10
|
+
export { RouterInstance, RouteChain, RouteEntry, RouteInfo, RouteOptions, RouteHandler } from './router';
|
|
11
|
+
export { Request, RangeResult } from './request';
|
|
12
|
+
export { Response, SendFileOptions, CookieOptions, PushOptions } from './response';
|
|
13
|
+
export { SSEOptions, SSEStream } from './sse';
|
|
14
|
+
export { LifecycleManager, LifecycleState, LIFECYCLE_STATE } from './lifecycle';
|
|
15
|
+
export { ClusterManager, ClusterOptions, cluster } from './cluster';
|
|
16
|
+
export {
|
|
17
|
+
Logger, LoggerOptions, LogEntry, StructuredLoggerOptions, structuredLogger,
|
|
18
|
+
Counter, CounterOptions, Gauge, GaugeOptions, Histogram, HistogramOptions,
|
|
19
|
+
MetricsRegistry, MetricsRegistryOptions, DEFAULT_BUCKETS, DefaultMetrics,
|
|
20
|
+
createDefaultMetrics, MetricsMiddlewareOptions, metricsMiddleware, metricsEndpoint,
|
|
21
|
+
Span, Tracer, TracerOptions, TracingMiddlewareOptions,
|
|
22
|
+
parseTraceparent, formatTraceparent, tracingMiddleware, instrumentFetch,
|
|
23
|
+
HealthCheckResult, HealthCheckOptions, healthCheck,
|
|
24
|
+
CreateHealthHandlersOptions, createHealthHandlers,
|
|
25
|
+
memoryCheck, eventLoopCheck, diskSpaceCheck,
|
|
26
|
+
} from './observe';
|
|
27
|
+
export {
|
|
28
|
+
JwtHeader, JwtPayload, JwtDecoded, JwtSignOptions, JwtVerifyOptions, JwtVerifyResult,
|
|
29
|
+
JwtMiddlewareOptions, jwt, jwtSign, jwtVerify, jwtDecode,
|
|
30
|
+
JwksGetKey, JwksOptions, jwks,
|
|
31
|
+
TokenPairConfig, TokenPairInstance, tokenPair, createRefreshToken, SUPPORTED_ALGORITHMS,
|
|
32
|
+
Session, SessionData, SessionCookieOptions, SessionStore, MemoryStoreOptions, MemoryStore, SessionOptions, session,
|
|
33
|
+
OAuthProviderPreset, OAuthOptions, OAuthAuthorizeResult, OAuthTokens, OAuthClient,
|
|
34
|
+
oauth, generatePKCE, generateState, OAUTH_PROVIDERS,
|
|
35
|
+
authorize, can, canAny, Policy, gate, attachUserHelpers,
|
|
36
|
+
TwoFactor, twoFactor,
|
|
37
|
+
InMemoryReplayStore, ReplayStore, Verify2FAOptions,
|
|
38
|
+
WebAuthn, webauthn, WebAuthnRegistrationOptions, WebAuthnRegistrationResult,
|
|
39
|
+
WebAuthnVerifyRegistrationOptions, WebAuthnAuthenticationOptions,
|
|
40
|
+
WebAuthnAuthenticationResult, WebAuthnVerifyAuthenticationOptions,
|
|
41
|
+
TrustedDevice, trustedDevice, TrustedDeviceIssueOptions,
|
|
42
|
+
TrustedDeviceVerifyOptions, TrustedDeviceRevokeOptions,
|
|
43
|
+
EnrollmentFlow, EnrollmentOptions, enrollment,
|
|
44
|
+
} from './auth';
|
|
45
|
+
export {
|
|
46
|
+
NextFunction, MiddlewareFunction, ErrorHandlerFunction,
|
|
47
|
+
CorsOptions, cors,
|
|
48
|
+
BodyParserOptions, JsonParserOptions, UrlencodedParserOptions, TextParserOptions,
|
|
49
|
+
MultipartOptions, MultipartFile,
|
|
50
|
+
json, urlencoded, text, raw, multipart,
|
|
51
|
+
RateLimitOptions, rateLimit,
|
|
52
|
+
LoggerOptions, logger,
|
|
53
|
+
CompressOptions, compress,
|
|
54
|
+
HelmetOptions, helmet,
|
|
55
|
+
TimeoutOptions, timeout,
|
|
56
|
+
RequestIdOptions, requestId,
|
|
57
|
+
CookieParserStatic, cookieParser,
|
|
58
|
+
StaticOptions,
|
|
59
|
+
CsrfOptions, csrf,
|
|
60
|
+
ValidationRule, ValidatorSchema, ValidatorOptions, ValidateFunction, validate,
|
|
61
|
+
} from './middleware';
|
|
62
|
+
export { static } from './middleware';
|
|
63
|
+
export {
|
|
64
|
+
FetchOptions, FetchResponse, FetchHeaders, fetch,
|
|
65
|
+
} from './fetch';
|
|
66
|
+
export { Env, EnvFieldDef, EnvSchema, EnvLoadOptions, env } from './env';
|
|
67
|
+
export {
|
|
68
|
+
TYPES, SchemaColumnDef, validateValue, validateFKAction, validateCheck,
|
|
69
|
+
Query, Model, ModelHooks, ModelObserver, FindOrCreateResult, PaginatedResult,
|
|
70
|
+
Database, AdapterType, RetryOptions,
|
|
71
|
+
DatabaseView, DatabaseViewOptions,
|
|
72
|
+
FullTextSearch, FullTextSearchOptions, SearchOptions, SuggestOptions,
|
|
73
|
+
GeoQuery, GeoQueryOptions, NearOptions, WithinBounds,
|
|
74
|
+
GeoJSONPoint, GeoJSONFeature, GeoJSONFeatureCollection,
|
|
75
|
+
EARTH_RADIUS_KM, EARTH_RADIUS_MI,
|
|
76
|
+
Migrator, MigrationDefinition, MigrateResult, RollbackResult, MigrationStatus, defineMigration,
|
|
77
|
+
QueryCache, QueryCacheOptions, CacheStats,
|
|
78
|
+
Seeder, SeederRunner, Factory, Fake,
|
|
79
|
+
QueryProfiler, QueryProfilerOptions, ProfiledQuery, N1Detection, ProfilerMetrics,
|
|
80
|
+
ReplicaManager, ReplicaManagerOptions, HealthCheckResult,
|
|
81
|
+
// Phase 4
|
|
82
|
+
TenantManager, TenantManagerOptions, TenantMiddlewareOptions,
|
|
83
|
+
AuditLog, AuditLogOptions, AuditEntry, AuditTrailOptions, AuditMiddlewareOptions,
|
|
84
|
+
PluginManager, PluginDefinition, PluginInfo,
|
|
85
|
+
StoredProcedure, StoredProcedureOptions, ProcedureParam,
|
|
86
|
+
StoredFunction, StoredFunctionOptions,
|
|
87
|
+
TriggerManager, TriggerDefinition,
|
|
88
|
+
CLI, runCLI,
|
|
89
|
+
} from './orm';
|
|
90
|
+
// Re-export validate from orm as schemaValidate to avoid collision with middleware validate
|
|
91
|
+
export { validate as schemaValidate } from './orm';
|
|
92
|
+
export {
|
|
93
|
+
GrpcStatus, STATUS_NAMES, grpcToHttp, statusName as grpcStatusName,
|
|
94
|
+
Metadata as GrpcMetadata,
|
|
95
|
+
Writer as ProtoWriter, Reader as ProtoReader, encode as protoEncode, decode as protoDecode,
|
|
96
|
+
WIRE_TYPE, TYPE_INFO,
|
|
97
|
+
parseProto, parseProtoFile, tokenize,
|
|
98
|
+
frameEncode, FrameParser,
|
|
99
|
+
BaseCall, UnaryCall, ServerStreamCall, ClientStreamCall, BidiStreamCall,
|
|
100
|
+
GrpcServiceRegistry, GrpcServiceOptions, GrpcInterceptor, GrpcHandler,
|
|
101
|
+
GrpcClient, GrpcClientOptions, GrpcCallOptions, GrpcClientMultiAddressOptions,
|
|
102
|
+
ProtoSchema, MessageDescriptor, EnumDescriptor, ServiceDescriptor, MethodDescriptor, FieldDescriptor,
|
|
103
|
+
HealthService, ServingStatus,
|
|
104
|
+
ReflectionService, buildFileDescriptorProto,
|
|
105
|
+
LoadBalancer, Subchannel, SubchannelState, RoundRobinPicker,
|
|
106
|
+
ChannelCredentials, CredentialType, createRotatingCredentials,
|
|
107
|
+
watchProto, WatchProtoOptions,
|
|
108
|
+
} from './grpc';
|
|
109
|
+
export {
|
|
110
|
+
HttpError, HttpErrorOptions,
|
|
111
|
+
BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError,
|
|
112
|
+
MethodNotAllowedError, ConflictError, GoneError, PayloadTooLargeError,
|
|
113
|
+
UnprocessableEntityError, ValidationError, TooManyRequestsError,
|
|
114
|
+
InternalError, NotImplementedError, BadGatewayError, ServiceUnavailableError,
|
|
115
|
+
DatabaseError, DatabaseErrorOptions,
|
|
116
|
+
ConfigurationError, ConfigurationErrorOptions,
|
|
117
|
+
MiddlewareError, MiddlewareErrorOptions,
|
|
118
|
+
RoutingError, RoutingErrorOptions,
|
|
119
|
+
TimeoutError, TimeoutErrorOptions,
|
|
120
|
+
ConnectionError, ConnectionErrorOptions,
|
|
121
|
+
MigrationError, MigrationErrorOptions,
|
|
122
|
+
TransactionError, TransactionErrorOptions,
|
|
123
|
+
QueryError, QueryErrorOptions,
|
|
124
|
+
AdapterError, AdapterErrorOptions,
|
|
125
|
+
CacheError, CacheErrorOptions,
|
|
126
|
+
TenancyError, TenancyErrorOptions,
|
|
127
|
+
AuditError, AuditErrorOptions,
|
|
128
|
+
PluginError, PluginErrorOptions,
|
|
129
|
+
ProcedureError, ProcedureErrorOptions,
|
|
130
|
+
createError, isHttpError,
|
|
131
|
+
ErrorHandlerOptions, errorHandler,
|
|
132
|
+
Debug, DebugLogger, DebugLevels, debug,
|
|
133
|
+
} from './errors';
|
|
134
|
+
|
|
135
|
+
// --- Module Exports ----------------------------------------------
|
|
136
|
+
|
|
137
|
+
import { App } from './app';
|
|
138
|
+
import { RouterInstance } from './router';
|
|
139
|
+
import { WebSocketConnection, WebSocketPool } from './websocket';
|
|
140
|
+
import { SSEStream } from './sse';
|
|
141
|
+
import {
|
|
142
|
+
cors, json, urlencoded, text, raw, multipart,
|
|
143
|
+
rateLimit, logger, compress, helmet, timeout, requestId,
|
|
144
|
+
CookieParserStatic, csrf, ValidateFunction,
|
|
145
|
+
} from './middleware';
|
|
146
|
+
import { fetch } from './fetch';
|
|
147
|
+
import { Env } from './env';
|
|
148
|
+
import { Database, Model, Query } from './orm';
|
|
149
|
+
import { TYPES, validateFKAction, validateCheck } from './orm';
|
|
150
|
+
import { Migrator, QueryCache, Seeder, SeederRunner, Factory, Fake, defineMigration } from './orm';
|
|
151
|
+
import { QueryProfiler, ReplicaManager } from './orm';
|
|
152
|
+
import { TenantManager, AuditLog, PluginManager, StoredProcedure, StoredFunction, TriggerManager, CLI, runCLI } from './orm';
|
|
153
|
+
import { LifecycleManager, LIFECYCLE_STATE } from './lifecycle';
|
|
154
|
+
import { ClusterManager, cluster as clusterize } from './cluster';
|
|
155
|
+
import {
|
|
156
|
+
Logger, structuredLogger,
|
|
157
|
+
Counter, Gauge, Histogram, MetricsRegistry, DEFAULT_BUCKETS,
|
|
158
|
+
createDefaultMetrics, metricsMiddleware, metricsEndpoint as metricsEndpointHandler,
|
|
159
|
+
Span, Tracer, parseTraceparent, formatTraceparent, tracingMiddleware, instrumentFetch,
|
|
160
|
+
healthCheck, createHealthHandlers, memoryCheck, eventLoopCheck, diskSpaceCheck,
|
|
161
|
+
} from './observe';
|
|
162
|
+
import {
|
|
163
|
+
jwt, jwtSign, jwtVerify, jwtDecode, jwks, tokenPair, createRefreshToken, SUPPORTED_ALGORITHMS,
|
|
164
|
+
session, Session, MemoryStore,
|
|
165
|
+
oauth, generatePKCE, generateState, OAUTH_PROVIDERS,
|
|
166
|
+
authorize, can, canAny, Policy, gate, attachUserHelpers,
|
|
167
|
+
twoFactor,
|
|
168
|
+
webauthn,
|
|
169
|
+
trustedDevice,
|
|
170
|
+
enrollment,
|
|
171
|
+
} from './auth';
|
|
172
|
+
import {
|
|
173
|
+
GrpcStatus, grpcToHttp, statusName as grpcStatusName, STATUS_NAMES as GRPC_STATUS_NAMES,
|
|
174
|
+
GrpcMetadata, ProtoWriter, ProtoReader, protoEncode, protoDecode,
|
|
175
|
+
WIRE_TYPE, TYPE_INFO,
|
|
176
|
+
parseProto, parseProtoFile,
|
|
177
|
+
frameEncode, FrameParser,
|
|
178
|
+
GrpcServiceRegistry, GrpcClient,
|
|
179
|
+
ProtoSchema, GrpcServiceOptions, GrpcInterceptor, GrpcHandler,
|
|
180
|
+
HealthService as GrpcHealthService, ServingStatus as GrpcServingStatus,
|
|
181
|
+
ReflectionService as GrpcReflectionService,
|
|
182
|
+
LoadBalancer as GrpcLoadBalancer, Subchannel as GrpcSubchannel, SubchannelState as GrpcSubchannelState,
|
|
183
|
+
ChannelCredentials, createRotatingCredentials,
|
|
184
|
+
watchProto,
|
|
185
|
+
} from './grpc';
|
|
186
|
+
import {
|
|
187
|
+
HttpError, BadRequestError, UnauthorizedError, ForbiddenError,
|
|
188
|
+
NotFoundError, MethodNotAllowedError, ConflictError, GoneError,
|
|
189
|
+
PayloadTooLargeError, UnprocessableEntityError, ValidationError,
|
|
190
|
+
TooManyRequestsError, InternalError, NotImplementedError,
|
|
191
|
+
BadGatewayError, ServiceUnavailableError,
|
|
192
|
+
DatabaseError, ConfigurationError, MiddlewareError, RoutingError, TimeoutError,
|
|
193
|
+
ConnectionError, MigrationError, TransactionError, QueryError, AdapterError, CacheError,
|
|
194
|
+
TenancyError, AuditError, PluginError, ProcedureError,
|
|
195
|
+
createError, isHttpError, errorHandler, debug,
|
|
196
|
+
} from './errors';
|
|
197
|
+
|
|
198
|
+
declare function serveStatic(root: string, options?: import('./middleware').StaticOptions): import('./middleware').MiddlewareFunction;
|
|
199
|
+
|
|
200
|
+
declare const zeroServer: {
|
|
201
|
+
createApp(): App;
|
|
202
|
+
Router(): RouterInstance;
|
|
203
|
+
cors: typeof cors;
|
|
204
|
+
fetch: typeof fetch;
|
|
205
|
+
json: typeof json;
|
|
206
|
+
urlencoded: typeof urlencoded;
|
|
207
|
+
text: typeof text;
|
|
208
|
+
raw: typeof raw;
|
|
209
|
+
multipart: typeof multipart;
|
|
210
|
+
static: typeof serveStatic;
|
|
211
|
+
rateLimit: typeof rateLimit;
|
|
212
|
+
logger: typeof logger;
|
|
213
|
+
compress: typeof compress;
|
|
214
|
+
helmet: typeof helmet;
|
|
215
|
+
timeout: typeof timeout;
|
|
216
|
+
requestId: typeof requestId;
|
|
217
|
+
cookieParser: CookieParserStatic;
|
|
218
|
+
csrf: typeof csrf;
|
|
219
|
+
validate: ValidateFunction;
|
|
220
|
+
env: Env;
|
|
221
|
+
Database: typeof Database;
|
|
222
|
+
Model: typeof Model;
|
|
223
|
+
TYPES: typeof TYPES;
|
|
224
|
+
Query: typeof Query;
|
|
225
|
+
validateFKAction: typeof validateFKAction;
|
|
226
|
+
validateCheck: typeof validateCheck;
|
|
227
|
+
// Error handling & debugging
|
|
228
|
+
HttpError: typeof HttpError;
|
|
229
|
+
BadRequestError: typeof BadRequestError;
|
|
230
|
+
UnauthorizedError: typeof UnauthorizedError;
|
|
231
|
+
ForbiddenError: typeof ForbiddenError;
|
|
232
|
+
NotFoundError: typeof NotFoundError;
|
|
233
|
+
MethodNotAllowedError: typeof MethodNotAllowedError;
|
|
234
|
+
ConflictError: typeof ConflictError;
|
|
235
|
+
GoneError: typeof GoneError;
|
|
236
|
+
PayloadTooLargeError: typeof PayloadTooLargeError;
|
|
237
|
+
UnprocessableEntityError: typeof UnprocessableEntityError;
|
|
238
|
+
ValidationError: typeof ValidationError;
|
|
239
|
+
TooManyRequestsError: typeof TooManyRequestsError;
|
|
240
|
+
InternalError: typeof InternalError;
|
|
241
|
+
NotImplementedError: typeof NotImplementedError;
|
|
242
|
+
BadGatewayError: typeof BadGatewayError;
|
|
243
|
+
ServiceUnavailableError: typeof ServiceUnavailableError;
|
|
244
|
+
// Framework-specific errors
|
|
245
|
+
DatabaseError: typeof DatabaseError;
|
|
246
|
+
ConfigurationError: typeof ConfigurationError;
|
|
247
|
+
MiddlewareError: typeof MiddlewareError;
|
|
248
|
+
RoutingError: typeof RoutingError;
|
|
249
|
+
TimeoutError: typeof TimeoutError;
|
|
250
|
+
// ORM-specific errors
|
|
251
|
+
ConnectionError: typeof ConnectionError;
|
|
252
|
+
MigrationError: typeof MigrationError;
|
|
253
|
+
TransactionError: typeof TransactionError;
|
|
254
|
+
QueryError: typeof QueryError;
|
|
255
|
+
AdapterError: typeof AdapterError;
|
|
256
|
+
CacheError: typeof CacheError;
|
|
257
|
+
// Phase 4 errors
|
|
258
|
+
TenancyError: typeof TenancyError;
|
|
259
|
+
AuditError: typeof AuditError;
|
|
260
|
+
PluginError: typeof PluginError;
|
|
261
|
+
ProcedureError: typeof ProcedureError;
|
|
262
|
+
createError: typeof createError;
|
|
263
|
+
isHttpError: typeof isHttpError;
|
|
264
|
+
errorHandler: typeof errorHandler;
|
|
265
|
+
debug: typeof debug;
|
|
266
|
+
// ORM Extended 0.6.0 features
|
|
267
|
+
Migrator: typeof Migrator;
|
|
268
|
+
defineMigration: typeof defineMigration;
|
|
269
|
+
QueryCache: typeof QueryCache;
|
|
270
|
+
Seeder: typeof Seeder;
|
|
271
|
+
SeederRunner: typeof SeederRunner;
|
|
272
|
+
Factory: typeof Factory;
|
|
273
|
+
Fake: typeof Fake;
|
|
274
|
+
QueryProfiler: typeof QueryProfiler;
|
|
275
|
+
ReplicaManager: typeof ReplicaManager;
|
|
276
|
+
// ORM Enterprise (Phase 4)
|
|
277
|
+
TenantManager: typeof TenantManager;
|
|
278
|
+
AuditLog: typeof AuditLog;
|
|
279
|
+
PluginManager: typeof PluginManager;
|
|
280
|
+
StoredProcedure: typeof StoredProcedure;
|
|
281
|
+
StoredFunction: typeof StoredFunction;
|
|
282
|
+
TriggerManager: typeof TriggerManager;
|
|
283
|
+
// CLI tooling
|
|
284
|
+
CLI: typeof CLI;
|
|
285
|
+
runCLI: typeof runCLI;
|
|
286
|
+
// classes
|
|
287
|
+
WebSocketConnection: WebSocketConnection;
|
|
288
|
+
WebSocketPool: {
|
|
289
|
+
new(): WebSocketPool;
|
|
290
|
+
};
|
|
291
|
+
SSEStream: SSEStream;
|
|
292
|
+
// Lifecycle & Clustering
|
|
293
|
+
LifecycleManager: typeof LifecycleManager;
|
|
294
|
+
LIFECYCLE_STATE: typeof LIFECYCLE_STATE;
|
|
295
|
+
ClusterManager: typeof ClusterManager;
|
|
296
|
+
cluster: typeof clusterize;
|
|
297
|
+
// Observability — Structured Logging
|
|
298
|
+
Logger: typeof Logger;
|
|
299
|
+
structuredLogger: typeof structuredLogger;
|
|
300
|
+
// Observability — Metrics
|
|
301
|
+
Counter: typeof Counter;
|
|
302
|
+
Gauge: typeof Gauge;
|
|
303
|
+
Histogram: typeof Histogram;
|
|
304
|
+
MetricsRegistry: typeof MetricsRegistry;
|
|
305
|
+
DEFAULT_BUCKETS: typeof DEFAULT_BUCKETS;
|
|
306
|
+
createDefaultMetrics: typeof createDefaultMetrics;
|
|
307
|
+
metricsMiddleware: typeof metricsMiddleware;
|
|
308
|
+
metricsEndpoint: typeof metricsEndpointHandler;
|
|
309
|
+
// Observability — Tracing
|
|
310
|
+
Span: typeof Span;
|
|
311
|
+
Tracer: typeof Tracer;
|
|
312
|
+
parseTraceparent: typeof parseTraceparent;
|
|
313
|
+
formatTraceparent: typeof formatTraceparent;
|
|
314
|
+
tracingMiddleware: typeof tracingMiddleware;
|
|
315
|
+
instrumentFetch: typeof instrumentFetch;
|
|
316
|
+
// Observability — Health Checks
|
|
317
|
+
healthCheck: typeof healthCheck;
|
|
318
|
+
createHealthHandlers: typeof createHealthHandlers;
|
|
319
|
+
memoryCheck: typeof memoryCheck;
|
|
320
|
+
eventLoopCheck: typeof eventLoopCheck;
|
|
321
|
+
diskSpaceCheck: typeof diskSpaceCheck;
|
|
322
|
+
// Authentication & Sessions (Phase 3)
|
|
323
|
+
jwt: typeof jwt;
|
|
324
|
+
jwtSign: typeof jwtSign;
|
|
325
|
+
jwtVerify: typeof jwtVerify;
|
|
326
|
+
jwtDecode: typeof jwtDecode;
|
|
327
|
+
jwks: typeof jwks;
|
|
328
|
+
tokenPair: typeof tokenPair;
|
|
329
|
+
createRefreshToken: typeof createRefreshToken;
|
|
330
|
+
SUPPORTED_ALGORITHMS: typeof SUPPORTED_ALGORITHMS;
|
|
331
|
+
session: typeof session;
|
|
332
|
+
Session: typeof Session;
|
|
333
|
+
MemoryStore: typeof MemoryStore;
|
|
334
|
+
oauth: typeof oauth;
|
|
335
|
+
generatePKCE: typeof generatePKCE;
|
|
336
|
+
generateState: typeof generateState;
|
|
337
|
+
OAUTH_PROVIDERS: typeof OAUTH_PROVIDERS;
|
|
338
|
+
authorize: typeof authorize;
|
|
339
|
+
can: typeof can;
|
|
340
|
+
canAny: typeof canAny;
|
|
341
|
+
Policy: typeof Policy;
|
|
342
|
+
gate: typeof gate;
|
|
343
|
+
attachUserHelpers: typeof attachUserHelpers;
|
|
344
|
+
twoFactor: typeof twoFactor;
|
|
345
|
+
webauthn: typeof webauthn;
|
|
346
|
+
trustedDevice: typeof trustedDevice;
|
|
347
|
+
enrollment: typeof enrollment;
|
|
348
|
+
// gRPC
|
|
349
|
+
GrpcStatus: typeof GrpcStatus;
|
|
350
|
+
grpcToHttp: typeof grpcToHttp;
|
|
351
|
+
grpcStatusName: typeof grpcStatusName;
|
|
352
|
+
GRPC_STATUS_NAMES: typeof GRPC_STATUS_NAMES;
|
|
353
|
+
GrpcMetadata: typeof GrpcMetadata;
|
|
354
|
+
ProtoWriter: typeof ProtoWriter;
|
|
355
|
+
ProtoReader: typeof ProtoReader;
|
|
356
|
+
protoEncode: typeof protoEncode;
|
|
357
|
+
protoDecode: typeof protoDecode;
|
|
358
|
+
WIRE_TYPE: typeof WIRE_TYPE;
|
|
359
|
+
TYPE_INFO: typeof TYPE_INFO;
|
|
360
|
+
parseProto: typeof parseProto;
|
|
361
|
+
parseProtoFile: typeof parseProtoFile;
|
|
362
|
+
frameEncode: typeof frameEncode;
|
|
363
|
+
FrameParser: typeof FrameParser;
|
|
364
|
+
GrpcServiceRegistry: typeof GrpcServiceRegistry;
|
|
365
|
+
GrpcClient: typeof GrpcClient;
|
|
366
|
+
// gRPC: Health check
|
|
367
|
+
GrpcHealthService: typeof GrpcHealthService;
|
|
368
|
+
GrpcServingStatus: typeof GrpcServingStatus;
|
|
369
|
+
// gRPC: Server reflection
|
|
370
|
+
GrpcReflectionService: typeof GrpcReflectionService;
|
|
371
|
+
// gRPC: Load balancing
|
|
372
|
+
GrpcLoadBalancer: typeof GrpcLoadBalancer;
|
|
373
|
+
GrpcSubchannel: typeof GrpcSubchannel;
|
|
374
|
+
GrpcSubchannelState: typeof GrpcSubchannelState;
|
|
375
|
+
// gRPC: Channel credentials
|
|
376
|
+
ChannelCredentials: typeof ChannelCredentials;
|
|
377
|
+
createRotatingCredentials: typeof createRotatingCredentials;
|
|
378
|
+
// gRPC: Proto hot-reload
|
|
379
|
+
watchProto: typeof watchProto;
|
|
380
|
+
/** Package version string */
|
|
381
|
+
version: string;
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
export default zeroServer;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
import { ServerResponse } from 'http';
|
|
4
|
+
|
|
5
|
+
export type LifecycleState = 'running' | 'draining' | 'closed';
|
|
6
|
+
|
|
7
|
+
export declare const LIFECYCLE_STATE: {
|
|
8
|
+
readonly RUNNING: 'running';
|
|
9
|
+
readonly DRAINING: 'draining';
|
|
10
|
+
readonly CLOSED: 'closed';
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export declare class LifecycleManager {
|
|
14
|
+
constructor(app: import('./app').App);
|
|
15
|
+
|
|
16
|
+
/** Current lifecycle state. */
|
|
17
|
+
readonly state: LifecycleState;
|
|
18
|
+
|
|
19
|
+
/** Number of currently active HTTP requests. */
|
|
20
|
+
readonly activeRequests: number;
|
|
21
|
+
|
|
22
|
+
/** Whether the server is draining. */
|
|
23
|
+
readonly isDraining: boolean;
|
|
24
|
+
|
|
25
|
+
/** Whether the server has fully shut down. */
|
|
26
|
+
readonly isClosed: boolean;
|
|
27
|
+
|
|
28
|
+
/** Register a lifecycle event listener. */
|
|
29
|
+
on(event: 'beforeShutdown' | 'shutdown', fn: () => void | Promise<void>): LifecycleManager;
|
|
30
|
+
|
|
31
|
+
/** Remove a lifecycle event listener. */
|
|
32
|
+
off(event: 'beforeShutdown' | 'shutdown', fn: () => void | Promise<void>): LifecycleManager;
|
|
33
|
+
|
|
34
|
+
/** Track an active HTTP request. */
|
|
35
|
+
trackRequest(res: ServerResponse): void;
|
|
36
|
+
|
|
37
|
+
/** Register a WebSocket pool for graceful shutdown. */
|
|
38
|
+
registerPool(pool: import('./websocket').WebSocketPool): LifecycleManager;
|
|
39
|
+
|
|
40
|
+
/** Unregister a WebSocket pool. */
|
|
41
|
+
unregisterPool(pool: import('./websocket').WebSocketPool): LifecycleManager;
|
|
42
|
+
|
|
43
|
+
/** Track an SSE stream for graceful shutdown. */
|
|
44
|
+
trackSSE(stream: import('./sse').SSEStream): LifecycleManager;
|
|
45
|
+
|
|
46
|
+
/** Register an ORM Database for shutdown. */
|
|
47
|
+
registerDatabase(db: { close(): Promise<void> }): LifecycleManager;
|
|
48
|
+
|
|
49
|
+
/** Unregister an ORM Database. */
|
|
50
|
+
unregisterDatabase(db: { close(): Promise<void> }): LifecycleManager;
|
|
51
|
+
|
|
52
|
+
/** Install SIGTERM/SIGINT process signal handlers. */
|
|
53
|
+
installSignalHandlers(): void;
|
|
54
|
+
|
|
55
|
+
/** Remove installed signal handlers. */
|
|
56
|
+
removeSignalHandlers(): void;
|
|
57
|
+
|
|
58
|
+
/** Perform a full graceful shutdown. */
|
|
59
|
+
shutdown(opts?: { timeout?: number }): Promise<void>;
|
|
60
|
+
}
|