@arrirpc/server 0.51.0 → 0.51.2

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 CHANGED
@@ -1005,27 +1005,33 @@ class ArriApp {
1005
1005
  this._rpcDefinitionPath = opts?.rpcDefinitionPath ?? "__definition";
1006
1006
  this.h3App.use(this.h3Router);
1007
1007
  this.definitionPath = this._rpcRoutePrefix ? `/${this._rpcRoutePrefix}/${this._rpcDefinitionPath}`.split("//").join("/") : `/${this._rpcDefinitionPath}`;
1008
- this.h3Router.get(
1009
- this.definitionPath,
1010
- h3.eventHandler(() => this.getAppDefinition())
1011
- );
1008
+ if (!opts.disableDefinitionRoute) {
1009
+ this.h3Router.get(
1010
+ this.definitionPath,
1011
+ h3.eventHandler(() => this.getAppDefinition())
1012
+ );
1013
+ }
1012
1014
  if (!opts.disableDefaultRoute) {
1013
1015
  this.route({
1014
1016
  method: ["get", "head"],
1015
1017
  path: "/",
1016
1018
  handler: (_) => {
1019
+ const response = {
1020
+ title: this.appInfo?.title ?? "Arri-RPC Server",
1021
+ description: this.appInfo?.description ?? "This server utilizes Arri-RPC. Visit the schema path to see all of the available procedures.",
1022
+ ...this.appInfo
1023
+ };
1024
+ if (opts.disableDefinitionRoute) {
1025
+ return response;
1026
+ }
1017
1027
  let schemaPath;
1018
1028
  if (this._rpcRoutePrefix) {
1019
1029
  schemaPath = `/${this._rpcRoutePrefix}/${this._rpcDefinitionPath}`;
1020
1030
  } else {
1021
1031
  schemaPath = `/${this._rpcDefinitionPath}`;
1022
1032
  }
1023
- return {
1024
- title: this.appInfo?.title ?? "Arri-RPC Server",
1025
- description: this.appInfo?.description ?? "This server utilizes Arri-RPC. Visit the schema path to see all of the available procedures.",
1026
- schemaPath,
1027
- ...this.appInfo
1028
- };
1033
+ response.schemaPath = schemaPath;
1034
+ return response;
1029
1035
  }
1030
1036
  });
1031
1037
  }
package/dist/index.d.cts CHANGED
@@ -273,6 +273,7 @@ interface ArriOptions {
273
273
  */
274
274
  rpcDefinitionPath?: string;
275
275
  disableDefaultRoute?: boolean;
276
+ disableDefinitionRoute?: boolean;
276
277
  onRequest?: (event: MiddlewareEvent) => void | Promise<void>;
277
278
  onAfterResponse?: (event: MiddlewareEvent) => void | Promise<void>;
278
279
  onBeforeResponse?: (event: MiddlewareEvent) => void | Promise<void>;
package/dist/index.d.mts CHANGED
@@ -273,6 +273,7 @@ interface ArriOptions {
273
273
  */
274
274
  rpcDefinitionPath?: string;
275
275
  disableDefaultRoute?: boolean;
276
+ disableDefinitionRoute?: boolean;
276
277
  onRequest?: (event: MiddlewareEvent) => void | Promise<void>;
277
278
  onAfterResponse?: (event: MiddlewareEvent) => void | Promise<void>;
278
279
  onBeforeResponse?: (event: MiddlewareEvent) => void | Promise<void>;
package/dist/index.d.ts CHANGED
@@ -273,6 +273,7 @@ interface ArriOptions {
273
273
  */
274
274
  rpcDefinitionPath?: string;
275
275
  disableDefaultRoute?: boolean;
276
+ disableDefinitionRoute?: boolean;
276
277
  onRequest?: (event: MiddlewareEvent) => void | Promise<void>;
277
278
  onAfterResponse?: (event: MiddlewareEvent) => void | Promise<void>;
278
279
  onBeforeResponse?: (event: MiddlewareEvent) => void | Promise<void>;
package/dist/index.mjs CHANGED
@@ -1004,27 +1004,33 @@ class ArriApp {
1004
1004
  this._rpcDefinitionPath = opts?.rpcDefinitionPath ?? "__definition";
1005
1005
  this.h3App.use(this.h3Router);
1006
1006
  this.definitionPath = this._rpcRoutePrefix ? `/${this._rpcRoutePrefix}/${this._rpcDefinitionPath}`.split("//").join("/") : `/${this._rpcDefinitionPath}`;
1007
- this.h3Router.get(
1008
- this.definitionPath,
1009
- eventHandler(() => this.getAppDefinition())
1010
- );
1007
+ if (!opts.disableDefinitionRoute) {
1008
+ this.h3Router.get(
1009
+ this.definitionPath,
1010
+ eventHandler(() => this.getAppDefinition())
1011
+ );
1012
+ }
1011
1013
  if (!opts.disableDefaultRoute) {
1012
1014
  this.route({
1013
1015
  method: ["get", "head"],
1014
1016
  path: "/",
1015
1017
  handler: (_) => {
1018
+ const response = {
1019
+ title: this.appInfo?.title ?? "Arri-RPC Server",
1020
+ description: this.appInfo?.description ?? "This server utilizes Arri-RPC. Visit the schema path to see all of the available procedures.",
1021
+ ...this.appInfo
1022
+ };
1023
+ if (opts.disableDefinitionRoute) {
1024
+ return response;
1025
+ }
1016
1026
  let schemaPath;
1017
1027
  if (this._rpcRoutePrefix) {
1018
1028
  schemaPath = `/${this._rpcRoutePrefix}/${this._rpcDefinitionPath}`;
1019
1029
  } else {
1020
1030
  schemaPath = `/${this._rpcDefinitionPath}`;
1021
1031
  }
1022
- return {
1023
- title: this.appInfo?.title ?? "Arri-RPC Server",
1024
- description: this.appInfo?.description ?? "This server utilizes Arri-RPC. Visit the schema path to see all of the available procedures.",
1025
- schemaPath,
1026
- ...this.appInfo
1027
- };
1032
+ response.schemaPath = schemaPath;
1033
+ return response;
1028
1034
  }
1029
1035
  });
1030
1036
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrirpc/server",
3
- "version": "0.51.0",
3
+ "version": "0.51.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -29,12 +29,12 @@
29
29
  "scule": "^1.3.0",
30
30
  "source-map-support": "^0.5.21",
31
31
  "uncrypto": "^0.1.3",
32
- "@arrirpc/codegen-dart": "0.51.0",
33
- "@arrirpc/codegen-ts": "0.51.0",
34
- "@arrirpc/codegen-kotlin": "0.51.0",
35
- "@arrirpc/codegen-utils": "0.51.0",
36
- "@arrirpc/schema": "0.51.0",
37
- "arri": "0.51.0"
32
+ "@arrirpc/codegen-dart": "0.51.2",
33
+ "@arrirpc/codegen-kotlin": "0.51.2",
34
+ "@arrirpc/codegen-ts": "0.51.2",
35
+ "@arrirpc/codegen-utils": "0.51.2",
36
+ "@arrirpc/schema": "0.51.2",
37
+ "arri": "0.51.2"
38
38
  },
39
39
  "devDependencies": {
40
40
  "bun-types": "^1.1.13"