arri 0.1.0-beta.5 → 0.1.0-beta.6

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/cli.cjs CHANGED
@@ -11,7 +11,7 @@ const consola = require('consola');
11
11
  const esbuild = require('esbuild');
12
12
  const path = require('pathe');
13
13
  const prettier = require('prettier');
14
- const config = require('./shared/arri.ab9313ca.cjs');
14
+ const config = require('./shared/arri.45622e4c.cjs');
15
15
  const globby = require('globby');
16
16
  const scule = require('scule');
17
17
  const arriCodegenDart = require('arri-codegen-dart');
package/dist/cli.mjs CHANGED
@@ -10,7 +10,7 @@ import * as esbuild from 'esbuild';
10
10
  import { build as build$1 } from 'esbuild';
11
11
  import path from 'pathe';
12
12
  import prettier from 'prettier';
13
- import { m as defaultConfig, l as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.b5addda0.mjs';
13
+ import { m as defaultConfig, l as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.18968810.mjs';
14
14
  import { globby } from 'globby';
15
15
  import { camelCase, kebabCase } from 'scule';
16
16
  import { dartClientGenerator } from 'arri-codegen-dart';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const config = require('./shared/arri.ab9313ca.cjs');
3
+ const config = require('./shared/arri.45622e4c.cjs');
4
4
  const h3 = require('h3');
5
5
  require('arri-validate');
6
6
  require('arri-codegen-utils');
@@ -17,6 +17,7 @@ exports.createRpcDefinition = config.createRpcDefinition;
17
17
  exports.defaultConfig = config.defaultConfig;
18
18
  exports.defineConfig = config.defineConfig;
19
19
  exports.defineError = config.defineError;
20
+ exports.defineRoute = config.defineRoute;
20
21
  exports.defineRpc = config.defineRpc;
21
22
  exports.errorResponseFromValidationErrors = config.errorResponseFromValidationErrors;
22
23
  exports.getRpcParamName = config.getRpcParamName;
package/dist/index.d.cts CHANGED
@@ -40,6 +40,7 @@ interface ArriRoute<TPath extends string, TQuery extends AObjectSchema<any, any>
40
40
  handler: (event: RouteEvent<TPath, InferType<TQuery>, InferType<TBody>>) => TResponse;
41
41
  postHandler?: (event: PostRouteEvent<TPath, InferType<TQuery>, InferType<TBody>, Awaited<TResponse>>) => any;
42
42
  }
43
+ 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>;
43
44
  type RouteOptions = Pick<ArriOptions, "onAfterResponse" | "onBeforeResponse" | "onError" | "onRequest"> & {
44
45
  middleware: Middleware[];
45
46
  };
@@ -167,4 +168,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
167
168
  declare const defaultConfig: Required<ArriConfig>;
168
169
  declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
169
170
 
170
- export { ArriApp, type ArriConfig, type ArriNamedProcedure, type ArriOptions, type ArriProcedure, type ArriProcedureHandler, type ArriProcedurePostHandler, ArriRouter, type ArriRouterBase, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, ErrorResponse, type ExtractParam$1 as ExtractParam, type ExtractParams$1 as ExtractParams, type HandlerContext, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ResolvedArriConfig, type RpcEvent, type RpcHandlerContext, type RpcPostEvent, type RpcPostHandlerContext, type StatusCode, createRpcDefinition, defaultConfig, defineConfig, defineError, defineMiddleware, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, isArriConfig, isResolvedArriConfig, isRpc, registerRpc };
171
+ export { ArriApp, type ArriConfig, type ArriNamedProcedure, type ArriOptions, type ArriProcedure, type ArriProcedureHandler, type ArriProcedurePostHandler, type ArriRoute, ArriRouter, type ArriRouterBase, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, ErrorResponse, type ExtractParam$1 as ExtractParam, type ExtractParams$1 as ExtractParams, type HandlerContext, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ResolvedArriConfig, type RpcEvent, type RpcHandlerContext, type RpcPostEvent, type RpcPostHandlerContext, type StatusCode, createRpcDefinition, defaultConfig, defineConfig, defineError, defineMiddleware, defineRoute, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, isArriConfig, isResolvedArriConfig, isRpc, registerRpc };
package/dist/index.d.mts CHANGED
@@ -40,6 +40,7 @@ interface ArriRoute<TPath extends string, TQuery extends AObjectSchema<any, any>
40
40
  handler: (event: RouteEvent<TPath, InferType<TQuery>, InferType<TBody>>) => TResponse;
41
41
  postHandler?: (event: PostRouteEvent<TPath, InferType<TQuery>, InferType<TBody>, Awaited<TResponse>>) => any;
42
42
  }
43
+ 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>;
43
44
  type RouteOptions = Pick<ArriOptions, "onAfterResponse" | "onBeforeResponse" | "onError" | "onRequest"> & {
44
45
  middleware: Middleware[];
45
46
  };
@@ -167,4 +168,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
167
168
  declare const defaultConfig: Required<ArriConfig>;
168
169
  declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
169
170
 
170
- export { ArriApp, type ArriConfig, type ArriNamedProcedure, type ArriOptions, type ArriProcedure, type ArriProcedureHandler, type ArriProcedurePostHandler, ArriRouter, type ArriRouterBase, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, ErrorResponse, type ExtractParam$1 as ExtractParam, type ExtractParams$1 as ExtractParams, type HandlerContext, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ResolvedArriConfig, type RpcEvent, type RpcHandlerContext, type RpcPostEvent, type RpcPostHandlerContext, type StatusCode, createRpcDefinition, defaultConfig, defineConfig, defineError, defineMiddleware, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, isArriConfig, isResolvedArriConfig, isRpc, registerRpc };
171
+ export { ArriApp, type ArriConfig, type ArriNamedProcedure, type ArriOptions, type ArriProcedure, type ArriProcedureHandler, type ArriProcedurePostHandler, type ArriRoute, ArriRouter, type ArriRouterBase, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, ErrorResponse, type ExtractParam$1 as ExtractParam, type ExtractParams$1 as ExtractParams, type HandlerContext, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ResolvedArriConfig, type RpcEvent, type RpcHandlerContext, type RpcPostEvent, type RpcPostHandlerContext, type StatusCode, createRpcDefinition, defaultConfig, defineConfig, defineError, defineMiddleware, defineRoute, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, isArriConfig, isResolvedArriConfig, isRpc, registerRpc };
package/dist/index.d.ts CHANGED
@@ -40,6 +40,7 @@ interface ArriRoute<TPath extends string, TQuery extends AObjectSchema<any, any>
40
40
  handler: (event: RouteEvent<TPath, InferType<TQuery>, InferType<TBody>>) => TResponse;
41
41
  postHandler?: (event: PostRouteEvent<TPath, InferType<TQuery>, InferType<TBody>, Awaited<TResponse>>) => any;
42
42
  }
43
+ 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>;
43
44
  type RouteOptions = Pick<ArriOptions, "onAfterResponse" | "onBeforeResponse" | "onError" | "onRequest"> & {
44
45
  middleware: Middleware[];
45
46
  };
@@ -167,4 +168,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
167
168
  declare const defaultConfig: Required<ArriConfig>;
168
169
  declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
169
170
 
170
- export { ArriApp, type ArriConfig, type ArriNamedProcedure, type ArriOptions, type ArriProcedure, type ArriProcedureHandler, type ArriProcedurePostHandler, ArriRouter, type ArriRouterBase, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, ErrorResponse, type ExtractParam$1 as ExtractParam, type ExtractParams$1 as ExtractParams, type HandlerContext, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ResolvedArriConfig, type RpcEvent, type RpcHandlerContext, type RpcPostEvent, type RpcPostHandlerContext, type StatusCode, createRpcDefinition, defaultConfig, defineConfig, defineError, defineMiddleware, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, isArriConfig, isResolvedArriConfig, isRpc, registerRpc };
171
+ export { ArriApp, type ArriConfig, type ArriNamedProcedure, type ArriOptions, type ArriProcedure, type ArriProcedureHandler, type ArriProcedurePostHandler, type ArriRoute, ArriRouter, type ArriRouterBase, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, ErrorResponse, type ExtractParam$1 as ExtractParam, type ExtractParams$1 as ExtractParams, type HandlerContext, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ResolvedArriConfig, type RpcEvent, type RpcHandlerContext, type RpcPostEvent, type RpcPostHandlerContext, type StatusCode, createRpcDefinition, defaultConfig, defineConfig, defineError, defineMiddleware, defineRoute, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, isArriConfig, isResolvedArriConfig, isRpc, registerRpc };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { A as ArriApp, o as ArriRouter, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ErrorResponse, c as createRpcDefinition, m as defaultConfig, n as defineConfig, f as defineError, d as defineRpc, h as errorResponseFromValidationErrors, b as getRpcParamName, g as getRpcPath, e as getRpcResponseName, j as handleH3Error, k as isArriConfig, l as isResolvedArriConfig, i as isRpc, r as registerRpc } from './shared/arri.b5addda0.mjs';
1
+ export { A as ArriApp, o as ArriRouter, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ErrorResponse, c as createRpcDefinition, m as defaultConfig, n as defineConfig, f as defineError, p as defineRoute, d as defineRpc, h as errorResponseFromValidationErrors, b as getRpcParamName, g as getRpcPath, e as getRpcResponseName, j as handleH3Error, k as isArriConfig, l as isResolvedArriConfig, i as isRpc, r as registerRpc } from './shared/arri.18968810.mjs';
2
2
  export * from 'h3';
3
3
  import 'arri-validate';
4
4
  import 'arri-codegen-utils';
@@ -405,31 +405,9 @@ function registerRpc(router, path, procedure, opts) {
405
405
  }
406
406
  }
407
407
 
408
- var __defProp$1 = Object.defineProperty;
409
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
410
- var __publicField$1 = (obj, key, value) => {
411
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
412
- return value;
413
- };
414
- class ArriRouter {
415
- constructor() {
416
- __publicField$1(this, "procedures", []);
417
- __publicField$1(this, "routes", []);
418
- }
419
- rpc(procedure) {
420
- this.procedures.push(procedure);
421
- }
422
- route(route) {
423
- this.routes.push(route);
424
- }
425
- getProcedures() {
426
- return this.procedures;
427
- }
428
- getRoutes() {
429
- return this.routes;
430
- }
408
+ function defineRoute(route) {
409
+ return route;
431
410
  }
432
-
433
411
  function registerRoute(router, route, opts) {
434
412
  if (typeof route.method === "string") {
435
413
  handleRoute(router, route.method, route, opts);
@@ -548,6 +526,31 @@ function handleRoute(router, method, route, opts) {
548
526
  }
549
527
  }
550
528
 
529
+ var __defProp$1 = Object.defineProperty;
530
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
531
+ var __publicField$1 = (obj, key, value) => {
532
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
533
+ return value;
534
+ };
535
+ class ArriRouter {
536
+ constructor() {
537
+ __publicField$1(this, "procedures", []);
538
+ __publicField$1(this, "routes", []);
539
+ }
540
+ rpc(procedure) {
541
+ this.procedures.push(procedure);
542
+ }
543
+ route(route) {
544
+ this.routes.push(route);
545
+ }
546
+ getProcedures() {
547
+ return this.procedures;
548
+ }
549
+ getRoutes() {
550
+ return this.routes;
551
+ }
552
+ }
553
+
551
554
  var __defProp = Object.defineProperty;
552
555
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
553
556
  var __publicField = (obj, key, value) => {
@@ -722,4 +725,4 @@ function defineConfig(config) {
722
725
  };
723
726
  }
724
727
 
725
- export { ArriApp as A, DEV_ENDPOINT_ROOT as D, ErrorResponse as E, DEV_DEFINITION_ENDPOINT as a, getRpcParamName as b, createRpcDefinition as c, defineRpc as d, getRpcResponseName as e, defineError as f, getRpcPath as g, errorResponseFromValidationErrors as h, isRpc as i, handleH3Error as j, isArriConfig as k, isResolvedArriConfig as l, defaultConfig as m, defineConfig as n, ArriRouter as o, registerRpc as r };
728
+ export { ArriApp as A, DEV_ENDPOINT_ROOT as D, ErrorResponse as E, DEV_DEFINITION_ENDPOINT as a, getRpcParamName as b, createRpcDefinition as c, defineRpc as d, getRpcResponseName as e, defineError as f, getRpcPath as g, errorResponseFromValidationErrors as h, isRpc as i, handleH3Error as j, isArriConfig as k, isResolvedArriConfig as l, defaultConfig as m, defineConfig as n, ArriRouter as o, defineRoute as p, registerRpc as r };
@@ -407,31 +407,9 @@ function registerRpc(router, path, procedure, opts) {
407
407
  }
408
408
  }
409
409
 
410
- var __defProp$1 = Object.defineProperty;
411
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
412
- var __publicField$1 = (obj, key, value) => {
413
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
414
- return value;
415
- };
416
- class ArriRouter {
417
- constructor() {
418
- __publicField$1(this, "procedures", []);
419
- __publicField$1(this, "routes", []);
420
- }
421
- rpc(procedure) {
422
- this.procedures.push(procedure);
423
- }
424
- route(route) {
425
- this.routes.push(route);
426
- }
427
- getProcedures() {
428
- return this.procedures;
429
- }
430
- getRoutes() {
431
- return this.routes;
432
- }
410
+ function defineRoute(route) {
411
+ return route;
433
412
  }
434
-
435
413
  function registerRoute(router, route, opts) {
436
414
  if (typeof route.method === "string") {
437
415
  handleRoute(router, route.method, route, opts);
@@ -550,6 +528,31 @@ function handleRoute(router, method, route, opts) {
550
528
  }
551
529
  }
552
530
 
531
+ var __defProp$1 = Object.defineProperty;
532
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
533
+ var __publicField$1 = (obj, key, value) => {
534
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
535
+ return value;
536
+ };
537
+ class ArriRouter {
538
+ constructor() {
539
+ __publicField$1(this, "procedures", []);
540
+ __publicField$1(this, "routes", []);
541
+ }
542
+ rpc(procedure) {
543
+ this.procedures.push(procedure);
544
+ }
545
+ route(route) {
546
+ this.routes.push(route);
547
+ }
548
+ getProcedures() {
549
+ return this.procedures;
550
+ }
551
+ getRoutes() {
552
+ return this.routes;
553
+ }
554
+ }
555
+
553
556
  var __defProp = Object.defineProperty;
554
557
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
555
558
  var __publicField = (obj, key, value) => {
@@ -733,6 +736,7 @@ exports.createRpcDefinition = createRpcDefinition;
733
736
  exports.defaultConfig = defaultConfig;
734
737
  exports.defineConfig = defineConfig;
735
738
  exports.defineError = defineError;
739
+ exports.defineRoute = defineRoute;
736
740
  exports.defineRpc = defineRpc;
737
741
  exports.errorResponseFromValidationErrors = errorResponseFromValidationErrors;
738
742
  exports.getRpcParamName = getRpcParamName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arri",
3
- "version": "0.1.0-beta.5",
3
+ "version": "0.1.0-beta.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -31,10 +31,10 @@
31
31
  "pathe": "^1.1.1",
32
32
  "prettier": "^3.0.3",
33
33
  "scule": "^1.0.0",
34
- "arri-codegen-dart": "0.1.0-beta.5",
35
- "arri-codegen-utils": "0.1.0-beta.5",
36
- "arri-validate": "0.1.0-beta.5",
37
- "arri-codegen-ts": "0.1.0-beta.5"
34
+ "arri-codegen-utils": "0.1.0-beta.6",
35
+ "arri-codegen-dart": "0.1.0-beta.6",
36
+ "arri-validate": "0.1.0-beta.6",
37
+ "arri-codegen-ts": "0.1.0-beta.6"
38
38
  },
39
39
  "devDependencies": {
40
40
  "bun-types": "^1.0.5"