@spikard/node 0.13.0 → 0.15.1
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 +102 -196
- package/index.d.ts +729 -299
- package/index.js +140 -117
- package/package.json +27 -76
- package/spikard-node.linux-x64-gnu.node +0 -0
- package/LICENSE +0 -21
- package/dist/index.d.mts +0 -475
- package/dist/index.d.ts +0 -475
- package/dist/index.js +0 -2059
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -2006
- package/dist/index.mjs.map +0 -1
package/dist/index.d.ts
DELETED
|
@@ -1,475 +0,0 @@
|
|
|
1
|
-
interface CompressionConfig {
|
|
2
|
-
gzip?: boolean;
|
|
3
|
-
brotli?: boolean;
|
|
4
|
-
minSize?: number;
|
|
5
|
-
quality?: number;
|
|
6
|
-
}
|
|
7
|
-
interface RateLimitConfig {
|
|
8
|
-
perSecond: number;
|
|
9
|
-
burst: number;
|
|
10
|
-
ipBased?: boolean;
|
|
11
|
-
}
|
|
12
|
-
interface JwtConfig {
|
|
13
|
-
secret: string;
|
|
14
|
-
algorithm?: string;
|
|
15
|
-
audience?: string[];
|
|
16
|
-
issuer?: string;
|
|
17
|
-
leeway?: number;
|
|
18
|
-
}
|
|
19
|
-
interface ApiKeyConfig {
|
|
20
|
-
keys: string[];
|
|
21
|
-
headerName?: string;
|
|
22
|
-
}
|
|
23
|
-
interface ContactInfo {
|
|
24
|
-
name?: string;
|
|
25
|
-
email?: string;
|
|
26
|
-
url?: string;
|
|
27
|
-
}
|
|
28
|
-
interface LicenseInfo {
|
|
29
|
-
name: string;
|
|
30
|
-
url?: string;
|
|
31
|
-
}
|
|
32
|
-
interface ServerInfo {
|
|
33
|
-
url: string;
|
|
34
|
-
description?: string;
|
|
35
|
-
}
|
|
36
|
-
interface SecuritySchemeInfo {
|
|
37
|
-
type: "http" | "apiKey";
|
|
38
|
-
scheme?: string;
|
|
39
|
-
bearerFormat?: string;
|
|
40
|
-
location?: "header" | "query" | "cookie";
|
|
41
|
-
name?: string;
|
|
42
|
-
}
|
|
43
|
-
interface OpenApiConfig {
|
|
44
|
-
enabled?: boolean;
|
|
45
|
-
title?: string;
|
|
46
|
-
version?: string;
|
|
47
|
-
description?: string;
|
|
48
|
-
swaggerUiPath?: string;
|
|
49
|
-
redocPath?: string;
|
|
50
|
-
openapiJsonPath?: string;
|
|
51
|
-
contact?: ContactInfo;
|
|
52
|
-
license?: LicenseInfo;
|
|
53
|
-
servers?: ServerInfo[];
|
|
54
|
-
securitySchemes?: Record<string, SecuritySchemeInfo>;
|
|
55
|
-
}
|
|
56
|
-
interface JsonRpcConfig {
|
|
57
|
-
enabled?: boolean;
|
|
58
|
-
endpointPath?: string;
|
|
59
|
-
enableBatch?: boolean;
|
|
60
|
-
maxBatchSize?: number;
|
|
61
|
-
}
|
|
62
|
-
interface StaticFilesConfig {
|
|
63
|
-
directory: string;
|
|
64
|
-
routePrefix: string;
|
|
65
|
-
indexFile?: boolean;
|
|
66
|
-
cacheControl?: string;
|
|
67
|
-
}
|
|
68
|
-
interface ServerConfig {
|
|
69
|
-
host?: string;
|
|
70
|
-
port?: number;
|
|
71
|
-
workers?: number;
|
|
72
|
-
enableRequestId?: boolean;
|
|
73
|
-
maxBodySize?: number | null;
|
|
74
|
-
requestTimeout?: number | null;
|
|
75
|
-
compression?: CompressionConfig | null;
|
|
76
|
-
rateLimit?: RateLimitConfig | null;
|
|
77
|
-
jwtAuth?: JwtConfig | null;
|
|
78
|
-
apiKeyAuth?: ApiKeyConfig | null;
|
|
79
|
-
staticFiles?: StaticFilesConfig[];
|
|
80
|
-
gracefulShutdown?: boolean;
|
|
81
|
-
shutdownTimeout?: number;
|
|
82
|
-
openapi?: OpenApiConfig | null;
|
|
83
|
-
jsonrpc?: JsonRpcConfig | null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
type GrpcMetadata = Record<string, string>;
|
|
87
|
-
interface GrpcRequest {
|
|
88
|
-
serviceName: string;
|
|
89
|
-
methodName: string;
|
|
90
|
-
payload: Buffer;
|
|
91
|
-
metadata: GrpcMetadata;
|
|
92
|
-
}
|
|
93
|
-
interface GrpcResponse {
|
|
94
|
-
payload: Buffer;
|
|
95
|
-
metadata?: GrpcMetadata;
|
|
96
|
-
}
|
|
97
|
-
interface GrpcClientStreamRequest {
|
|
98
|
-
serviceName: string;
|
|
99
|
-
methodName: string;
|
|
100
|
-
metadata: GrpcMetadata;
|
|
101
|
-
messages: Buffer[];
|
|
102
|
-
}
|
|
103
|
-
interface GrpcServerStreamResponse {
|
|
104
|
-
messages: Buffer[];
|
|
105
|
-
}
|
|
106
|
-
interface GrpcBidiStreamRequest {
|
|
107
|
-
serviceName: string;
|
|
108
|
-
methodName: string;
|
|
109
|
-
metadata: GrpcMetadata;
|
|
110
|
-
messages: Buffer[];
|
|
111
|
-
}
|
|
112
|
-
interface GrpcBidiStreamResponse {
|
|
113
|
-
messages: Buffer[];
|
|
114
|
-
metadata?: GrpcMetadata;
|
|
115
|
-
}
|
|
116
|
-
interface GrpcHandler {
|
|
117
|
-
handleRequest(request: GrpcRequest): Promise<GrpcResponse>;
|
|
118
|
-
}
|
|
119
|
-
interface GrpcServerStreamingHandler {
|
|
120
|
-
handleServerStream(request: GrpcRequest): Promise<GrpcServerStreamResponse>;
|
|
121
|
-
}
|
|
122
|
-
interface GrpcClientStreamingHandler {
|
|
123
|
-
handleClientStream(request: GrpcClientStreamRequest): Promise<GrpcResponse>;
|
|
124
|
-
}
|
|
125
|
-
interface GrpcBidirectionalStreamingHandler {
|
|
126
|
-
handleBidiStream(request: GrpcBidiStreamRequest): Promise<GrpcBidiStreamResponse>;
|
|
127
|
-
}
|
|
128
|
-
declare enum GrpcStatusCode {
|
|
129
|
-
OK = 0,
|
|
130
|
-
CANCELLED = 1,
|
|
131
|
-
UNKNOWN = 2,
|
|
132
|
-
INVALID_ARGUMENT = 3,
|
|
133
|
-
DEADLINE_EXCEEDED = 4,
|
|
134
|
-
NOT_FOUND = 5,
|
|
135
|
-
ALREADY_EXISTS = 6,
|
|
136
|
-
PERMISSION_DENIED = 7,
|
|
137
|
-
RESOURCE_EXHAUSTED = 8,
|
|
138
|
-
FAILED_PRECONDITION = 9,
|
|
139
|
-
ABORTED = 10,
|
|
140
|
-
OUT_OF_RANGE = 11,
|
|
141
|
-
UNIMPLEMENTED = 12,
|
|
142
|
-
INTERNAL = 13,
|
|
143
|
-
UNAVAILABLE = 14,
|
|
144
|
-
DATA_LOSS = 15,
|
|
145
|
-
UNAUTHENTICATED = 16
|
|
146
|
-
}
|
|
147
|
-
declare class GrpcError extends Error {
|
|
148
|
-
readonly code: GrpcStatusCode;
|
|
149
|
-
constructor(code: GrpcStatusCode, message: string);
|
|
150
|
-
}
|
|
151
|
-
type GrpcRpcMode = "unary" | "serverStreaming" | "clientStreaming" | "bidirectionalStreaming";
|
|
152
|
-
type GrpcMethodHandler = GrpcHandler | GrpcServerStreamingHandler | GrpcClientStreamingHandler | GrpcBidirectionalStreamingHandler;
|
|
153
|
-
interface GrpcMethodConfig {
|
|
154
|
-
serviceName: string;
|
|
155
|
-
methodName: string;
|
|
156
|
-
rpcMode: GrpcRpcMode;
|
|
157
|
-
handler: GrpcMethodHandler;
|
|
158
|
-
}
|
|
159
|
-
declare class GrpcService {
|
|
160
|
-
private readonly methods;
|
|
161
|
-
private methodKey;
|
|
162
|
-
private registerMethod;
|
|
163
|
-
registerUnary(serviceName: string, methodName: string, handler: GrpcHandler): this;
|
|
164
|
-
registerServerStreaming(serviceName: string, methodName: string, handler: GrpcServerStreamingHandler): this;
|
|
165
|
-
registerClientStreaming(serviceName: string, methodName: string, handler: GrpcClientStreamingHandler): this;
|
|
166
|
-
registerBidirectionalStreaming(serviceName: string, methodName: string, handler: GrpcBidirectionalStreamingHandler): this;
|
|
167
|
-
unregister(serviceName: string, methodName: string): void;
|
|
168
|
-
getMethod(serviceName: string, methodName: string): GrpcMethodConfig | undefined;
|
|
169
|
-
serviceNames(): string[];
|
|
170
|
-
methodNames(serviceName: string): string[];
|
|
171
|
-
hasMethod(serviceName: string, methodName: string): boolean;
|
|
172
|
-
entries(): GrpcMethodConfig[];
|
|
173
|
-
handleRequest(request: GrpcRequest): Promise<GrpcResponse>;
|
|
174
|
-
}
|
|
175
|
-
type UnaryHandlerResult<TResponse> = TResponse | {
|
|
176
|
-
response: TResponse;
|
|
177
|
-
metadata?: Record<string, string>;
|
|
178
|
-
};
|
|
179
|
-
declare function createUnaryHandler<TRequest, TResponse>(methodName: string, handler: (request: TRequest, metadata: Record<string, string>) => Promise<UnaryHandlerResult<TResponse>>, requestType: {
|
|
180
|
-
decode(buffer: Uint8Array): TRequest;
|
|
181
|
-
}, responseType: {
|
|
182
|
-
encode(message: TResponse): {
|
|
183
|
-
finish(): Uint8Array;
|
|
184
|
-
};
|
|
185
|
-
}): GrpcHandler;
|
|
186
|
-
declare function createServiceHandler(methods: Record<string, GrpcHandler>): GrpcHandler;
|
|
187
|
-
|
|
188
|
-
interface StreamingResponseInit {
|
|
189
|
-
statusCode?: number;
|
|
190
|
-
headers?: Record<string, string>;
|
|
191
|
-
}
|
|
192
|
-
declare const STREAM_HANDLE_PROP: "__spikard_stream_handle";
|
|
193
|
-
type StreamChunk = JsonValue | string | Buffer | Uint8Array | ArrayBuffer | ArrayBufferView | null | undefined;
|
|
194
|
-
type ChunkIterator = AsyncIterator<StreamChunk> & AsyncIterable<StreamChunk>;
|
|
195
|
-
type StreamingHandle = {
|
|
196
|
-
kind: "native";
|
|
197
|
-
handle: number;
|
|
198
|
-
init: StreamingResponseInit;
|
|
199
|
-
} | {
|
|
200
|
-
kind: "js";
|
|
201
|
-
iterator: ChunkIterator;
|
|
202
|
-
init: StreamingResponseInit;
|
|
203
|
-
};
|
|
204
|
-
declare class StreamingResponse {
|
|
205
|
-
readonly [STREAM_HANDLE_PROP]: StreamingHandle;
|
|
206
|
-
constructor(stream: AsyncIterable<StreamChunk> | AsyncIterator<StreamChunk>, init?: StreamingResponseInit);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
type JsonPrimitive = string | number | boolean | null;
|
|
210
|
-
type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
211
|
-
[Key in string]: JsonValue;
|
|
212
|
-
};
|
|
213
|
-
type JsonRecord = Record<string, JsonValue>;
|
|
214
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
215
|
-
interface Base64EncodedBody {
|
|
216
|
-
__spikard_base64__: string;
|
|
217
|
-
}
|
|
218
|
-
type HandlerBody = JsonValue | Base64EncodedBody | null;
|
|
219
|
-
interface StructuredHandlerResponse {
|
|
220
|
-
status?: number;
|
|
221
|
-
statusCode?: number;
|
|
222
|
-
headers?: Record<string, string>;
|
|
223
|
-
body?: HandlerBody;
|
|
224
|
-
}
|
|
225
|
-
type HandlerResult = StructuredHandlerResponse | JsonValue | StreamingResponse | undefined;
|
|
226
|
-
type HandlerFunction<TReturn extends HandlerResult = HandlerResult> = (request: Request) => MaybePromise<TReturn>;
|
|
227
|
-
type NativeHandlerFunction<TReturn extends HandlerResult = HandlerResult> = (requestJson: string) => MaybePromise<TReturn | string>;
|
|
228
|
-
type WebSocketHandler = (message: unknown) => MaybePromise<unknown>;
|
|
229
|
-
interface WebSocketOptions {
|
|
230
|
-
onConnect?: () => MaybePromise<void>;
|
|
231
|
-
onDisconnect?: () => MaybePromise<void>;
|
|
232
|
-
messageSchema?: unknown;
|
|
233
|
-
responseSchema?: unknown;
|
|
234
|
-
handlerName?: string;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
interface Request {
|
|
238
|
-
method: string;
|
|
239
|
-
path: string;
|
|
240
|
-
params: Record<string, string>;
|
|
241
|
-
pathParams: Record<string, string>;
|
|
242
|
-
query: Record<string, string>;
|
|
243
|
-
queryParams: Record<string, string>;
|
|
244
|
-
headers: Record<string, string>;
|
|
245
|
-
cookies: Record<string, string>;
|
|
246
|
-
body: Buffer | null;
|
|
247
|
-
dependencies: Record<string, unknown> | undefined;
|
|
248
|
-
json<T = JsonValue>(): T;
|
|
249
|
-
form(): Record<string, string>;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
type DependencyValue = unknown;
|
|
253
|
-
type DependencyFactory = (dependencies: Record<string, DependencyValue>) => MaybePromise<DependencyValue>;
|
|
254
|
-
interface DependencyOptions {
|
|
255
|
-
dependsOn?: string[];
|
|
256
|
-
singleton?: boolean;
|
|
257
|
-
cacheable?: boolean;
|
|
258
|
-
}
|
|
259
|
-
interface DependencyDescriptor {
|
|
260
|
-
isFactory: boolean;
|
|
261
|
-
value?: DependencyValue | undefined;
|
|
262
|
-
factory?: DependencyFactory | undefined;
|
|
263
|
-
dependsOn: string[];
|
|
264
|
-
singleton: boolean;
|
|
265
|
-
cacheable: boolean;
|
|
266
|
-
}
|
|
267
|
-
type LifecycleHookPayload = Request | StructuredHandlerResponse;
|
|
268
|
-
type LifecycleHookFunction = (payload: LifecycleHookPayload) => MaybePromise<LifecycleHookPayload>;
|
|
269
|
-
interface LifecycleHooks {
|
|
270
|
-
onRequest: LifecycleHookFunction[];
|
|
271
|
-
preValidation: LifecycleHookFunction[];
|
|
272
|
-
preHandler: LifecycleHookFunction[];
|
|
273
|
-
onResponse: LifecycleHookFunction[];
|
|
274
|
-
onError: LifecycleHookFunction[];
|
|
275
|
-
}
|
|
276
|
-
declare class Spikard implements SpikardApp {
|
|
277
|
-
routes: RouteMetadata[];
|
|
278
|
-
handlers: Record<string, HandlerFunction | NativeHandlerFunction>;
|
|
279
|
-
websocketRoutes: RouteMetadata[];
|
|
280
|
-
websocketHandlers: Record<string, Record<string, unknown>>;
|
|
281
|
-
grpcMethods: GrpcMethodRegistration[];
|
|
282
|
-
grpcHandlers: Record<string, Record<string, unknown>>;
|
|
283
|
-
lifecycleHooks: LifecycleHooks;
|
|
284
|
-
dependencies: Record<string, DependencyDescriptor>;
|
|
285
|
-
addRoute(metadata: RouteMetadata, handler: HandlerFunction | NativeHandlerFunction): void;
|
|
286
|
-
websocket(path: string, handler: WebSocketHandler, options?: WebSocketOptions): void;
|
|
287
|
-
addGrpcUnary(serviceName: string, methodName: string, handler: GrpcHandler): this;
|
|
288
|
-
addGrpcServerStreaming(serviceName: string, methodName: string, handler: GrpcServerStreamingHandler): this;
|
|
289
|
-
addGrpcClientStreaming(serviceName: string, methodName: string, handler: GrpcClientStreamingHandler): this;
|
|
290
|
-
addGrpcBidirectionalStreaming(serviceName: string, methodName: string, handler: GrpcBidirectionalStreamingHandler): this;
|
|
291
|
-
private registerGrpcMethod;
|
|
292
|
-
useGrpc(service: GrpcService): this;
|
|
293
|
-
run(config?: ServerConfig): void;
|
|
294
|
-
onRequest(hook: LifecycleHookFunction): LifecycleHookFunction;
|
|
295
|
-
preValidation(hook: LifecycleHookFunction): LifecycleHookFunction;
|
|
296
|
-
preHandler(hook: LifecycleHookFunction): LifecycleHookFunction;
|
|
297
|
-
onResponse(hook: LifecycleHookFunction): LifecycleHookFunction;
|
|
298
|
-
onError(hook: LifecycleHookFunction): LifecycleHookFunction;
|
|
299
|
-
provide(key: string, valueOrFactory: DependencyValue | DependencyFactory, options?: DependencyOptions): this;
|
|
300
|
-
getLifecycleHooks(): LifecycleHooks;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
declare function run(work: () => void | Promise<void>): void;
|
|
304
|
-
|
|
305
|
-
declare const background_run: typeof run;
|
|
306
|
-
declare namespace background {
|
|
307
|
-
export { background_run as run };
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
declare function wrapHandler(handler: HandlerFunction): NativeHandlerFunction;
|
|
311
|
-
declare function wrapBodyHandler<TBody = unknown>(handler: (body: TBody, request: Request) => MaybePromise<HandlerResult>): NativeHandlerFunction;
|
|
312
|
-
|
|
313
|
-
type Query<T> = T;
|
|
314
|
-
type Path<T> = T;
|
|
315
|
-
type Body<T> = T;
|
|
316
|
-
declare function QueryDefault<T>(value: T): T;
|
|
317
|
-
|
|
318
|
-
interface RouteOptions {
|
|
319
|
-
methods?: string | string[];
|
|
320
|
-
bodySchema?: JsonSchema;
|
|
321
|
-
responseSchema?: JsonSchema;
|
|
322
|
-
parameterSchema?: JsonSchema;
|
|
323
|
-
cors?: CorsConfig;
|
|
324
|
-
}
|
|
325
|
-
type RouteHandler = (request: Request) => MaybePromise<HandlerResult>;
|
|
326
|
-
declare function route(path: string, options?: RouteOptions): (handler: RouteHandler) => RouteHandler;
|
|
327
|
-
declare function get(path: string, options?: Omit<RouteOptions, "methods">): (handler: RouteHandler) => RouteHandler;
|
|
328
|
-
declare function post(path: string, options?: Omit<RouteOptions, "methods">): (handler: RouteHandler) => RouteHandler;
|
|
329
|
-
declare function put(path: string, options?: Omit<RouteOptions, "methods">): (handler: RouteHandler) => RouteHandler;
|
|
330
|
-
declare function del(path: string, options?: Omit<RouteOptions, "methods">): (handler: RouteHandler) => RouteHandler;
|
|
331
|
-
declare function patch(path: string, options?: Omit<RouteOptions, "methods">): (handler: RouteHandler) => RouteHandler;
|
|
332
|
-
|
|
333
|
-
declare function runServer(app: SpikardApp, config?: ServerConfig): void;
|
|
334
|
-
|
|
335
|
-
interface NativeTestResponse {
|
|
336
|
-
statusCode: number;
|
|
337
|
-
headers(): Record<string, string>;
|
|
338
|
-
text(): string;
|
|
339
|
-
json<T>(): T;
|
|
340
|
-
bytes(): Buffer;
|
|
341
|
-
graphqlData(): unknown;
|
|
342
|
-
graphqlErrors(): Array<Record<string, unknown>>;
|
|
343
|
-
}
|
|
344
|
-
interface WebSocketTestConnection {
|
|
345
|
-
sendText(text: string): Promise<void>;
|
|
346
|
-
sendJson(obj: unknown): Promise<void>;
|
|
347
|
-
receiveText(): Promise<string>;
|
|
348
|
-
receiveJson(): Promise<unknown>;
|
|
349
|
-
receiveBytes(): Promise<Buffer>;
|
|
350
|
-
receiveMessage(): Promise<unknown>;
|
|
351
|
-
close(): Promise<void>;
|
|
352
|
-
}
|
|
353
|
-
type TestResponse = NativeTestResponse;
|
|
354
|
-
interface GraphQLSubscriptionResult {
|
|
355
|
-
operationId: string;
|
|
356
|
-
acknowledged: boolean;
|
|
357
|
-
event: unknown | null;
|
|
358
|
-
errors: unknown[];
|
|
359
|
-
completeReceived: boolean;
|
|
360
|
-
}
|
|
361
|
-
interface MultipartFile {
|
|
362
|
-
name: string;
|
|
363
|
-
filename?: string;
|
|
364
|
-
content: string;
|
|
365
|
-
contentType?: string;
|
|
366
|
-
}
|
|
367
|
-
interface RequestOptions {
|
|
368
|
-
headers?: Record<string, string>;
|
|
369
|
-
json?: JsonValue;
|
|
370
|
-
form?: Record<string, JsonValue>;
|
|
371
|
-
multipart?: {
|
|
372
|
-
fields?: Record<string, JsonValue>;
|
|
373
|
-
files?: MultipartFile[];
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
declare class TestClient {
|
|
377
|
-
readonly app: SpikardApp;
|
|
378
|
-
private nativeClient;
|
|
379
|
-
private looksLikeStringHandler;
|
|
380
|
-
constructor(app: SpikardApp);
|
|
381
|
-
get(path: string, headers?: Record<string, string>): Promise<TestResponse>;
|
|
382
|
-
post(path: string, options?: RequestOptions): Promise<TestResponse>;
|
|
383
|
-
put(path: string, options?: RequestOptions): Promise<TestResponse>;
|
|
384
|
-
delete(path: string, headers?: Record<string, string>): Promise<TestResponse>;
|
|
385
|
-
patch(path: string, options?: RequestOptions): Promise<TestResponse>;
|
|
386
|
-
head(path: string, headers?: Record<string, string>): Promise<TestResponse>;
|
|
387
|
-
options(path: string, options?: RequestOptions): Promise<TestResponse>;
|
|
388
|
-
trace(path: string, options?: RequestOptions): Promise<TestResponse>;
|
|
389
|
-
private buildHeaders;
|
|
390
|
-
private buildBody;
|
|
391
|
-
websocketConnect(path: string): Promise<WebSocketTestConnection>;
|
|
392
|
-
graphql(query: string, variables?: Record<string, unknown> | null, operationName?: string | null): Promise<TestResponse>;
|
|
393
|
-
graphqlWithStatus(query: string, variables?: Record<string, unknown> | null, operationName?: string | null): Promise<{
|
|
394
|
-
status: number;
|
|
395
|
-
statusCode: number;
|
|
396
|
-
headers: string;
|
|
397
|
-
bodyText: string;
|
|
398
|
-
}>;
|
|
399
|
-
graphqlSubscription(query: string, variables?: Record<string, unknown> | null, operationName?: string | null, path?: string): Promise<GraphQLSubscriptionResult>;
|
|
400
|
-
cleanup(): Promise<void>;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
declare class UploadFile {
|
|
404
|
-
readonly filename: string;
|
|
405
|
-
readonly contentType: string;
|
|
406
|
-
readonly size: number;
|
|
407
|
-
readonly headers: Record<string, string>;
|
|
408
|
-
private readonly _content;
|
|
409
|
-
private _position;
|
|
410
|
-
constructor(filename: string, content: Buffer, contentType?: string | null, size?: number | null, headers?: Record<string, string> | null);
|
|
411
|
-
read(size?: number): Buffer;
|
|
412
|
-
readAsync(size?: number): Promise<Buffer>;
|
|
413
|
-
text(): string;
|
|
414
|
-
textAsync(): Promise<string>;
|
|
415
|
-
seek(offset: number, whence?: number): number;
|
|
416
|
-
seekAsync(offset: number, whence?: number): Promise<number>;
|
|
417
|
-
tell(): number;
|
|
418
|
-
getBuffer(): Buffer;
|
|
419
|
-
close(): void;
|
|
420
|
-
closeAsync(): Promise<void>;
|
|
421
|
-
toString(): string;
|
|
422
|
-
toJSON(): Record<string, unknown>;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
interface JsonSchema {
|
|
426
|
-
type?: string | string[];
|
|
427
|
-
properties?: Record<string, JsonSchema>;
|
|
428
|
-
required?: string[];
|
|
429
|
-
items?: JsonSchema | JsonSchema[];
|
|
430
|
-
enum?: JsonValue[];
|
|
431
|
-
[key: string]: JsonSchema | JsonSchema[] | JsonValue | JsonValue[] | string | number | boolean | undefined;
|
|
432
|
-
}
|
|
433
|
-
interface CorsConfig {
|
|
434
|
-
allow_origin?: string | string[];
|
|
435
|
-
allow_methods?: string[];
|
|
436
|
-
allow_headers?: string[];
|
|
437
|
-
allow_credentials?: boolean;
|
|
438
|
-
max_age?: number;
|
|
439
|
-
}
|
|
440
|
-
interface FileParam {
|
|
441
|
-
name: string;
|
|
442
|
-
required?: boolean;
|
|
443
|
-
max_size?: number;
|
|
444
|
-
allowed_types?: string[];
|
|
445
|
-
}
|
|
446
|
-
interface RouteMetadata {
|
|
447
|
-
method: string;
|
|
448
|
-
path: string;
|
|
449
|
-
handler_name: string;
|
|
450
|
-
request_schema?: JsonSchema | undefined;
|
|
451
|
-
response_schema?: JsonSchema | undefined;
|
|
452
|
-
parameter_schema?: JsonSchema | undefined;
|
|
453
|
-
file_params?: FileParam[] | undefined;
|
|
454
|
-
is_async: boolean;
|
|
455
|
-
cors?: CorsConfig | undefined;
|
|
456
|
-
}
|
|
457
|
-
interface GrpcMethodRegistration {
|
|
458
|
-
serviceName: string;
|
|
459
|
-
methodName: string;
|
|
460
|
-
rpcMode: GrpcRpcMode;
|
|
461
|
-
handlerName: string;
|
|
462
|
-
}
|
|
463
|
-
interface SpikardApp {
|
|
464
|
-
routes: RouteMetadata[];
|
|
465
|
-
handlers: Record<string, HandlerFunction | NativeHandlerFunction>;
|
|
466
|
-
websocketRoutes?: RouteMetadata[];
|
|
467
|
-
websocketHandlers?: Record<string, Record<string, unknown>>;
|
|
468
|
-
grpcMethods?: GrpcMethodRegistration[];
|
|
469
|
-
grpcHandlers?: Record<string, Record<string, unknown>>;
|
|
470
|
-
config?: ServerConfig;
|
|
471
|
-
lifecycleHooks?: Partial<LifecycleHooks>;
|
|
472
|
-
dependencies?: Record<string, unknown>;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
export { type ApiKeyConfig, type Base64EncodedBody, type Body, type CompressionConfig, type ContactInfo, type CorsConfig, type DependencyFactory, type DependencyOptions, type DependencyValue, type FileParam, type GrpcBidiStreamRequest, type GrpcBidiStreamResponse, type GrpcBidirectionalStreamingHandler, type GrpcClientStreamRequest, type GrpcClientStreamingHandler, GrpcError, type GrpcHandler, type GrpcMetadata, type GrpcMethodConfig, type GrpcMethodHandler, type GrpcMethodRegistration, type GrpcRequest, type GrpcResponse, type GrpcRpcMode, type GrpcServerStreamResponse, type GrpcServerStreamingHandler, GrpcService, GrpcStatusCode, type HandlerFunction, type HandlerResult, type JsonPrimitive, type JsonRecord, type JsonRpcConfig, type JsonSchema, type JsonValue, type JwtConfig, type LicenseInfo, type LifecycleHookFunction, type LifecycleHooks, type MaybePromise, type NativeHandlerFunction, type OpenApiConfig, type Path, type Query, QueryDefault, type RateLimitConfig, type Request, type RouteMetadata, type RouteOptions, type SecuritySchemeInfo, type ServerConfig, type ServerInfo, Spikard, type SpikardApp, type StaticFilesConfig, StreamingResponse, type StreamingResponseInit, type StructuredHandlerResponse, TestClient, type TestResponse, UploadFile, type WebSocketHandler, type WebSocketOptions, background, createServiceHandler, createUnaryHandler, del, get, patch, post, put, route, runServer, wrapBodyHandler, wrapHandler };
|