arri 0.41.0 → 0.42.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/dist/index.d.cts +25 -24
- package/dist/index.d.mts +25 -24
- package/dist/index.d.ts +25 -24
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -28,9 +28,26 @@ declare function errorResponseFromValidationErrors(errors: ValidationError["erro
|
|
|
28
28
|
type StatusCode = number | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
|
|
29
29
|
declare function handleH3Error(err: unknown, event: H3Event, onError: ArriOptions["onError"], debug: boolean): Promise<void>;
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
type ArriEventContext = Record<string, any>;
|
|
32
|
+
interface RpcEventContext<TParams = undefined> extends ArriEventContext, Omit<H3EventContext, "params"> {
|
|
33
|
+
rpcName: string;
|
|
34
|
+
params: TParams;
|
|
35
|
+
}
|
|
36
|
+
interface RpcPostEventContext<TParams = undefined, TResponse = undefined> extends RpcEventContext<TParams> {
|
|
37
|
+
response: TResponse;
|
|
38
|
+
}
|
|
39
|
+
interface RouteEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any> extends ArriEventContext, H3EventContext {
|
|
40
|
+
params: ExtractParams<TPath>;
|
|
41
|
+
query: TQuery;
|
|
42
|
+
body: TBody;
|
|
43
|
+
}
|
|
44
|
+
interface RoutePostEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any, TResponse = any> extends RouteEventContext<TPath, TQuery, TBody> {
|
|
45
|
+
response: TResponse;
|
|
46
|
+
}
|
|
47
|
+
interface MiddlewareEventContext extends ArriEventContext, H3EventContext {
|
|
32
48
|
rpcName?: string;
|
|
33
49
|
}
|
|
50
|
+
|
|
34
51
|
interface MiddlewareEvent extends H3Event {
|
|
35
52
|
context: MiddlewareEventContext;
|
|
36
53
|
}
|
|
@@ -39,19 +56,11 @@ declare const defineMiddleware: (middleware: Middleware) => Middleware;
|
|
|
39
56
|
type ExtractParam<Path, NextPart> = Path extends `:${infer Param}` ? Record<Param, string> & NextPart : NextPart;
|
|
40
57
|
type ExtractParams<Path> = Path extends `${infer Segment}/${infer Rest}` ? ExtractParam<Segment, ExtractParams<Rest>> : ExtractParam<Path, {}>;
|
|
41
58
|
|
|
42
|
-
interface RouteEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any> extends H3EventContext {
|
|
43
|
-
params: ExtractParams<TPath>;
|
|
44
|
-
query: TQuery;
|
|
45
|
-
body: TBody;
|
|
46
|
-
}
|
|
47
59
|
interface RouteEvent<TPath extends string, TQuery extends Record<any, any> = any, TBody = any> extends H3Event {
|
|
48
60
|
context: RouteEventContext<TPath, TQuery, TBody>;
|
|
49
61
|
}
|
|
50
|
-
interface PostRouteEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any, TResponse = any> extends RouteEventContext<TPath, TQuery, TBody> {
|
|
51
|
-
response: TResponse;
|
|
52
|
-
}
|
|
53
62
|
interface PostRouteEvent<TPath extends string, TQuery extends Record<any, any> = any, TBody = any, TResponse = any> extends H3Event {
|
|
54
|
-
context:
|
|
63
|
+
context: RoutePostEventContext<TPath, TQuery, TBody, TResponse>;
|
|
55
64
|
}
|
|
56
65
|
interface ArriRoute<TPath extends string, TQuery extends AObjectSchema<any, any> = any, TBody extends ASchema<any> = any, TResponse = any> {
|
|
57
66
|
path: TPath;
|
|
@@ -75,7 +84,7 @@ interface EventStreamRpc<TParams extends RpcParamSchema | undefined = undefined,
|
|
|
75
84
|
handler: EventStreamRpcHandler<TParams extends RpcParamSchema ? InferType<TParams> : undefined, TResponse extends RpcParamSchema ? InferType<TResponse> : undefined>;
|
|
76
85
|
}
|
|
77
86
|
type EventStreamRpcHandler<TParams, TResponse> = (context: EventStreamRpcHandlerContext<TParams, TResponse>, event: RpcEvent<TResponse>) => void | Promise<void>;
|
|
78
|
-
interface EventStreamRpcHandlerContext<TParams = any, TResponse = any> extends
|
|
87
|
+
interface EventStreamRpcHandlerContext<TParams = any, TResponse = any> extends RpcEventContext<TParams> {
|
|
79
88
|
stream: EventStreamConnection<TResponse>;
|
|
80
89
|
}
|
|
81
90
|
interface EventStreamConnectionOptions<TData> {
|
|
@@ -185,22 +194,14 @@ interface Rpc<TIsEventStream extends boolean = false, TParams extends RpcParamSc
|
|
|
185
194
|
postHandler?: TIsEventStream extends true ? undefined : RpcPostHandler<TParams extends RpcParamSchema ? InferType<TParams> : undefined, TResponse extends RpcParamSchema ? InferType<TResponse> : undefined>;
|
|
186
195
|
}
|
|
187
196
|
type HttpRpc<TParams extends RpcParamSchema | undefined, TResponse extends RpcParamSchema | undefined> = Omit<Rpc<false, TParams, TResponse>, "isEventStream">;
|
|
188
|
-
type HandlerContext = Record<string, any>;
|
|
189
|
-
interface RpcHandlerContext<TParams = undefined> extends HandlerContext, Omit<H3EventContext, "params"> {
|
|
190
|
-
rpcName: string;
|
|
191
|
-
params: TParams;
|
|
192
|
-
}
|
|
193
|
-
interface RpcPostHandlerContext<TParams = undefined, TResponse = undefined> extends RpcHandlerContext<TParams> {
|
|
194
|
-
response: TResponse;
|
|
195
|
-
}
|
|
196
197
|
interface RpcEvent<TParams = undefined> extends Omit<H3Event, "context"> {
|
|
197
|
-
context:
|
|
198
|
+
context: RpcEventContext<TParams>;
|
|
198
199
|
}
|
|
199
200
|
interface RpcPostEvent<TParams = undefined, TResponse = undefined> extends Omit<H3Event, "context"> {
|
|
200
|
-
context:
|
|
201
|
+
context: RpcPostEventContext<TParams, TResponse>;
|
|
201
202
|
}
|
|
202
|
-
type RpcHandler<TParams, TResponse> = (context:
|
|
203
|
-
type RpcPostHandler<TParams, TResponse> = (context:
|
|
203
|
+
type RpcHandler<TParams, TResponse> = (context: RpcEventContext<TParams>, event: RpcEvent<TParams>) => TResponse | Promise<TResponse>;
|
|
204
|
+
type RpcPostHandler<TParams, TResponse> = (context: RpcPostEventContext<TParams, TResponse>, event: RpcPostEvent<TParams, TResponse>) => any;
|
|
204
205
|
declare function isRpc(input: unknown): input is Rpc<any, any>;
|
|
205
206
|
declare function defineRpc<TParams extends RpcParamSchema | undefined = undefined, TResponse extends RpcParamSchema | undefined | never = undefined>(config: Omit<HttpRpc<TParams, TResponse>, "transport">): Rpc<false, TParams, TResponse>;
|
|
206
207
|
declare function createHttpRpcDefinition(rpcName: string, httpPath: string, procedure: Rpc<any, any, any>): HttpRpcDefinition;
|
|
@@ -309,4 +310,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
|
|
|
309
310
|
declare const defaultConfig: Required<ArriConfig>;
|
|
310
311
|
declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
|
|
311
312
|
|
|
312
|
-
export { ArriApp, type ArriConfig, type ArriOptions, type ArriRoute, ArriRouter, type ArriRouterBase, ArriServerError, ArriServerErrorResponse, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, EventStreamConnection, type EventStreamConnectionOptions, type EventStreamRpc, type EventStreamRpcHandler, type EventStreamRpcHandlerContext, type ExtractParam, type ExtractParams, type
|
|
313
|
+
export { ArriApp, type ArriConfig, type ArriEventContext, type ArriOptions, type ArriRoute, ArriRouter, type ArriRouterBase, ArriServerError, ArriServerErrorResponse, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, EventStreamConnection, type EventStreamConnectionOptions, type EventStreamRpc, type EventStreamRpcHandler, type EventStreamRpcHandlerContext, type ExtractParam, type ExtractParams, type HttpRpc, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ModelMap, type NamedRpc, type NamedWebsocketRpc, type PostRouteEvent, type ResolvedArriConfig, type RouteEvent, type RouteEventContext, type RouteOptions, type RoutePostEventContext, type Rpc, type RpcEvent, type RpcEventContext, type RpcHandler, type RpcParamSchema, type RpcPostEvent, type RpcPostEventContext, type RpcPostHandler, type StatusCode, type WebSocketRpcHandler, type WebsocketRpc, WsPeer, type WsPeerContext, createAppDefinition, createHttpRpcDefinition, createWsRpcDefinition, defaultConfig, defineConfig, defineError, defineEventStreamRpc, defineMiddleware, defineRoute, defineRpc, defineWebsocketRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, handleRoute, isArriConfig, isEventStreamRpc, isResolvedArriConfig, isRpc, isRpcParamSchema, registerEventStreamRpc, registerRoute, registerRpc, registerWebsocketRpc, validateRpcRequestInput };
|
package/dist/index.d.mts
CHANGED
|
@@ -28,9 +28,26 @@ declare function errorResponseFromValidationErrors(errors: ValidationError["erro
|
|
|
28
28
|
type StatusCode = number | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
|
|
29
29
|
declare function handleH3Error(err: unknown, event: H3Event, onError: ArriOptions["onError"], debug: boolean): Promise<void>;
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
type ArriEventContext = Record<string, any>;
|
|
32
|
+
interface RpcEventContext<TParams = undefined> extends ArriEventContext, Omit<H3EventContext, "params"> {
|
|
33
|
+
rpcName: string;
|
|
34
|
+
params: TParams;
|
|
35
|
+
}
|
|
36
|
+
interface RpcPostEventContext<TParams = undefined, TResponse = undefined> extends RpcEventContext<TParams> {
|
|
37
|
+
response: TResponse;
|
|
38
|
+
}
|
|
39
|
+
interface RouteEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any> extends ArriEventContext, H3EventContext {
|
|
40
|
+
params: ExtractParams<TPath>;
|
|
41
|
+
query: TQuery;
|
|
42
|
+
body: TBody;
|
|
43
|
+
}
|
|
44
|
+
interface RoutePostEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any, TResponse = any> extends RouteEventContext<TPath, TQuery, TBody> {
|
|
45
|
+
response: TResponse;
|
|
46
|
+
}
|
|
47
|
+
interface MiddlewareEventContext extends ArriEventContext, H3EventContext {
|
|
32
48
|
rpcName?: string;
|
|
33
49
|
}
|
|
50
|
+
|
|
34
51
|
interface MiddlewareEvent extends H3Event {
|
|
35
52
|
context: MiddlewareEventContext;
|
|
36
53
|
}
|
|
@@ -39,19 +56,11 @@ declare const defineMiddleware: (middleware: Middleware) => Middleware;
|
|
|
39
56
|
type ExtractParam<Path, NextPart> = Path extends `:${infer Param}` ? Record<Param, string> & NextPart : NextPart;
|
|
40
57
|
type ExtractParams<Path> = Path extends `${infer Segment}/${infer Rest}` ? ExtractParam<Segment, ExtractParams<Rest>> : ExtractParam<Path, {}>;
|
|
41
58
|
|
|
42
|
-
interface RouteEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any> extends H3EventContext {
|
|
43
|
-
params: ExtractParams<TPath>;
|
|
44
|
-
query: TQuery;
|
|
45
|
-
body: TBody;
|
|
46
|
-
}
|
|
47
59
|
interface RouteEvent<TPath extends string, TQuery extends Record<any, any> = any, TBody = any> extends H3Event {
|
|
48
60
|
context: RouteEventContext<TPath, TQuery, TBody>;
|
|
49
61
|
}
|
|
50
|
-
interface PostRouteEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any, TResponse = any> extends RouteEventContext<TPath, TQuery, TBody> {
|
|
51
|
-
response: TResponse;
|
|
52
|
-
}
|
|
53
62
|
interface PostRouteEvent<TPath extends string, TQuery extends Record<any, any> = any, TBody = any, TResponse = any> extends H3Event {
|
|
54
|
-
context:
|
|
63
|
+
context: RoutePostEventContext<TPath, TQuery, TBody, TResponse>;
|
|
55
64
|
}
|
|
56
65
|
interface ArriRoute<TPath extends string, TQuery extends AObjectSchema<any, any> = any, TBody extends ASchema<any> = any, TResponse = any> {
|
|
57
66
|
path: TPath;
|
|
@@ -75,7 +84,7 @@ interface EventStreamRpc<TParams extends RpcParamSchema | undefined = undefined,
|
|
|
75
84
|
handler: EventStreamRpcHandler<TParams extends RpcParamSchema ? InferType<TParams> : undefined, TResponse extends RpcParamSchema ? InferType<TResponse> : undefined>;
|
|
76
85
|
}
|
|
77
86
|
type EventStreamRpcHandler<TParams, TResponse> = (context: EventStreamRpcHandlerContext<TParams, TResponse>, event: RpcEvent<TResponse>) => void | Promise<void>;
|
|
78
|
-
interface EventStreamRpcHandlerContext<TParams = any, TResponse = any> extends
|
|
87
|
+
interface EventStreamRpcHandlerContext<TParams = any, TResponse = any> extends RpcEventContext<TParams> {
|
|
79
88
|
stream: EventStreamConnection<TResponse>;
|
|
80
89
|
}
|
|
81
90
|
interface EventStreamConnectionOptions<TData> {
|
|
@@ -185,22 +194,14 @@ interface Rpc<TIsEventStream extends boolean = false, TParams extends RpcParamSc
|
|
|
185
194
|
postHandler?: TIsEventStream extends true ? undefined : RpcPostHandler<TParams extends RpcParamSchema ? InferType<TParams> : undefined, TResponse extends RpcParamSchema ? InferType<TResponse> : undefined>;
|
|
186
195
|
}
|
|
187
196
|
type HttpRpc<TParams extends RpcParamSchema | undefined, TResponse extends RpcParamSchema | undefined> = Omit<Rpc<false, TParams, TResponse>, "isEventStream">;
|
|
188
|
-
type HandlerContext = Record<string, any>;
|
|
189
|
-
interface RpcHandlerContext<TParams = undefined> extends HandlerContext, Omit<H3EventContext, "params"> {
|
|
190
|
-
rpcName: string;
|
|
191
|
-
params: TParams;
|
|
192
|
-
}
|
|
193
|
-
interface RpcPostHandlerContext<TParams = undefined, TResponse = undefined> extends RpcHandlerContext<TParams> {
|
|
194
|
-
response: TResponse;
|
|
195
|
-
}
|
|
196
197
|
interface RpcEvent<TParams = undefined> extends Omit<H3Event, "context"> {
|
|
197
|
-
context:
|
|
198
|
+
context: RpcEventContext<TParams>;
|
|
198
199
|
}
|
|
199
200
|
interface RpcPostEvent<TParams = undefined, TResponse = undefined> extends Omit<H3Event, "context"> {
|
|
200
|
-
context:
|
|
201
|
+
context: RpcPostEventContext<TParams, TResponse>;
|
|
201
202
|
}
|
|
202
|
-
type RpcHandler<TParams, TResponse> = (context:
|
|
203
|
-
type RpcPostHandler<TParams, TResponse> = (context:
|
|
203
|
+
type RpcHandler<TParams, TResponse> = (context: RpcEventContext<TParams>, event: RpcEvent<TParams>) => TResponse | Promise<TResponse>;
|
|
204
|
+
type RpcPostHandler<TParams, TResponse> = (context: RpcPostEventContext<TParams, TResponse>, event: RpcPostEvent<TParams, TResponse>) => any;
|
|
204
205
|
declare function isRpc(input: unknown): input is Rpc<any, any>;
|
|
205
206
|
declare function defineRpc<TParams extends RpcParamSchema | undefined = undefined, TResponse extends RpcParamSchema | undefined | never = undefined>(config: Omit<HttpRpc<TParams, TResponse>, "transport">): Rpc<false, TParams, TResponse>;
|
|
206
207
|
declare function createHttpRpcDefinition(rpcName: string, httpPath: string, procedure: Rpc<any, any, any>): HttpRpcDefinition;
|
|
@@ -309,4 +310,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
|
|
|
309
310
|
declare const defaultConfig: Required<ArriConfig>;
|
|
310
311
|
declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
|
|
311
312
|
|
|
312
|
-
export { ArriApp, type ArriConfig, type ArriOptions, type ArriRoute, ArriRouter, type ArriRouterBase, ArriServerError, ArriServerErrorResponse, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, EventStreamConnection, type EventStreamConnectionOptions, type EventStreamRpc, type EventStreamRpcHandler, type EventStreamRpcHandlerContext, type ExtractParam, type ExtractParams, type
|
|
313
|
+
export { ArriApp, type ArriConfig, type ArriEventContext, type ArriOptions, type ArriRoute, ArriRouter, type ArriRouterBase, ArriServerError, ArriServerErrorResponse, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, EventStreamConnection, type EventStreamConnectionOptions, type EventStreamRpc, type EventStreamRpcHandler, type EventStreamRpcHandlerContext, type ExtractParam, type ExtractParams, type HttpRpc, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ModelMap, type NamedRpc, type NamedWebsocketRpc, type PostRouteEvent, type ResolvedArriConfig, type RouteEvent, type RouteEventContext, type RouteOptions, type RoutePostEventContext, type Rpc, type RpcEvent, type RpcEventContext, type RpcHandler, type RpcParamSchema, type RpcPostEvent, type RpcPostEventContext, type RpcPostHandler, type StatusCode, type WebSocketRpcHandler, type WebsocketRpc, WsPeer, type WsPeerContext, createAppDefinition, createHttpRpcDefinition, createWsRpcDefinition, defaultConfig, defineConfig, defineError, defineEventStreamRpc, defineMiddleware, defineRoute, defineRpc, defineWebsocketRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, handleRoute, isArriConfig, isEventStreamRpc, isResolvedArriConfig, isRpc, isRpcParamSchema, registerEventStreamRpc, registerRoute, registerRpc, registerWebsocketRpc, validateRpcRequestInput };
|
package/dist/index.d.ts
CHANGED
|
@@ -28,9 +28,26 @@ declare function errorResponseFromValidationErrors(errors: ValidationError["erro
|
|
|
28
28
|
type StatusCode = number | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
|
|
29
29
|
declare function handleH3Error(err: unknown, event: H3Event, onError: ArriOptions["onError"], debug: boolean): Promise<void>;
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
type ArriEventContext = Record<string, any>;
|
|
32
|
+
interface RpcEventContext<TParams = undefined> extends ArriEventContext, Omit<H3EventContext, "params"> {
|
|
33
|
+
rpcName: string;
|
|
34
|
+
params: TParams;
|
|
35
|
+
}
|
|
36
|
+
interface RpcPostEventContext<TParams = undefined, TResponse = undefined> extends RpcEventContext<TParams> {
|
|
37
|
+
response: TResponse;
|
|
38
|
+
}
|
|
39
|
+
interface RouteEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any> extends ArriEventContext, H3EventContext {
|
|
40
|
+
params: ExtractParams<TPath>;
|
|
41
|
+
query: TQuery;
|
|
42
|
+
body: TBody;
|
|
43
|
+
}
|
|
44
|
+
interface RoutePostEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any, TResponse = any> extends RouteEventContext<TPath, TQuery, TBody> {
|
|
45
|
+
response: TResponse;
|
|
46
|
+
}
|
|
47
|
+
interface MiddlewareEventContext extends ArriEventContext, H3EventContext {
|
|
32
48
|
rpcName?: string;
|
|
33
49
|
}
|
|
50
|
+
|
|
34
51
|
interface MiddlewareEvent extends H3Event {
|
|
35
52
|
context: MiddlewareEventContext;
|
|
36
53
|
}
|
|
@@ -39,19 +56,11 @@ declare const defineMiddleware: (middleware: Middleware) => Middleware;
|
|
|
39
56
|
type ExtractParam<Path, NextPart> = Path extends `:${infer Param}` ? Record<Param, string> & NextPart : NextPart;
|
|
40
57
|
type ExtractParams<Path> = Path extends `${infer Segment}/${infer Rest}` ? ExtractParam<Segment, ExtractParams<Rest>> : ExtractParam<Path, {}>;
|
|
41
58
|
|
|
42
|
-
interface RouteEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any> extends H3EventContext {
|
|
43
|
-
params: ExtractParams<TPath>;
|
|
44
|
-
query: TQuery;
|
|
45
|
-
body: TBody;
|
|
46
|
-
}
|
|
47
59
|
interface RouteEvent<TPath extends string, TQuery extends Record<any, any> = any, TBody = any> extends H3Event {
|
|
48
60
|
context: RouteEventContext<TPath, TQuery, TBody>;
|
|
49
61
|
}
|
|
50
|
-
interface PostRouteEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any, TResponse = any> extends RouteEventContext<TPath, TQuery, TBody> {
|
|
51
|
-
response: TResponse;
|
|
52
|
-
}
|
|
53
62
|
interface PostRouteEvent<TPath extends string, TQuery extends Record<any, any> = any, TBody = any, TResponse = any> extends H3Event {
|
|
54
|
-
context:
|
|
63
|
+
context: RoutePostEventContext<TPath, TQuery, TBody, TResponse>;
|
|
55
64
|
}
|
|
56
65
|
interface ArriRoute<TPath extends string, TQuery extends AObjectSchema<any, any> = any, TBody extends ASchema<any> = any, TResponse = any> {
|
|
57
66
|
path: TPath;
|
|
@@ -75,7 +84,7 @@ interface EventStreamRpc<TParams extends RpcParamSchema | undefined = undefined,
|
|
|
75
84
|
handler: EventStreamRpcHandler<TParams extends RpcParamSchema ? InferType<TParams> : undefined, TResponse extends RpcParamSchema ? InferType<TResponse> : undefined>;
|
|
76
85
|
}
|
|
77
86
|
type EventStreamRpcHandler<TParams, TResponse> = (context: EventStreamRpcHandlerContext<TParams, TResponse>, event: RpcEvent<TResponse>) => void | Promise<void>;
|
|
78
|
-
interface EventStreamRpcHandlerContext<TParams = any, TResponse = any> extends
|
|
87
|
+
interface EventStreamRpcHandlerContext<TParams = any, TResponse = any> extends RpcEventContext<TParams> {
|
|
79
88
|
stream: EventStreamConnection<TResponse>;
|
|
80
89
|
}
|
|
81
90
|
interface EventStreamConnectionOptions<TData> {
|
|
@@ -185,22 +194,14 @@ interface Rpc<TIsEventStream extends boolean = false, TParams extends RpcParamSc
|
|
|
185
194
|
postHandler?: TIsEventStream extends true ? undefined : RpcPostHandler<TParams extends RpcParamSchema ? InferType<TParams> : undefined, TResponse extends RpcParamSchema ? InferType<TResponse> : undefined>;
|
|
186
195
|
}
|
|
187
196
|
type HttpRpc<TParams extends RpcParamSchema | undefined, TResponse extends RpcParamSchema | undefined> = Omit<Rpc<false, TParams, TResponse>, "isEventStream">;
|
|
188
|
-
type HandlerContext = Record<string, any>;
|
|
189
|
-
interface RpcHandlerContext<TParams = undefined> extends HandlerContext, Omit<H3EventContext, "params"> {
|
|
190
|
-
rpcName: string;
|
|
191
|
-
params: TParams;
|
|
192
|
-
}
|
|
193
|
-
interface RpcPostHandlerContext<TParams = undefined, TResponse = undefined> extends RpcHandlerContext<TParams> {
|
|
194
|
-
response: TResponse;
|
|
195
|
-
}
|
|
196
197
|
interface RpcEvent<TParams = undefined> extends Omit<H3Event, "context"> {
|
|
197
|
-
context:
|
|
198
|
+
context: RpcEventContext<TParams>;
|
|
198
199
|
}
|
|
199
200
|
interface RpcPostEvent<TParams = undefined, TResponse = undefined> extends Omit<H3Event, "context"> {
|
|
200
|
-
context:
|
|
201
|
+
context: RpcPostEventContext<TParams, TResponse>;
|
|
201
202
|
}
|
|
202
|
-
type RpcHandler<TParams, TResponse> = (context:
|
|
203
|
-
type RpcPostHandler<TParams, TResponse> = (context:
|
|
203
|
+
type RpcHandler<TParams, TResponse> = (context: RpcEventContext<TParams>, event: RpcEvent<TParams>) => TResponse | Promise<TResponse>;
|
|
204
|
+
type RpcPostHandler<TParams, TResponse> = (context: RpcPostEventContext<TParams, TResponse>, event: RpcPostEvent<TParams, TResponse>) => any;
|
|
204
205
|
declare function isRpc(input: unknown): input is Rpc<any, any>;
|
|
205
206
|
declare function defineRpc<TParams extends RpcParamSchema | undefined = undefined, TResponse extends RpcParamSchema | undefined | never = undefined>(config: Omit<HttpRpc<TParams, TResponse>, "transport">): Rpc<false, TParams, TResponse>;
|
|
206
207
|
declare function createHttpRpcDefinition(rpcName: string, httpPath: string, procedure: Rpc<any, any, any>): HttpRpcDefinition;
|
|
@@ -309,4 +310,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
|
|
|
309
310
|
declare const defaultConfig: Required<ArriConfig>;
|
|
310
311
|
declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
|
|
311
312
|
|
|
312
|
-
export { ArriApp, type ArriConfig, type ArriOptions, type ArriRoute, ArriRouter, type ArriRouterBase, ArriServerError, ArriServerErrorResponse, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, EventStreamConnection, type EventStreamConnectionOptions, type EventStreamRpc, type EventStreamRpcHandler, type EventStreamRpcHandlerContext, type ExtractParam, type ExtractParams, type
|
|
313
|
+
export { ArriApp, type ArriConfig, type ArriEventContext, type ArriOptions, type ArriRoute, ArriRouter, type ArriRouterBase, ArriServerError, ArriServerErrorResponse, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, EventStreamConnection, type EventStreamConnectionOptions, type EventStreamRpc, type EventStreamRpcHandler, type EventStreamRpcHandlerContext, type ExtractParam, type ExtractParams, type HttpRpc, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ModelMap, type NamedRpc, type NamedWebsocketRpc, type PostRouteEvent, type ResolvedArriConfig, type RouteEvent, type RouteEventContext, type RouteOptions, type RoutePostEventContext, type Rpc, type RpcEvent, type RpcEventContext, type RpcHandler, type RpcParamSchema, type RpcPostEvent, type RpcPostEventContext, type RpcPostHandler, type StatusCode, type WebSocketRpcHandler, type WebsocketRpc, WsPeer, type WsPeerContext, createAppDefinition, createHttpRpcDefinition, createWsRpcDefinition, defaultConfig, defineConfig, defineError, defineEventStreamRpc, defineMiddleware, defineRoute, defineRpc, defineWebsocketRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, handleRoute, isArriConfig, isEventStreamRpc, isResolvedArriConfig, isRpc, isRpcParamSchema, registerEventStreamRpc, registerRoute, registerRpc, registerWebsocketRpc, validateRpcRequestInput };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arri",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"scule": "^1.3.0",
|
|
48
48
|
"source-map-support": "^0.5.21",
|
|
49
49
|
"uncrypto": "^0.1.3",
|
|
50
|
-
"arri-codegen-ts": "0.
|
|
51
|
-
"arri-codegen-
|
|
52
|
-
"arri-codegen-
|
|
53
|
-
"arri-validate": "0.
|
|
50
|
+
"arri-codegen-ts": "0.42.0",
|
|
51
|
+
"arri-codegen-utils": "0.42.0",
|
|
52
|
+
"arri-codegen-dart": "0.42.0",
|
|
53
|
+
"arri-validate": "0.42.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/degit": "^2.8.6",
|