arri 0.9.2 → 0.10.1

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.3b472e3d.cjs');
14
+ const config = require('./shared/arri.a90e9723.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 { n as defaultConfig, m as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.b635ea35.mjs';
13
+ import { n as defaultConfig, m as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.537f5e35.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.3b472e3d.cjs');
3
+ const config = require('./shared/arri.a90e9723.cjs');
4
4
  const h3 = require('h3');
5
5
  require('arri-validate');
6
6
  require('arri-codegen-utils');
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { HttpMethod, RpcDefinition, AppDefinition, ClientGenerator } from 'arri-codegen-utils';
1
+ import { HttpMethod, RpcHttpMethod, RpcDefinition, AppDefinition, ClientGenerator } from 'arri-codegen-utils';
2
2
  import { AObjectSchema, ASchema, InferType, ARecordSchema, ADiscriminatorSchema, a, ValidationError } from 'arri-validate';
3
3
  import { H3EventContext, H3Event, Router, App, H3Error } from 'h3';
4
4
  export * from 'h3';
@@ -48,7 +48,7 @@ type RpcParamSchema<TObjectInner = any, TRecordInner extends ASchema = any, TDis
48
48
  declare function isRpcParamSchema(input: unknown): input is RpcParamSchema;
49
49
  interface ArriProcedure<TParams extends RpcParamSchema | undefined, TResponse extends RpcParamSchema | undefined> {
50
50
  description?: string;
51
- method?: HttpMethod;
51
+ method?: RpcHttpMethod;
52
52
  path?: string;
53
53
  params: TParams;
54
54
  response: TResponse;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { HttpMethod, RpcDefinition, AppDefinition, ClientGenerator } from 'arri-codegen-utils';
1
+ import { HttpMethod, RpcHttpMethod, RpcDefinition, AppDefinition, ClientGenerator } from 'arri-codegen-utils';
2
2
  import { AObjectSchema, ASchema, InferType, ARecordSchema, ADiscriminatorSchema, a, ValidationError } from 'arri-validate';
3
3
  import { H3EventContext, H3Event, Router, App, H3Error } from 'h3';
4
4
  export * from 'h3';
@@ -48,7 +48,7 @@ type RpcParamSchema<TObjectInner = any, TRecordInner extends ASchema = any, TDis
48
48
  declare function isRpcParamSchema(input: unknown): input is RpcParamSchema;
49
49
  interface ArriProcedure<TParams extends RpcParamSchema | undefined, TResponse extends RpcParamSchema | undefined> {
50
50
  description?: string;
51
- method?: HttpMethod;
51
+ method?: RpcHttpMethod;
52
52
  path?: string;
53
53
  params: TParams;
54
54
  response: TResponse;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { HttpMethod, RpcDefinition, AppDefinition, ClientGenerator } from 'arri-codegen-utils';
1
+ import { HttpMethod, RpcHttpMethod, RpcDefinition, AppDefinition, ClientGenerator } from 'arri-codegen-utils';
2
2
  import { AObjectSchema, ASchema, InferType, ARecordSchema, ADiscriminatorSchema, a, ValidationError } from 'arri-validate';
3
3
  import { H3EventContext, H3Event, Router, App, H3Error } from 'h3';
4
4
  export * from 'h3';
@@ -48,7 +48,7 @@ type RpcParamSchema<TObjectInner = any, TRecordInner extends ASchema = any, TDis
48
48
  declare function isRpcParamSchema(input: unknown): input is RpcParamSchema;
49
49
  interface ArriProcedure<TParams extends RpcParamSchema | undefined, TResponse extends RpcParamSchema | undefined> {
50
50
  description?: string;
51
- method?: HttpMethod;
51
+ method?: RpcHttpMethod;
52
52
  path?: string;
53
53
  params: TParams;
54
54
  response: TResponse;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { A as ArriApp, p as ArriRouter, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ErrorResponse, c as createRpcDefinition, n as defaultConfig, o as defineConfig, h as defineError, q as defineRoute, d as defineRpc, j as errorResponseFromValidationErrors, e as getRpcParamName, g as getRpcPath, f as getRpcResponseName, k as handleH3Error, t as handleRoute, l as isArriConfig, m as isResolvedArriConfig, b as isRpc, i as isRpcParamSchema, s as registerRoute, r as registerRpc } from './shared/arri.b635ea35.mjs';
1
+ export { A as ArriApp, p as ArriRouter, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ErrorResponse, c as createRpcDefinition, n as defaultConfig, o as defineConfig, h as defineError, q as defineRoute, d as defineRpc, j as errorResponseFromValidationErrors, e as getRpcParamName, g as getRpcPath, f as getRpcResponseName, k as handleH3Error, t as handleRoute, l as isArriConfig, m as isResolvedArriConfig, b as isRpc, i as isRpcParamSchema, s as registerRoute, r as registerRpc } from './shared/arri.537f5e35.mjs';
2
2
  export * from 'h3';
3
3
  import 'arri-validate';
4
4
  import 'arri-codegen-utils';
@@ -1,6 +1,6 @@
1
1
  import { createError, isError, setResponseStatus, send, eventHandler, isPreflightRequest, readRawBody, getValidatedQuery, setResponseHeader, defineEventHandler, getQuery, setHeader, createRouter, createApp, sendError } from 'h3';
2
2
  import { a, isAObjectSchema, isARecordSchema, isADiscriminatorSchema } from 'arri-validate';
3
- import { isHttpMethod, removeDisallowedChars } from 'arri-codegen-utils';
3
+ import { isRpcHttpMethod, removeDisallowedChars } from 'arri-codegen-utils';
4
4
  import { kebabCase, pascalCase } from 'scule';
5
5
 
6
6
  const ErrorResponse = a.object({
@@ -208,11 +208,11 @@ function isRpcParamSchema(input) {
208
208
  return isAObjectSchema(input) || isARecordSchema(input) || isADiscriminatorSchema(input);
209
209
  }
210
210
  function isRpc(input) {
211
- if (typeof input !== "object") {
211
+ if (typeof input !== "object" || input === null) {
212
212
  return false;
213
213
  }
214
214
  const anyInput = input;
215
- if (!isHttpMethod(anyInput.method)) {
215
+ if (!isRpcHttpMethod(anyInput.method)) {
216
216
  return false;
217
217
  }
218
218
  if (typeof anyInput.handler !== "function") {
@@ -296,8 +296,7 @@ function registerRpc(router, path, procedure, opts) {
296
296
  }
297
297
  if (isRpcParamSchema(procedure.params)) {
298
298
  switch (httpMethod) {
299
- case "get":
300
- case "head": {
299
+ case "get": {
301
300
  const parsedParams = await getValidatedQuery(
302
301
  event,
303
302
  (input) => a.safeCoerce(procedure.params, input)
@@ -394,9 +393,6 @@ function registerRpc(router, path, procedure, opts) {
394
393
  case "get":
395
394
  router.get(path, handler);
396
395
  break;
397
- case "head":
398
- router.head(path, handler);
399
- break;
400
396
  case "delete":
401
397
  router.delete(path, handler);
402
398
  break;
@@ -538,15 +534,15 @@ function handleRoute(router, method, route, opts) {
538
534
  return "";
539
535
  });
540
536
  switch (method) {
537
+ case "head":
538
+ router.head(route.path, handler);
539
+ break;
541
540
  case "get":
542
541
  router.get(route.path, handler);
543
542
  break;
544
543
  case "delete":
545
544
  router.delete(route.path, handler);
546
545
  break;
547
- case "head":
548
- router.head(route.path, handler);
549
- break;
550
546
  case "patch":
551
547
  router.patch(route.path, handler);
552
548
  break;
@@ -210,11 +210,11 @@ function isRpcParamSchema(input) {
210
210
  return arriValidate.isAObjectSchema(input) || arriValidate.isARecordSchema(input) || arriValidate.isADiscriminatorSchema(input);
211
211
  }
212
212
  function isRpc(input) {
213
- if (typeof input !== "object") {
213
+ if (typeof input !== "object" || input === null) {
214
214
  return false;
215
215
  }
216
216
  const anyInput = input;
217
- if (!arriCodegenUtils.isHttpMethod(anyInput.method)) {
217
+ if (!arriCodegenUtils.isRpcHttpMethod(anyInput.method)) {
218
218
  return false;
219
219
  }
220
220
  if (typeof anyInput.handler !== "function") {
@@ -298,8 +298,7 @@ function registerRpc(router, path, procedure, opts) {
298
298
  }
299
299
  if (isRpcParamSchema(procedure.params)) {
300
300
  switch (httpMethod) {
301
- case "get":
302
- case "head": {
301
+ case "get": {
303
302
  const parsedParams = await h3.getValidatedQuery(
304
303
  event,
305
304
  (input) => arriValidate.a.safeCoerce(procedure.params, input)
@@ -396,9 +395,6 @@ function registerRpc(router, path, procedure, opts) {
396
395
  case "get":
397
396
  router.get(path, handler);
398
397
  break;
399
- case "head":
400
- router.head(path, handler);
401
- break;
402
398
  case "delete":
403
399
  router.delete(path, handler);
404
400
  break;
@@ -540,15 +536,15 @@ function handleRoute(router, method, route, opts) {
540
536
  return "";
541
537
  });
542
538
  switch (method) {
539
+ case "head":
540
+ router.head(route.path, handler);
541
+ break;
543
542
  case "get":
544
543
  router.get(route.path, handler);
545
544
  break;
546
545
  case "delete":
547
546
  router.delete(route.path, handler);
548
547
  break;
549
- case "head":
550
- router.head(route.path, handler);
551
- break;
552
548
  case "patch":
553
549
  router.patch(route.path, handler);
554
550
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arri",
3
- "version": "0.9.2",
3
+ "version": "0.10.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -30,16 +30,16 @@
30
30
  "pathe": "^1.1.1",
31
31
  "prettier": "^3.0.3",
32
32
  "scule": "^1.0.0",
33
- "arri-codegen-dart": "0.9.2",
34
- "arri-codegen-ts": "0.9.2",
35
- "arri-codegen-utils": "0.9.2",
36
- "arri-validate": "0.9.2"
33
+ "arri-codegen-ts": "0.10.1",
34
+ "arri-validate": "0.10.1",
35
+ "arri-codegen-dart": "0.10.1",
36
+ "arri-codegen-utils": "0.10.1"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "listhen": "1.x"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/degit": "^2.8.5",
43
- "bun-types": "^1.0.9"
42
+ "@types/degit": "^2.8.6",
43
+ "bun-types": "^1.0.11"
44
44
  }
45
45
  }