@arrirpc/server 0.80.1 → 0.80.3
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.cjs +5 -3
- package/dist/index.d.cts +3 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +5 -3
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -523,7 +523,6 @@ class EventStreamConnection {
|
|
|
523
523
|
});
|
|
524
524
|
if (this.sendHeartbeat) {
|
|
525
525
|
this.heartbeatInterval = setInterval(async () => {
|
|
526
|
-
console.log("SENDING_HEARTBEAT");
|
|
527
526
|
await this.eventStream.push({
|
|
528
527
|
event: "heartbeat",
|
|
529
528
|
data: ""
|
|
@@ -617,7 +616,7 @@ function registerEventStreamRpc(router, path, procedure, opts) {
|
|
|
617
616
|
);
|
|
618
617
|
}
|
|
619
618
|
const stream = new EventStreamConnection(event, {
|
|
620
|
-
heartbeatMs: procedure.heartbeatMs,
|
|
619
|
+
heartbeatMs: procedure.heartbeatMs ?? opts.heartbeatMs,
|
|
621
620
|
heartbeatEnabled: procedure.heartbeatEnabled,
|
|
622
621
|
validator: responseValidator
|
|
623
622
|
});
|
|
@@ -837,6 +836,7 @@ class ArriApp {
|
|
|
837
836
|
_onError;
|
|
838
837
|
_debug;
|
|
839
838
|
definitionPath;
|
|
839
|
+
_heartbeatMs;
|
|
840
840
|
constructor(opts = {}) {
|
|
841
841
|
this.appInfo = opts?.appInfo;
|
|
842
842
|
this.h3App = h3.createApp({
|
|
@@ -847,6 +847,7 @@ class ArriApp {
|
|
|
847
847
|
this._onError = opts.onError;
|
|
848
848
|
this._onAfterResponse = opts.onAfterResponse;
|
|
849
849
|
this._onBeforeResponse = opts.onBeforeResponse;
|
|
850
|
+
this._heartbeatMs = opts.heartbeatMs ?? 2e4;
|
|
850
851
|
this._rpcRoutePrefix = opts?.rpcRoutePrefix ?? "";
|
|
851
852
|
this._rpcDefinitionPath = opts?.rpcDefinitionPath ?? "__definition";
|
|
852
853
|
this.h3App.use(this.h3Router);
|
|
@@ -951,7 +952,8 @@ class ArriApp {
|
|
|
951
952
|
onError: this._onError,
|
|
952
953
|
onAfterResponse: this._onAfterResponse,
|
|
953
954
|
onBeforeResponse: this._onBeforeResponse,
|
|
954
|
-
debug: this._debug
|
|
955
|
+
debug: this._debug,
|
|
956
|
+
heartbeatMs: this._heartbeatMs
|
|
955
957
|
});
|
|
956
958
|
return;
|
|
957
959
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -73,7 +73,7 @@ interface ArriRoute<TPath extends string, TQuery extends AObjectSchema<any, any>
|
|
|
73
73
|
postHandler?: (event: PostRouteEvent<TPath, InferType<TQuery>, InferType<TBody>, Awaited<TResponse>>) => any;
|
|
74
74
|
}
|
|
75
75
|
declare function defineRoute<TPath extends string, TQuery extends AObjectSchema<any, any> = any, TBody extends AObjectSchema<any, any> = any, TResponse = any>(route: ArriRoute<TPath, TQuery, TBody, TResponse>): ArriRoute<TPath, TQuery, TBody, TResponse>;
|
|
76
|
-
type RouteOptions = Pick<ArriOptions, 'onAfterResponse' | 'onBeforeResponse' | 'onError' | 'onRequest' | 'debug'> & {
|
|
76
|
+
type RouteOptions = Pick<ArriOptions, 'onAfterResponse' | 'onBeforeResponse' | 'onError' | 'onRequest' | 'debug' | 'heartbeatMs'> & {
|
|
77
77
|
middleware: Middleware[];
|
|
78
78
|
};
|
|
79
79
|
declare function registerRoute(router: Router, route: ArriRoute<any>, opts: RouteOptions): void;
|
|
@@ -216,6 +216,7 @@ declare class ArriApp {
|
|
|
216
216
|
private readonly _onError;
|
|
217
217
|
private readonly _debug;
|
|
218
218
|
readonly definitionPath: string;
|
|
219
|
+
private readonly _heartbeatMs;
|
|
219
220
|
constructor(opts?: ArriOptions);
|
|
220
221
|
use(input: Middleware): void;
|
|
221
222
|
use(input: ArriRouter): void;
|
|
@@ -239,6 +240,7 @@ interface ArriOptions {
|
|
|
239
240
|
rpcDefinitionPath?: string;
|
|
240
241
|
disableDefaultRoute?: boolean;
|
|
241
242
|
disableDefinitionRoute?: boolean;
|
|
243
|
+
heartbeatMs?: number;
|
|
242
244
|
onRequest?: (event: MiddlewareEvent) => void | Promise<void>;
|
|
243
245
|
onAfterResponse?: (event: RequestHookEvent) => void | Promise<void>;
|
|
244
246
|
onBeforeResponse?: (event: RequestHookEvent) => void | Promise<void>;
|
package/dist/index.d.mts
CHANGED
|
@@ -73,7 +73,7 @@ interface ArriRoute<TPath extends string, TQuery extends AObjectSchema<any, any>
|
|
|
73
73
|
postHandler?: (event: PostRouteEvent<TPath, InferType<TQuery>, InferType<TBody>, Awaited<TResponse>>) => any;
|
|
74
74
|
}
|
|
75
75
|
declare function defineRoute<TPath extends string, TQuery extends AObjectSchema<any, any> = any, TBody extends AObjectSchema<any, any> = any, TResponse = any>(route: ArriRoute<TPath, TQuery, TBody, TResponse>): ArriRoute<TPath, TQuery, TBody, TResponse>;
|
|
76
|
-
type RouteOptions = Pick<ArriOptions, 'onAfterResponse' | 'onBeforeResponse' | 'onError' | 'onRequest' | 'debug'> & {
|
|
76
|
+
type RouteOptions = Pick<ArriOptions, 'onAfterResponse' | 'onBeforeResponse' | 'onError' | 'onRequest' | 'debug' | 'heartbeatMs'> & {
|
|
77
77
|
middleware: Middleware[];
|
|
78
78
|
};
|
|
79
79
|
declare function registerRoute(router: Router, route: ArriRoute<any>, opts: RouteOptions): void;
|
|
@@ -216,6 +216,7 @@ declare class ArriApp {
|
|
|
216
216
|
private readonly _onError;
|
|
217
217
|
private readonly _debug;
|
|
218
218
|
readonly definitionPath: string;
|
|
219
|
+
private readonly _heartbeatMs;
|
|
219
220
|
constructor(opts?: ArriOptions);
|
|
220
221
|
use(input: Middleware): void;
|
|
221
222
|
use(input: ArriRouter): void;
|
|
@@ -239,6 +240,7 @@ interface ArriOptions {
|
|
|
239
240
|
rpcDefinitionPath?: string;
|
|
240
241
|
disableDefaultRoute?: boolean;
|
|
241
242
|
disableDefinitionRoute?: boolean;
|
|
243
|
+
heartbeatMs?: number;
|
|
242
244
|
onRequest?: (event: MiddlewareEvent) => void | Promise<void>;
|
|
243
245
|
onAfterResponse?: (event: RequestHookEvent) => void | Promise<void>;
|
|
244
246
|
onBeforeResponse?: (event: RequestHookEvent) => void | Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ interface ArriRoute<TPath extends string, TQuery extends AObjectSchema<any, any>
|
|
|
73
73
|
postHandler?: (event: PostRouteEvent<TPath, InferType<TQuery>, InferType<TBody>, Awaited<TResponse>>) => any;
|
|
74
74
|
}
|
|
75
75
|
declare function defineRoute<TPath extends string, TQuery extends AObjectSchema<any, any> = any, TBody extends AObjectSchema<any, any> = any, TResponse = any>(route: ArriRoute<TPath, TQuery, TBody, TResponse>): ArriRoute<TPath, TQuery, TBody, TResponse>;
|
|
76
|
-
type RouteOptions = Pick<ArriOptions, 'onAfterResponse' | 'onBeforeResponse' | 'onError' | 'onRequest' | 'debug'> & {
|
|
76
|
+
type RouteOptions = Pick<ArriOptions, 'onAfterResponse' | 'onBeforeResponse' | 'onError' | 'onRequest' | 'debug' | 'heartbeatMs'> & {
|
|
77
77
|
middleware: Middleware[];
|
|
78
78
|
};
|
|
79
79
|
declare function registerRoute(router: Router, route: ArriRoute<any>, opts: RouteOptions): void;
|
|
@@ -216,6 +216,7 @@ declare class ArriApp {
|
|
|
216
216
|
private readonly _onError;
|
|
217
217
|
private readonly _debug;
|
|
218
218
|
readonly definitionPath: string;
|
|
219
|
+
private readonly _heartbeatMs;
|
|
219
220
|
constructor(opts?: ArriOptions);
|
|
220
221
|
use(input: Middleware): void;
|
|
221
222
|
use(input: ArriRouter): void;
|
|
@@ -239,6 +240,7 @@ interface ArriOptions {
|
|
|
239
240
|
rpcDefinitionPath?: string;
|
|
240
241
|
disableDefaultRoute?: boolean;
|
|
241
242
|
disableDefinitionRoute?: boolean;
|
|
243
|
+
heartbeatMs?: number;
|
|
242
244
|
onRequest?: (event: MiddlewareEvent) => void | Promise<void>;
|
|
243
245
|
onAfterResponse?: (event: RequestHookEvent) => void | Promise<void>;
|
|
244
246
|
onBeforeResponse?: (event: RequestHookEvent) => void | Promise<void>;
|
package/dist/index.mjs
CHANGED
|
@@ -522,7 +522,6 @@ class EventStreamConnection {
|
|
|
522
522
|
});
|
|
523
523
|
if (this.sendHeartbeat) {
|
|
524
524
|
this.heartbeatInterval = setInterval(async () => {
|
|
525
|
-
console.log("SENDING_HEARTBEAT");
|
|
526
525
|
await this.eventStream.push({
|
|
527
526
|
event: "heartbeat",
|
|
528
527
|
data: ""
|
|
@@ -616,7 +615,7 @@ function registerEventStreamRpc(router, path, procedure, opts) {
|
|
|
616
615
|
);
|
|
617
616
|
}
|
|
618
617
|
const stream = new EventStreamConnection(event, {
|
|
619
|
-
heartbeatMs: procedure.heartbeatMs,
|
|
618
|
+
heartbeatMs: procedure.heartbeatMs ?? opts.heartbeatMs,
|
|
620
619
|
heartbeatEnabled: procedure.heartbeatEnabled,
|
|
621
620
|
validator: responseValidator
|
|
622
621
|
});
|
|
@@ -836,6 +835,7 @@ class ArriApp {
|
|
|
836
835
|
_onError;
|
|
837
836
|
_debug;
|
|
838
837
|
definitionPath;
|
|
838
|
+
_heartbeatMs;
|
|
839
839
|
constructor(opts = {}) {
|
|
840
840
|
this.appInfo = opts?.appInfo;
|
|
841
841
|
this.h3App = createApp({
|
|
@@ -846,6 +846,7 @@ class ArriApp {
|
|
|
846
846
|
this._onError = opts.onError;
|
|
847
847
|
this._onAfterResponse = opts.onAfterResponse;
|
|
848
848
|
this._onBeforeResponse = opts.onBeforeResponse;
|
|
849
|
+
this._heartbeatMs = opts.heartbeatMs ?? 2e4;
|
|
849
850
|
this._rpcRoutePrefix = opts?.rpcRoutePrefix ?? "";
|
|
850
851
|
this._rpcDefinitionPath = opts?.rpcDefinitionPath ?? "__definition";
|
|
851
852
|
this.h3App.use(this.h3Router);
|
|
@@ -950,7 +951,8 @@ class ArriApp {
|
|
|
950
951
|
onError: this._onError,
|
|
951
952
|
onAfterResponse: this._onAfterResponse,
|
|
952
953
|
onBeforeResponse: this._onBeforeResponse,
|
|
953
|
-
debug: this._debug
|
|
954
|
+
debug: this._debug,
|
|
955
|
+
heartbeatMs: this._heartbeatMs
|
|
954
956
|
});
|
|
955
957
|
return;
|
|
956
958
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arrirpc/server",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"scule": "^1.3.0",
|
|
29
29
|
"source-map-support": "^0.5.21",
|
|
30
30
|
"uncrypto": "^0.1.3",
|
|
31
|
-
"@arrirpc/codegen-utils": "0.80.
|
|
32
|
-
"
|
|
33
|
-
"
|
|
31
|
+
"@arrirpc/codegen-utils": "0.80.3",
|
|
32
|
+
"@arrirpc/schema": "0.80.3",
|
|
33
|
+
"arri": "0.80.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"bun-types": "^1.2.
|
|
36
|
+
"bun-types": "^1.2.16"
|
|
37
37
|
}
|
|
38
38
|
}
|