arri 0.1.0-beta.6 → 0.1.0-beta.7

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.45622e4c.cjs');
14
+ const config = require('./shared/arri.eea9df0a.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.18968810.mjs';
13
+ import { m as defaultConfig, l as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.16b8531c.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.45622e4c.cjs');
3
+ const config = require('./shared/arri.eea9df0a.cjs');
4
4
  const h3 = require('h3');
5
5
  require('arri-validate');
6
6
  require('arri-codegen-utils');
@@ -24,9 +24,11 @@ exports.getRpcParamName = config.getRpcParamName;
24
24
  exports.getRpcPath = config.getRpcPath;
25
25
  exports.getRpcResponseName = config.getRpcResponseName;
26
26
  exports.handleH3Error = config.handleH3Error;
27
+ exports.handleRoute = config.handleRoute;
27
28
  exports.isArriConfig = config.isArriConfig;
28
29
  exports.isResolvedArriConfig = config.isResolvedArriConfig;
29
30
  exports.isRpc = config.isRpc;
31
+ exports.registerRoute = config.registerRoute;
30
32
  exports.registerRpc = config.registerRpc;
31
33
  exports.defineMiddleware = defineMiddleware;
32
34
  Object.keys(h3).forEach(function (k) {
package/dist/index.d.cts CHANGED
@@ -13,11 +13,9 @@ interface MiddlewareEvent extends H3Event {
13
13
  }
14
14
  type Middleware = (event: MiddlewareEvent) => void | Promise<void>;
15
15
  declare const defineMiddleware: (middleware: Middleware) => Middleware;
16
- type ExtractParam$1<Path, NextPart> = Path extends `:${infer Param}` ? Record<Param, string> & NextPart : NextPart;
17
- type ExtractParams$1<Path> = Path extends `${infer Segment}/${infer Rest}` ? ExtractParam$1<Segment, ExtractParams$1<Rest>> : ExtractParam$1<Path, {}>;
18
-
19
16
  type ExtractParam<Path, NextPart> = Path extends `:${infer Param}` ? Record<Param, string> & NextPart : NextPart;
20
17
  type ExtractParams<Path> = Path extends `${infer Segment}/${infer Rest}` ? ExtractParam<Segment, ExtractParams<Rest>> : ExtractParam<Path, {}>;
18
+
21
19
  interface RouteEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any> extends H3EventContext {
22
20
  params: ExtractParams<TPath>;
23
21
  query: TQuery;
@@ -44,6 +42,8 @@ declare function defineRoute<TPath extends string, TQuery extends AObjectSchema<
44
42
  type RouteOptions = Pick<ArriOptions, "onAfterResponse" | "onBeforeResponse" | "onError" | "onRequest"> & {
45
43
  middleware: Middleware[];
46
44
  };
45
+ declare function registerRoute(router: Router, route: ArriRoute<any>, opts: RouteOptions): void;
46
+ declare function handleRoute(router: Router, method: HttpMethod, route: ArriRoute<any>, opts: RouteOptions): void;
47
47
 
48
48
  interface ArriProcedure<TParams extends AObjectSchema | undefined, TResponse extends AObjectSchema | undefined> {
49
49
  description?: string;
@@ -168,4 +168,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
168
168
  declare const defaultConfig: Required<ArriConfig>;
169
169
  declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
170
170
 
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 };
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, type ExtractParams, type HandlerContext, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type PostRouteEvent, type PostRouteEventContext, type ResolvedArriConfig, type RouteEvent, type RouteEventContext, type RouteOptions, type RpcEvent, type RpcHandlerContext, type RpcPostEvent, type RpcPostHandlerContext, type StatusCode, createRpcDefinition, defaultConfig, defineConfig, defineError, defineMiddleware, defineRoute, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, handleRoute, isArriConfig, isResolvedArriConfig, isRpc, registerRoute, registerRpc };
package/dist/index.d.mts CHANGED
@@ -13,11 +13,9 @@ interface MiddlewareEvent extends H3Event {
13
13
  }
14
14
  type Middleware = (event: MiddlewareEvent) => void | Promise<void>;
15
15
  declare const defineMiddleware: (middleware: Middleware) => Middleware;
16
- type ExtractParam$1<Path, NextPart> = Path extends `:${infer Param}` ? Record<Param, string> & NextPart : NextPart;
17
- type ExtractParams$1<Path> = Path extends `${infer Segment}/${infer Rest}` ? ExtractParam$1<Segment, ExtractParams$1<Rest>> : ExtractParam$1<Path, {}>;
18
-
19
16
  type ExtractParam<Path, NextPart> = Path extends `:${infer Param}` ? Record<Param, string> & NextPart : NextPart;
20
17
  type ExtractParams<Path> = Path extends `${infer Segment}/${infer Rest}` ? ExtractParam<Segment, ExtractParams<Rest>> : ExtractParam<Path, {}>;
18
+
21
19
  interface RouteEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any> extends H3EventContext {
22
20
  params: ExtractParams<TPath>;
23
21
  query: TQuery;
@@ -44,6 +42,8 @@ declare function defineRoute<TPath extends string, TQuery extends AObjectSchema<
44
42
  type RouteOptions = Pick<ArriOptions, "onAfterResponse" | "onBeforeResponse" | "onError" | "onRequest"> & {
45
43
  middleware: Middleware[];
46
44
  };
45
+ declare function registerRoute(router: Router, route: ArriRoute<any>, opts: RouteOptions): void;
46
+ declare function handleRoute(router: Router, method: HttpMethod, route: ArriRoute<any>, opts: RouteOptions): void;
47
47
 
48
48
  interface ArriProcedure<TParams extends AObjectSchema | undefined, TResponse extends AObjectSchema | undefined> {
49
49
  description?: string;
@@ -168,4 +168,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
168
168
  declare const defaultConfig: Required<ArriConfig>;
169
169
  declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
170
170
 
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 };
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, type ExtractParams, type HandlerContext, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type PostRouteEvent, type PostRouteEventContext, type ResolvedArriConfig, type RouteEvent, type RouteEventContext, type RouteOptions, type RpcEvent, type RpcHandlerContext, type RpcPostEvent, type RpcPostHandlerContext, type StatusCode, createRpcDefinition, defaultConfig, defineConfig, defineError, defineMiddleware, defineRoute, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, handleRoute, isArriConfig, isResolvedArriConfig, isRpc, registerRoute, registerRpc };
package/dist/index.d.ts CHANGED
@@ -13,11 +13,9 @@ interface MiddlewareEvent extends H3Event {
13
13
  }
14
14
  type Middleware = (event: MiddlewareEvent) => void | Promise<void>;
15
15
  declare const defineMiddleware: (middleware: Middleware) => Middleware;
16
- type ExtractParam$1<Path, NextPart> = Path extends `:${infer Param}` ? Record<Param, string> & NextPart : NextPart;
17
- type ExtractParams$1<Path> = Path extends `${infer Segment}/${infer Rest}` ? ExtractParam$1<Segment, ExtractParams$1<Rest>> : ExtractParam$1<Path, {}>;
18
-
19
16
  type ExtractParam<Path, NextPart> = Path extends `:${infer Param}` ? Record<Param, string> & NextPart : NextPart;
20
17
  type ExtractParams<Path> = Path extends `${infer Segment}/${infer Rest}` ? ExtractParam<Segment, ExtractParams<Rest>> : ExtractParam<Path, {}>;
18
+
21
19
  interface RouteEventContext<TPath extends string, TQuery extends Record<any, any> = any, TBody = any> extends H3EventContext {
22
20
  params: ExtractParams<TPath>;
23
21
  query: TQuery;
@@ -44,6 +42,8 @@ declare function defineRoute<TPath extends string, TQuery extends AObjectSchema<
44
42
  type RouteOptions = Pick<ArriOptions, "onAfterResponse" | "onBeforeResponse" | "onError" | "onRequest"> & {
45
43
  middleware: Middleware[];
46
44
  };
45
+ declare function registerRoute(router: Router, route: ArriRoute<any>, opts: RouteOptions): void;
46
+ declare function handleRoute(router: Router, method: HttpMethod, route: ArriRoute<any>, opts: RouteOptions): void;
47
47
 
48
48
  interface ArriProcedure<TParams extends AObjectSchema | undefined, TResponse extends AObjectSchema | undefined> {
49
49
  description?: string;
@@ -168,4 +168,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
168
168
  declare const defaultConfig: Required<ArriConfig>;
169
169
  declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
170
170
 
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 };
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, type ExtractParams, type HandlerContext, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type PostRouteEvent, type PostRouteEventContext, type ResolvedArriConfig, type RouteEvent, type RouteEventContext, type RouteOptions, type RpcEvent, type RpcHandlerContext, type RpcPostEvent, type RpcPostHandlerContext, type StatusCode, createRpcDefinition, defaultConfig, defineConfig, defineError, defineMiddleware, defineRoute, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, handleRoute, isArriConfig, isResolvedArriConfig, isRpc, registerRoute, 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, 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';
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, s as handleRoute, k as isArriConfig, l as isResolvedArriConfig, i as isRpc, q as registerRoute, r as registerRpc } from './shared/arri.16b8531c.mjs';
2
2
  export * from 'h3';
3
3
  import 'arri-validate';
4
4
  import 'arri-codegen-utils';
@@ -405,6 +405,31 @@ 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
+ }
431
+ }
432
+
408
433
  function defineRoute(route) {
409
434
  return route;
410
435
  }
@@ -526,31 +551,6 @@ function handleRoute(router, method, route, opts) {
526
551
  }
527
552
  }
528
553
 
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
-
554
554
  var __defProp = Object.defineProperty;
555
555
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
556
556
  var __publicField = (obj, key, value) => {
@@ -725,4 +725,4 @@ function defineConfig(config) {
725
725
  };
726
726
  }
727
727
 
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 };
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, registerRoute as q, registerRpc as r, handleRoute as s };
@@ -407,6 +407,31 @@ 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
+ }
433
+ }
434
+
410
435
  function defineRoute(route) {
411
436
  return route;
412
437
  }
@@ -528,31 +553,6 @@ function handleRoute(router, method, route, opts) {
528
553
  }
529
554
  }
530
555
 
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
-
556
556
  var __defProp = Object.defineProperty;
557
557
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
558
558
  var __publicField = (obj, key, value) => {
@@ -743,7 +743,9 @@ exports.getRpcParamName = getRpcParamName;
743
743
  exports.getRpcPath = getRpcPath;
744
744
  exports.getRpcResponseName = getRpcResponseName;
745
745
  exports.handleH3Error = handleH3Error;
746
+ exports.handleRoute = handleRoute;
746
747
  exports.isArriConfig = isArriConfig;
747
748
  exports.isResolvedArriConfig = isResolvedArriConfig;
748
749
  exports.isRpc = isRpc;
750
+ exports.registerRoute = registerRoute;
749
751
  exports.registerRpc = registerRpc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arri",
3
- "version": "0.1.0-beta.6",
3
+ "version": "0.1.0-beta.7",
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-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"
34
+ "arri-validate": "0.1.0-beta.7",
35
+ "arri-codegen-utils": "0.1.0-beta.7",
36
+ "arri-codegen-ts": "0.1.0-beta.7",
37
+ "arri-codegen-dart": "0.1.0-beta.7"
38
38
  },
39
39
  "devDependencies": {
40
40
  "bun-types": "^1.0.5"