arri 0.29.0 → 0.31.0

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
@@ -12,7 +12,7 @@ const esbuild = require('esbuild');
12
12
  const esbuildPluginReplace = require('esbuild-plugin-replace');
13
13
  const path = require('pathe');
14
14
  const prettier = require('prettier');
15
- const config = require('./shared/arri.31b22fac.cjs');
15
+ const config = require('./shared/arri.7b317e03.cjs');
16
16
  const globby = require('globby');
17
17
  const scule = require('scule');
18
18
  const ofetch = require('ofetch');
@@ -409,7 +409,15 @@ const codegen = citty.defineCommand({
409
409
  consola__default.info(`Generating ${config$1.clientGenerators.length} clients`);
410
410
  await Promise.allSettled(
411
411
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
412
- config$1.clientGenerators.map((gen) => gen.generator(def))
412
+ config$1.clientGenerators.map(
413
+ (gen) => gen.generator(
414
+ def ?? {
415
+ arriSchemaVersion: "0.0.4",
416
+ procedures: {},
417
+ models: {}
418
+ }
419
+ )
420
+ )
413
421
  );
414
422
  }
415
423
  });
package/dist/cli.mjs CHANGED
@@ -11,7 +11,7 @@ import { build as build$1 } from 'esbuild';
11
11
  import { replace } from 'esbuild-plugin-replace';
12
12
  import path from 'pathe';
13
13
  import prettier from 'prettier';
14
- import { n as defaultConfig, m as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.d9f65487.mjs';
14
+ import { o as defaultConfig, n as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.e9a56e75.mjs';
15
15
  import { globby } from 'globby';
16
16
  import { camelCase, kebabCase } from 'scule';
17
17
  import { ofetch } from 'ofetch';
@@ -385,7 +385,15 @@ const codegen = defineCommand({
385
385
  consola.info(`Generating ${config.clientGenerators.length} clients`);
386
386
  await Promise.allSettled(
387
387
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
388
- config.clientGenerators.map((gen) => gen.generator(def))
388
+ config.clientGenerators.map(
389
+ (gen) => gen.generator(
390
+ def ?? {
391
+ arriSchemaVersion: "0.0.4",
392
+ procedures: {},
393
+ models: {}
394
+ }
395
+ )
396
+ )
389
397
  );
390
398
  }
391
399
  });
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const config = require('./shared/arri.31b22fac.cjs');
3
+ const config = require('./shared/arri.7b317e03.cjs');
4
4
  const h3 = require('h3');
5
5
  require('arri-codegen-utils');
6
6
  require('arri-validate');
@@ -15,7 +15,8 @@ exports.DEV_DEFINITION_ENDPOINT = config.DEV_DEFINITION_ENDPOINT;
15
15
  exports.DEV_ENDPOINT_ROOT = config.DEV_ENDPOINT_ROOT;
16
16
  exports.ErrorResponse = config.ErrorResponse;
17
17
  exports.EventStreamConnection = config.EventStreamConnection;
18
- exports.createRpcDefinition = config.createRpcDefinition;
18
+ exports.createAppDefinition = config.createAppDefinition;
19
+ exports.createHttpRpcDefinition = config.createHttpRpcDefinition;
19
20
  exports.defaultConfig = config.defaultConfig;
20
21
  exports.defineConfig = config.defineConfig;
21
22
  exports.defineError = config.defineError;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { HttpMethod, RpcHttpMethod, RpcDefinition, SchemaFormProperties, SchemaFormDiscriminator, SchemaFormValues, AppDefinition, ClientGenerator } from 'arri-codegen-utils';
2
- import { AObjectSchema, ASchema, InferType, a, ValidationError, ValueError, ARecordSchema, ADiscriminatorSchema } from 'arri-validate';
1
+ import { HttpMethod, RpcHttpMethod, HttpRpcDefinition, SchemaFormProperties, SchemaFormDiscriminator, SchemaFormValues, AppDefinition, ClientGenerator } from 'arri-codegen-utils';
2
+ import { AObjectSchema, ASchema, InferType, a, ValidationError, ValueError, ADiscriminatorSchema } from 'arri-validate';
3
3
  import { H3EventContext, H3Event, Router, H3Error, App } from 'h3';
4
4
  export * from 'h3';
5
5
  import { EventStream } from 'h3-sse';
@@ -108,7 +108,7 @@ declare function registerEventStreamRpc(router: Router, path: string, procedure:
108
108
  name: string;
109
109
  }, opts: RouteOptions): void;
110
110
 
111
- type RpcParamSchema<TObjectInner = any, TRecordInner extends ASchema = any, TDiscriminatorInner = any> = AObjectSchema<TObjectInner> | ARecordSchema<TRecordInner> | ADiscriminatorSchema<TDiscriminatorInner>;
111
+ type RpcParamSchema<TObjectInner = any, TDiscriminatorInner = any> = AObjectSchema<TObjectInner> | ADiscriminatorSchema<TDiscriminatorInner>;
112
112
  declare function isRpcParamSchema(input: unknown): input is RpcParamSchema;
113
113
  interface NamedRpc<TIsEventStream extends boolean = false, TParams extends RpcParamSchema | undefined = undefined, TResponse extends RpcParamSchema | undefined = undefined> extends Rpc<TIsEventStream, TParams, TResponse> {
114
114
  name: string;
@@ -144,7 +144,7 @@ type RpcHandler<TParams, TResponse> = (context: RpcHandlerContext<TParams>, even
144
144
  type RpcPostHandler<TParams, TResponse> = (context: RpcPostHandlerContext<TParams, TResponse>, event: RpcPostEvent<TParams, TResponse>) => any;
145
145
  declare function isRpc(input: unknown): input is Rpc<any, any>;
146
146
  declare function defineRpc<TParams extends RpcParamSchema | undefined = undefined, TResponse extends RpcParamSchema | undefined | never = undefined>(config: HttpRpc<TParams, TResponse>): Rpc<false, TParams, TResponse>;
147
- declare function createRpcDefinition(rpcName: string, httpPath: string, procedure: Rpc<any, any, any>): RpcDefinition;
147
+ declare function createHttpRpcDefinition(rpcName: string, httpPath: string, procedure: Rpc<any, any, any>): HttpRpcDefinition;
148
148
  declare function getRpcPath(rpcName: string, prefix?: string): string;
149
149
  declare function getRpcParamName(rpcName: string, procedure: Rpc<any, any, any>): string | undefined;
150
150
  declare function getRpcResponseName(rpcName: string, procedure: Rpc<any, any, any>): string | undefined;
@@ -171,6 +171,7 @@ declare class ArriRouter implements ArriRouterBase {
171
171
  declare const DEV_ENDPOINT_ROOT = "/__arri_dev__";
172
172
  declare const DEV_DEFINITION_ENDPOINT = "/__arri_dev__/__definition";
173
173
  type ModelMap = Record<string, SchemaFormProperties | SchemaFormDiscriminator | SchemaFormValues>;
174
+ declare const createAppDefinition: (def: AppDefinition) => AppDefinition;
174
175
  declare class ArriApp implements ArriRouterBase {
175
176
  __isArri__: boolean;
176
177
  readonly h3App: App;
@@ -237,4 +238,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
237
238
  declare const defaultConfig: Required<ArriConfig>;
238
239
  declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
239
240
 
240
- export { ArriApp, type ArriConfig, type ArriOptions, type ArriRoute, ArriRouter, type ArriRouterBase, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, ErrorResponse, EventStreamConnection, type EventStreamConnectionOptions, type EventStreamRpc, type EventStreamRpcHandler, type EventStreamRpcHandlerContext, type ExtractParam, type ExtractParams, type HandlerContext, type HttpRpc, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ModelMap, type NamedRpc, type PostRouteEvent, type PostRouteEventContext, type ResolvedArriConfig, type RouteEvent, type RouteEventContext, type RouteOptions, type Rpc, type RpcEvent, type RpcHandler, type RpcHandlerContext, type RpcParamSchema, type RpcPostEvent, type RpcPostHandler, type RpcPostHandlerContext, type StatusCode, createRpcDefinition, defaultConfig, defineConfig, defineError, defineEventStreamRpc, defineMiddleware, defineRoute, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, handleRoute, isArriConfig, isEventStreamRpc, isResolvedArriConfig, isRpc, isRpcParamSchema, registerEventStreamRpc, registerRoute, registerRpc, validateRpcRequestInput };
241
+ export { ArriApp, type ArriConfig, type ArriOptions, type ArriRoute, ArriRouter, type ArriRouterBase, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, ErrorResponse, EventStreamConnection, type EventStreamConnectionOptions, type EventStreamRpc, type EventStreamRpcHandler, type EventStreamRpcHandlerContext, type ExtractParam, type ExtractParams, type HandlerContext, type HttpRpc, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ModelMap, type NamedRpc, type PostRouteEvent, type PostRouteEventContext, type ResolvedArriConfig, type RouteEvent, type RouteEventContext, type RouteOptions, type Rpc, type RpcEvent, type RpcHandler, type RpcHandlerContext, type RpcParamSchema, type RpcPostEvent, type RpcPostHandler, type RpcPostHandlerContext, type StatusCode, createAppDefinition, createHttpRpcDefinition, defaultConfig, defineConfig, defineError, defineEventStreamRpc, defineMiddleware, defineRoute, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, handleRoute, isArriConfig, isEventStreamRpc, isResolvedArriConfig, isRpc, isRpcParamSchema, registerEventStreamRpc, registerRoute, registerRpc, validateRpcRequestInput };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { HttpMethod, RpcHttpMethod, RpcDefinition, SchemaFormProperties, SchemaFormDiscriminator, SchemaFormValues, AppDefinition, ClientGenerator } from 'arri-codegen-utils';
2
- import { AObjectSchema, ASchema, InferType, a, ValidationError, ValueError, ARecordSchema, ADiscriminatorSchema } from 'arri-validate';
1
+ import { HttpMethod, RpcHttpMethod, HttpRpcDefinition, SchemaFormProperties, SchemaFormDiscriminator, SchemaFormValues, AppDefinition, ClientGenerator } from 'arri-codegen-utils';
2
+ import { AObjectSchema, ASchema, InferType, a, ValidationError, ValueError, ADiscriminatorSchema } from 'arri-validate';
3
3
  import { H3EventContext, H3Event, Router, H3Error, App } from 'h3';
4
4
  export * from 'h3';
5
5
  import { EventStream } from 'h3-sse';
@@ -108,7 +108,7 @@ declare function registerEventStreamRpc(router: Router, path: string, procedure:
108
108
  name: string;
109
109
  }, opts: RouteOptions): void;
110
110
 
111
- type RpcParamSchema<TObjectInner = any, TRecordInner extends ASchema = any, TDiscriminatorInner = any> = AObjectSchema<TObjectInner> | ARecordSchema<TRecordInner> | ADiscriminatorSchema<TDiscriminatorInner>;
111
+ type RpcParamSchema<TObjectInner = any, TDiscriminatorInner = any> = AObjectSchema<TObjectInner> | ADiscriminatorSchema<TDiscriminatorInner>;
112
112
  declare function isRpcParamSchema(input: unknown): input is RpcParamSchema;
113
113
  interface NamedRpc<TIsEventStream extends boolean = false, TParams extends RpcParamSchema | undefined = undefined, TResponse extends RpcParamSchema | undefined = undefined> extends Rpc<TIsEventStream, TParams, TResponse> {
114
114
  name: string;
@@ -144,7 +144,7 @@ type RpcHandler<TParams, TResponse> = (context: RpcHandlerContext<TParams>, even
144
144
  type RpcPostHandler<TParams, TResponse> = (context: RpcPostHandlerContext<TParams, TResponse>, event: RpcPostEvent<TParams, TResponse>) => any;
145
145
  declare function isRpc(input: unknown): input is Rpc<any, any>;
146
146
  declare function defineRpc<TParams extends RpcParamSchema | undefined = undefined, TResponse extends RpcParamSchema | undefined | never = undefined>(config: HttpRpc<TParams, TResponse>): Rpc<false, TParams, TResponse>;
147
- declare function createRpcDefinition(rpcName: string, httpPath: string, procedure: Rpc<any, any, any>): RpcDefinition;
147
+ declare function createHttpRpcDefinition(rpcName: string, httpPath: string, procedure: Rpc<any, any, any>): HttpRpcDefinition;
148
148
  declare function getRpcPath(rpcName: string, prefix?: string): string;
149
149
  declare function getRpcParamName(rpcName: string, procedure: Rpc<any, any, any>): string | undefined;
150
150
  declare function getRpcResponseName(rpcName: string, procedure: Rpc<any, any, any>): string | undefined;
@@ -171,6 +171,7 @@ declare class ArriRouter implements ArriRouterBase {
171
171
  declare const DEV_ENDPOINT_ROOT = "/__arri_dev__";
172
172
  declare const DEV_DEFINITION_ENDPOINT = "/__arri_dev__/__definition";
173
173
  type ModelMap = Record<string, SchemaFormProperties | SchemaFormDiscriminator | SchemaFormValues>;
174
+ declare const createAppDefinition: (def: AppDefinition) => AppDefinition;
174
175
  declare class ArriApp implements ArriRouterBase {
175
176
  __isArri__: boolean;
176
177
  readonly h3App: App;
@@ -237,4 +238,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
237
238
  declare const defaultConfig: Required<ArriConfig>;
238
239
  declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
239
240
 
240
- export { ArriApp, type ArriConfig, type ArriOptions, type ArriRoute, ArriRouter, type ArriRouterBase, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, ErrorResponse, EventStreamConnection, type EventStreamConnectionOptions, type EventStreamRpc, type EventStreamRpcHandler, type EventStreamRpcHandlerContext, type ExtractParam, type ExtractParams, type HandlerContext, type HttpRpc, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ModelMap, type NamedRpc, type PostRouteEvent, type PostRouteEventContext, type ResolvedArriConfig, type RouteEvent, type RouteEventContext, type RouteOptions, type Rpc, type RpcEvent, type RpcHandler, type RpcHandlerContext, type RpcParamSchema, type RpcPostEvent, type RpcPostHandler, type RpcPostHandlerContext, type StatusCode, createRpcDefinition, defaultConfig, defineConfig, defineError, defineEventStreamRpc, defineMiddleware, defineRoute, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, handleRoute, isArriConfig, isEventStreamRpc, isResolvedArriConfig, isRpc, isRpcParamSchema, registerEventStreamRpc, registerRoute, registerRpc, validateRpcRequestInput };
241
+ export { ArriApp, type ArriConfig, type ArriOptions, type ArriRoute, ArriRouter, type ArriRouterBase, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, ErrorResponse, EventStreamConnection, type EventStreamConnectionOptions, type EventStreamRpc, type EventStreamRpcHandler, type EventStreamRpcHandlerContext, type ExtractParam, type ExtractParams, type HandlerContext, type HttpRpc, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ModelMap, type NamedRpc, type PostRouteEvent, type PostRouteEventContext, type ResolvedArriConfig, type RouteEvent, type RouteEventContext, type RouteOptions, type Rpc, type RpcEvent, type RpcHandler, type RpcHandlerContext, type RpcParamSchema, type RpcPostEvent, type RpcPostHandler, type RpcPostHandlerContext, type StatusCode, createAppDefinition, createHttpRpcDefinition, defaultConfig, defineConfig, defineError, defineEventStreamRpc, defineMiddleware, defineRoute, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, handleRoute, isArriConfig, isEventStreamRpc, isResolvedArriConfig, isRpc, isRpcParamSchema, registerEventStreamRpc, registerRoute, registerRpc, validateRpcRequestInput };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { HttpMethod, RpcHttpMethod, RpcDefinition, SchemaFormProperties, SchemaFormDiscriminator, SchemaFormValues, AppDefinition, ClientGenerator } from 'arri-codegen-utils';
2
- import { AObjectSchema, ASchema, InferType, a, ValidationError, ValueError, ARecordSchema, ADiscriminatorSchema } from 'arri-validate';
1
+ import { HttpMethod, RpcHttpMethod, HttpRpcDefinition, SchemaFormProperties, SchemaFormDiscriminator, SchemaFormValues, AppDefinition, ClientGenerator } from 'arri-codegen-utils';
2
+ import { AObjectSchema, ASchema, InferType, a, ValidationError, ValueError, ADiscriminatorSchema } from 'arri-validate';
3
3
  import { H3EventContext, H3Event, Router, H3Error, App } from 'h3';
4
4
  export * from 'h3';
5
5
  import { EventStream } from 'h3-sse';
@@ -108,7 +108,7 @@ declare function registerEventStreamRpc(router: Router, path: string, procedure:
108
108
  name: string;
109
109
  }, opts: RouteOptions): void;
110
110
 
111
- type RpcParamSchema<TObjectInner = any, TRecordInner extends ASchema = any, TDiscriminatorInner = any> = AObjectSchema<TObjectInner> | ARecordSchema<TRecordInner> | ADiscriminatorSchema<TDiscriminatorInner>;
111
+ type RpcParamSchema<TObjectInner = any, TDiscriminatorInner = any> = AObjectSchema<TObjectInner> | ADiscriminatorSchema<TDiscriminatorInner>;
112
112
  declare function isRpcParamSchema(input: unknown): input is RpcParamSchema;
113
113
  interface NamedRpc<TIsEventStream extends boolean = false, TParams extends RpcParamSchema | undefined = undefined, TResponse extends RpcParamSchema | undefined = undefined> extends Rpc<TIsEventStream, TParams, TResponse> {
114
114
  name: string;
@@ -144,7 +144,7 @@ type RpcHandler<TParams, TResponse> = (context: RpcHandlerContext<TParams>, even
144
144
  type RpcPostHandler<TParams, TResponse> = (context: RpcPostHandlerContext<TParams, TResponse>, event: RpcPostEvent<TParams, TResponse>) => any;
145
145
  declare function isRpc(input: unknown): input is Rpc<any, any>;
146
146
  declare function defineRpc<TParams extends RpcParamSchema | undefined = undefined, TResponse extends RpcParamSchema | undefined | never = undefined>(config: HttpRpc<TParams, TResponse>): Rpc<false, TParams, TResponse>;
147
- declare function createRpcDefinition(rpcName: string, httpPath: string, procedure: Rpc<any, any, any>): RpcDefinition;
147
+ declare function createHttpRpcDefinition(rpcName: string, httpPath: string, procedure: Rpc<any, any, any>): HttpRpcDefinition;
148
148
  declare function getRpcPath(rpcName: string, prefix?: string): string;
149
149
  declare function getRpcParamName(rpcName: string, procedure: Rpc<any, any, any>): string | undefined;
150
150
  declare function getRpcResponseName(rpcName: string, procedure: Rpc<any, any, any>): string | undefined;
@@ -171,6 +171,7 @@ declare class ArriRouter implements ArriRouterBase {
171
171
  declare const DEV_ENDPOINT_ROOT = "/__arri_dev__";
172
172
  declare const DEV_DEFINITION_ENDPOINT = "/__arri_dev__/__definition";
173
173
  type ModelMap = Record<string, SchemaFormProperties | SchemaFormDiscriminator | SchemaFormValues>;
174
+ declare const createAppDefinition: (def: AppDefinition) => AppDefinition;
174
175
  declare class ArriApp implements ArriRouterBase {
175
176
  __isArri__: boolean;
176
177
  readonly h3App: App;
@@ -237,4 +238,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
237
238
  declare const defaultConfig: Required<ArriConfig>;
238
239
  declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
239
240
 
240
- export { ArriApp, type ArriConfig, type ArriOptions, type ArriRoute, ArriRouter, type ArriRouterBase, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, ErrorResponse, EventStreamConnection, type EventStreamConnectionOptions, type EventStreamRpc, type EventStreamRpcHandler, type EventStreamRpcHandlerContext, type ExtractParam, type ExtractParams, type HandlerContext, type HttpRpc, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ModelMap, type NamedRpc, type PostRouteEvent, type PostRouteEventContext, type ResolvedArriConfig, type RouteEvent, type RouteEventContext, type RouteOptions, type Rpc, type RpcEvent, type RpcHandler, type RpcHandlerContext, type RpcParamSchema, type RpcPostEvent, type RpcPostHandler, type RpcPostHandlerContext, type StatusCode, createRpcDefinition, defaultConfig, defineConfig, defineError, defineEventStreamRpc, defineMiddleware, defineRoute, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, handleRoute, isArriConfig, isEventStreamRpc, isResolvedArriConfig, isRpc, isRpcParamSchema, registerEventStreamRpc, registerRoute, registerRpc, validateRpcRequestInput };
241
+ export { ArriApp, type ArriConfig, type ArriOptions, type ArriRoute, ArriRouter, type ArriRouterBase, DEV_DEFINITION_ENDPOINT, DEV_ENDPOINT_ROOT, ErrorResponse, EventStreamConnection, type EventStreamConnectionOptions, type EventStreamRpc, type EventStreamRpcHandler, type EventStreamRpcHandlerContext, type ExtractParam, type ExtractParams, type HandlerContext, type HttpRpc, type Middleware, type MiddlewareEvent, type MiddlewareEventContext, type ModelMap, type NamedRpc, type PostRouteEvent, type PostRouteEventContext, type ResolvedArriConfig, type RouteEvent, type RouteEventContext, type RouteOptions, type Rpc, type RpcEvent, type RpcHandler, type RpcHandlerContext, type RpcParamSchema, type RpcPostEvent, type RpcPostHandler, type RpcPostHandlerContext, type StatusCode, createAppDefinition, createHttpRpcDefinition, defaultConfig, defineConfig, defineError, defineEventStreamRpc, defineMiddleware, defineRoute, defineRpc, errorResponseFromValidationErrors, getRpcParamName, getRpcPath, getRpcResponseName, handleH3Error, handleRoute, isArriConfig, isEventStreamRpc, isResolvedArriConfig, isRpc, isRpcParamSchema, registerEventStreamRpc, registerRoute, registerRpc, validateRpcRequestInput };
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, x as EventStreamConnection, c as createRpcDefinition, n as defaultConfig, o as defineConfig, h as defineError, u as defineEventStreamRpc, 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, w as isEventStreamRpc, m as isResolvedArriConfig, b as isRpc, i as isRpcParamSchema, y as registerEventStreamRpc, s as registerRoute, r as registerRpc, v as validateRpcRequestInput } from './shared/arri.d9f65487.mjs';
1
+ export { A as ArriApp, q as ArriRouter, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ErrorResponse, y as EventStreamConnection, c as createAppDefinition, e as createHttpRpcDefinition, o as defaultConfig, p as defineConfig, j as defineError, w as defineEventStreamRpc, s as defineRoute, d as defineRpc, k as errorResponseFromValidationErrors, f as getRpcParamName, g as getRpcPath, h as getRpcResponseName, l as handleH3Error, u as handleRoute, m as isArriConfig, x as isEventStreamRpc, n as isResolvedArriConfig, b as isRpc, i as isRpcParamSchema, z as registerEventStreamRpc, t as registerRoute, r as registerRpc, v as validateRpcRequestInput } from './shared/arri.e9a56e75.mjs';
2
2
  export * from 'h3';
3
3
  import 'arri-codegen-utils';
4
4
  import 'arri-validate';
@@ -212,7 +212,7 @@ async function handleH3Error(err, event, onError) {
212
212
  }
213
213
 
214
214
  function isRpcParamSchema(input) {
215
- return arriValidate.isAObjectSchema(input) || arriValidate.isARecordSchema(input) || arriValidate.isADiscriminatorSchema(input);
215
+ return arriValidate.isAObjectSchema(input) || arriValidate.isADiscriminatorSchema(input);
216
216
  }
217
217
  function isRpc(input) {
218
218
  return typeof input === "object" && input !== null && "method" in input && arriCodegenUtils.isRpcHttpMethod(input.method) && "handler" in input && typeof input.handler === "function";
@@ -220,7 +220,7 @@ function isRpc(input) {
220
220
  function defineRpc(config) {
221
221
  return config;
222
222
  }
223
- function createRpcDefinition(rpcName, httpPath, procedure) {
223
+ function createHttpRpcDefinition(rpcName, httpPath, procedure) {
224
224
  let method;
225
225
  if (procedure.isEventStream === true) {
226
226
  method = procedure.method ?? "get";
@@ -228,6 +228,7 @@ function createRpcDefinition(rpcName, httpPath, procedure) {
228
228
  method = procedure.method ?? "post";
229
229
  }
230
230
  return {
231
+ transport: "http",
231
232
  description: procedure.description,
232
233
  path: httpPath,
233
234
  method,
@@ -808,6 +809,7 @@ var __publicField = (obj, key, value) => {
808
809
  };
809
810
  const DEV_ENDPOINT_ROOT = `/__arri_dev__`;
810
811
  const DEV_DEFINITION_ENDPOINT = `${DEV_ENDPOINT_ROOT}/__definition`;
812
+ const createAppDefinition = (def) => def;
811
813
  class ArriApp {
812
814
  constructor(opts = {}) {
813
815
  __publicField(this, "__isArri__", true);
@@ -884,7 +886,7 @@ class ArriApp {
884
886
  }
885
887
  rpc(procedure) {
886
888
  const path = procedure.path ?? getRpcPath(procedure.name, this.rpcRoutePrefix);
887
- this.procedures[procedure.name] = createRpcDefinition(
889
+ this.procedures[procedure.name] = createHttpRpcDefinition(
888
890
  procedure.name,
889
891
  path,
890
892
  procedure
@@ -997,7 +999,8 @@ exports.DEV_DEFINITION_ENDPOINT = DEV_DEFINITION_ENDPOINT;
997
999
  exports.DEV_ENDPOINT_ROOT = DEV_ENDPOINT_ROOT;
998
1000
  exports.ErrorResponse = ErrorResponse;
999
1001
  exports.EventStreamConnection = EventStreamConnection;
1000
- exports.createRpcDefinition = createRpcDefinition;
1002
+ exports.createAppDefinition = createAppDefinition;
1003
+ exports.createHttpRpcDefinition = createHttpRpcDefinition;
1001
1004
  exports.defaultConfig = defaultConfig;
1002
1005
  exports.defineConfig = defineConfig;
1003
1006
  exports.defineError = defineError;
@@ -1,6 +1,6 @@
1
1
  import { isRpcHttpMethod, removeDisallowedChars, SCHEMA_VERSION } from 'arri-codegen-utils';
2
2
  import { createError, isError, setResponseStatus, send, eventHandler, isPreflightRequest, setResponseHeader, readRawBody, getValidatedQuery, defineEventHandler, getQuery, setHeader, createRouter, createApp, sendError } from 'h3';
3
- import { a, isAObjectSchema, isARecordSchema, isADiscriminatorSchema } from 'arri-validate';
3
+ import { a, isAObjectSchema, isADiscriminatorSchema } from 'arri-validate';
4
4
  import { createEventStream } from 'h3-sse';
5
5
  import { kebabCase, pascalCase } from 'scule';
6
6
 
@@ -210,7 +210,7 @@ async function handleH3Error(err, event, onError) {
210
210
  }
211
211
 
212
212
  function isRpcParamSchema(input) {
213
- return isAObjectSchema(input) || isARecordSchema(input) || isADiscriminatorSchema(input);
213
+ return isAObjectSchema(input) || isADiscriminatorSchema(input);
214
214
  }
215
215
  function isRpc(input) {
216
216
  return typeof input === "object" && input !== null && "method" in input && isRpcHttpMethod(input.method) && "handler" in input && typeof input.handler === "function";
@@ -218,7 +218,7 @@ function isRpc(input) {
218
218
  function defineRpc(config) {
219
219
  return config;
220
220
  }
221
- function createRpcDefinition(rpcName, httpPath, procedure) {
221
+ function createHttpRpcDefinition(rpcName, httpPath, procedure) {
222
222
  let method;
223
223
  if (procedure.isEventStream === true) {
224
224
  method = procedure.method ?? "get";
@@ -226,6 +226,7 @@ function createRpcDefinition(rpcName, httpPath, procedure) {
226
226
  method = procedure.method ?? "post";
227
227
  }
228
228
  return {
229
+ transport: "http",
229
230
  description: procedure.description,
230
231
  path: httpPath,
231
232
  method,
@@ -806,6 +807,7 @@ var __publicField = (obj, key, value) => {
806
807
  };
807
808
  const DEV_ENDPOINT_ROOT = `/__arri_dev__`;
808
809
  const DEV_DEFINITION_ENDPOINT = `${DEV_ENDPOINT_ROOT}/__definition`;
810
+ const createAppDefinition = (def) => def;
809
811
  class ArriApp {
810
812
  constructor(opts = {}) {
811
813
  __publicField(this, "__isArri__", true);
@@ -882,7 +884,7 @@ class ArriApp {
882
884
  }
883
885
  rpc(procedure) {
884
886
  const path = procedure.path ?? getRpcPath(procedure.name, this.rpcRoutePrefix);
885
- this.procedures[procedure.name] = createRpcDefinition(
887
+ this.procedures[procedure.name] = createHttpRpcDefinition(
886
888
  procedure.name,
887
889
  path,
888
890
  procedure
@@ -989,4 +991,4 @@ function defineConfig(config) {
989
991
  };
990
992
  }
991
993
 
992
- export { ArriApp as A, DEV_ENDPOINT_ROOT as D, ErrorResponse as E, DEV_DEFINITION_ENDPOINT as a, isRpc as b, createRpcDefinition as c, defineRpc as d, getRpcParamName as e, getRpcResponseName as f, getRpcPath as g, defineError as h, isRpcParamSchema as i, errorResponseFromValidationErrors as j, handleH3Error as k, isArriConfig as l, isResolvedArriConfig as m, defaultConfig as n, defineConfig as o, ArriRouter as p, defineRoute as q, registerRpc as r, registerRoute as s, handleRoute as t, defineEventStreamRpc as u, validateRpcRequestInput as v, isEventStreamRpc as w, EventStreamConnection as x, registerEventStreamRpc as y };
994
+ export { ArriApp as A, DEV_ENDPOINT_ROOT as D, ErrorResponse as E, DEV_DEFINITION_ENDPOINT as a, isRpc as b, createAppDefinition as c, defineRpc as d, createHttpRpcDefinition as e, getRpcParamName as f, getRpcPath as g, getRpcResponseName as h, isRpcParamSchema as i, defineError as j, errorResponseFromValidationErrors as k, handleH3Error as l, isArriConfig as m, isResolvedArriConfig as n, defaultConfig as o, defineConfig as p, ArriRouter as q, registerRpc as r, defineRoute as s, registerRoute as t, handleRoute as u, validateRpcRequestInput as v, defineEventStreamRpc as w, isEventStreamRpc as x, EventStreamConnection as y, registerEventStreamRpc as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arri",
3
- "version": "0.29.0",
3
+ "version": "0.31.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -42,10 +42,10 @@
42
42
  "prettier": "^3.2.5",
43
43
  "scule": "^1.3.0",
44
44
  "uncrypto": "^0.1.3",
45
- "arri-codegen-ts": "0.29.0",
46
- "arri-codegen-dart": "0.29.0",
47
- "arri-validate": "0.29.0",
48
- "arri-codegen-utils": "0.29.0"
45
+ "arri-codegen-dart": "0.31.0",
46
+ "arri-codegen-ts": "0.31.0",
47
+ "arri-codegen-utils": "0.31.0",
48
+ "arri-validate": "0.31.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/degit": "^2.8.6",