@veloxts/web 0.6.102 → 0.6.104

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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @veloxts/web
2
2
 
3
+ ## 0.6.104
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(client): smart convention-based route inference, eliminate routes.ts
8
+ - Updated dependencies
9
+ - @veloxts/auth@0.6.104
10
+ - @veloxts/client@0.6.104
11
+ - @veloxts/core@0.6.104
12
+ - @veloxts/router@0.6.104
13
+
14
+ ## 0.6.103
15
+
16
+ ### Patch Changes
17
+
18
+ - chore(deps): upgrade Zod from v3 to v4
19
+ - Updated dependencies
20
+ - @veloxts/auth@0.6.103
21
+ - @veloxts/client@0.6.103
22
+ - @veloxts/core@0.6.103
23
+ - @veloxts/router@0.6.103
24
+
3
25
  ## 0.6.102
4
26
 
5
27
  ### Patch Changes
@@ -35,7 +35,7 @@
35
35
  */
36
36
  import type { BaseContext } from '@veloxts/core';
37
37
  import type { CompiledProcedure } from '@veloxts/router';
38
- import { type infer as ZodInfer, type ZodSchema, type ZodType, type ZodTypeDef } from 'zod';
38
+ import { type infer as ZodInfer, type ZodType } from 'zod';
39
39
  import { type H3ActionContext } from '../adapters/h3-adapter.js';
40
40
  import { type ExecuteProcedureOptions } from './procedure-bridge.js';
41
41
  import type { ActionContext, ActionError, ActionErrorCode, ActionResult, ActionSuccess, AuthenticatedActionContext } from './types.js';
@@ -60,8 +60,8 @@ type ValidatedAction<TInput, TOutput> = (input: TInput) => Promise<ActionResult<
60
60
  * @public
61
61
  */
62
62
  interface ActionConfig<TInput, TOutput, TContext extends ActionContext> {
63
- inputSchema?: ZodSchema<TInput>;
64
- outputSchema?: ZodSchema<TOutput>;
63
+ inputSchema?: ZodType<TInput>;
64
+ outputSchema?: ZodType<TOutput>;
65
65
  requireAuth: boolean;
66
66
  onError?: ErrorHandler<TContext>;
67
67
  }
@@ -141,7 +141,7 @@ interface ActionBuilder<TInput = unknown, TOutput = unknown, TContext extends Ac
141
141
  * .run(async ({ id }) => { ... });
142
142
  * ```
143
143
  */
144
- input<TSchema extends ZodType<unknown, ZodTypeDef, unknown>>(schema: TSchema): ActionBuilder<ZodInfer<TSchema>, TOutput, TContext>;
144
+ input<TSchema extends ZodType>(schema: TSchema): ActionBuilder<ZodInfer<TSchema>, TOutput, TContext>;
145
145
  /**
146
146
  * Sets the output validation schema.
147
147
  * Validates the handler's return value at runtime.
@@ -154,7 +154,7 @@ interface ActionBuilder<TInput = unknown, TOutput = unknown, TContext extends Ac
154
154
  * .run(async (input) => { ... });
155
155
  * ```
156
156
  */
157
- output<TSchema extends ZodType<unknown, ZodTypeDef, unknown>>(schema: TSchema): ActionBuilder<TInput, ZodInfer<TSchema>, TContext>;
157
+ output<TSchema extends ZodType>(schema: TSchema): ActionBuilder<TInput, ZodInfer<TSchema>, TContext>;
158
158
  /**
159
159
  * Marks the action as requiring authentication.
160
160
  * The context will include the authenticated user.
@@ -230,7 +230,7 @@ interface Action {
230
230
  * });
231
231
  * ```
232
232
  */
233
- <TSchema extends ZodType<unknown, ZodTypeDef, unknown>, TOutput>(schema: TSchema, handler: ActionHandlerFn<ZodInfer<TSchema>, TOutput, ActionContext>): ValidatedAction<ZodInfer<TSchema>, TOutput>;
233
+ <TSchema extends ZodType, TOutput>(schema: TSchema, handler: ActionHandlerFn<ZodInfer<TSchema>, TOutput, ActionContext>): ValidatedAction<ZodInfer<TSchema>, TOutput>;
234
234
  /**
235
235
  * Creates a builder for fluent action configuration.
236
236
  *
@@ -245,12 +245,12 @@ interface Action {
245
245
  * });
246
246
  * ```
247
247
  */
248
- input<TSchema extends ZodType<unknown, ZodTypeDef, unknown>>(schema: TSchema): ActionBuilder<ZodInfer<TSchema>, unknown, ActionContext>;
248
+ input<TSchema extends ZodType>(schema: TSchema): ActionBuilder<ZodInfer<TSchema>, unknown, ActionContext>;
249
249
  /**
250
250
  * Creates a builder starting with output schema.
251
251
  * Useful when input is not needed (e.g., queries).
252
252
  */
253
- output<TSchema extends ZodType<unknown, ZodTypeDef, unknown>>(schema: TSchema): ActionBuilder<unknown, ZodInfer<TSchema>, ActionContext>;
253
+ output<TSchema extends ZodType>(schema: TSchema): ActionBuilder<unknown, ZodInfer<TSchema>, ActionContext>;
254
254
  /**
255
255
  * Creates a protected action builder (requires authentication).
256
256
  */
@@ -33,7 +33,7 @@
33
33
  * });
34
34
  * ```
35
35
  */
36
- import { ZodError, } from 'zod';
36
+ import { ZodError } from 'zod';
37
37
  import { createH3Context, isH3Context } from '../adapters/h3-adapter.js';
38
38
  import { toActionError } from './error-classifier.js';
39
39
  import { formDataToObject } from './form-parser.js';
@@ -68,8 +68,8 @@ function fail(code, message, details) {
68
68
  function formatZodError(err) {
69
69
  if (err instanceof ZodError) {
70
70
  return fail('VALIDATION_ERROR', 'Validation failed', {
71
- errors: err.errors.map((e) => ({
72
- path: e.path.join('.'),
71
+ errors: err.issues.map((e) => ({
72
+ path: e.path.filter((p) => typeof p !== 'symbol').join('.'),
73
73
  message: e.message,
74
74
  })),
75
75
  });
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @module @veloxts/web/actions/bridge
8
8
  */
9
- import type { ZodSchema } from 'zod';
9
+ import type { ZodType } from 'zod';
10
10
  import type { ActionContext, ActionErrorCode, ActionResult, CallableAction, TrpcBridgeOptions } from './types.js';
11
11
  /**
12
12
  * Extracts all valid procedure paths from a tRPC router type.
@@ -188,11 +188,11 @@ export interface TrpcActionOptions<TInput, TOutput> {
188
188
  /**
189
189
  * Zod schema for input validation (before sending to tRPC)
190
190
  */
191
- input?: ZodSchema<TInput>;
191
+ input?: ZodType<TInput>;
192
192
  /**
193
193
  * Zod schema for output validation (after receiving from tRPC)
194
194
  */
195
- output?: ZodSchema<TOutput>;
195
+ output?: ZodType<TOutput>;
196
196
  /**
197
197
  * Whether authentication is required
198
198
  * @default false
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * @module @veloxts/web/actions/form-parser
9
9
  */
10
- import type { ZodSchema } from 'zod';
10
+ import type { ZodType } from 'zod';
11
11
  import type { ActionResult } from './types.js';
12
12
  /**
13
13
  * Options for parsing FormData
@@ -93,11 +93,11 @@ export declare function formDataToObject(formData: FormData, options?: FormParse
93
93
  * }
94
94
  * ```
95
95
  */
96
- export declare function parseFormDataToSchema<T>(formData: FormData, schema: ZodSchema<T>, options?: FormParseOptions): ActionResult<T>;
96
+ export declare function parseFormDataToSchema<T>(formData: FormData, schema: ZodType<T>, options?: FormParseOptions): ActionResult<T>;
97
97
  /**
98
98
  * Async version of parseFormDataToSchema for schemas with async refinements.
99
99
  */
100
- export declare function parseFormDataToSchemaAsync<T>(formData: FormData, schema: ZodSchema<T>, options?: FormParseOptions): Promise<ActionResult<T>>;
100
+ export declare function parseFormDataToSchemaAsync<T>(formData: FormData, schema: ZodType<T>, options?: FormParseOptions): Promise<ActionResult<T>>;
101
101
  /**
102
102
  * Type guard to check if a value is FormData.
103
103
  */
@@ -95,8 +95,8 @@ async function validateInput(schema, input) {
95
95
  catch (err) {
96
96
  if (err instanceof ZodError) {
97
97
  return error('VALIDATION_ERROR', 'Input validation failed', {
98
- errors: err.errors.map((e) => ({
99
- path: e.path.join('.'),
98
+ errors: err.issues.map((e) => ({
99
+ path: e.path.filter((p) => typeof p !== 'symbol').join('.'),
100
100
  message: e.message,
101
101
  })),
102
102
  });
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @module @veloxts/web/actions/types
7
7
  */
8
- import type { ZodSchema, ZodType } from 'zod';
8
+ import type { ZodType } from 'zod';
9
9
  import type { ActionError, ActionErrorCode, ActionResult, ActionSuccess } from '../types/actions.js';
10
10
  export type { ActionError, ActionErrorCode, ActionResult, ActionSuccess };
11
11
  /**
@@ -69,11 +69,11 @@ export interface CreateActionOptions<TInput, TOutput> {
69
69
  /**
70
70
  * Zod schema for input validation
71
71
  */
72
- input?: ZodSchema<TInput>;
72
+ input?: ZodType<TInput>;
73
73
  /**
74
74
  * Zod schema for output validation
75
75
  */
76
- output?: ZodSchema<TOutput>;
76
+ output?: ZodType<TOutput>;
77
77
  /**
78
78
  * Whether authentication is required
79
79
  * @default false
@@ -230,11 +230,11 @@ export interface ActionBuilder<TInput, TOutput, TContext extends ActionContext>
230
230
  /**
231
231
  * Set input validation schema
232
232
  */
233
- input<TNewInput>(schema: ZodSchema<TNewInput>): ActionBuilder<TNewInput, TOutput, TContext>;
233
+ input<TNewInput>(schema: ZodType<TNewInput>): ActionBuilder<TNewInput, TOutput, TContext>;
234
234
  /**
235
235
  * Set output validation schema
236
236
  */
237
- output<TNewOutput>(schema: ZodSchema<TNewOutput>): ActionBuilder<TInput, TNewOutput, TContext>;
237
+ output<TNewOutput>(schema: ZodType<TNewOutput>): ActionBuilder<TInput, TNewOutput, TContext>;
238
238
  /**
239
239
  * Require authentication
240
240
  */
@@ -8,16 +8,22 @@
8
8
  *
9
9
  * @module @veloxts/web/actions/validated
10
10
  */
11
- import { type ZodType, type ZodTypeDef } from 'zod';
11
+ import { type ZodType } from 'zod';
12
12
  import type { ActionContext, ActionError, ActionResult, AuthenticatedActionContext } from './types.js';
13
13
  /**
14
14
  * Constraint for valid Zod schemas
15
+ * Uses structural typing to work with both Zod 3 and Zod 4.
15
16
  */
16
- export type ValidZodSchema<T = unknown> = ZodType<T, ZodTypeDef, unknown>;
17
+ export type ValidZodSchema<T = unknown> = ZodType & {
18
+ parse: (data: unknown) => T;
19
+ };
17
20
  /**
18
21
  * Infers the output type from a Zod schema
22
+ * Uses structural matching on parse() return type for cross-version compatibility.
19
23
  */
20
- export type InferSchemaType<TSchema> = TSchema extends ZodType<infer O, ZodTypeDef, unknown> ? O : never;
24
+ export type InferSchemaType<TSchema> = TSchema extends {
25
+ parse: (data: unknown) => infer O;
26
+ } ? O : never;
21
27
  /**
22
28
  * Handler function signature for validated actions
23
29
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veloxts/web",
3
- "version": "0.6.102",
3
+ "version": "0.6.104",
4
4
  "description": "React Server Components integration for VeloxTS framework using Vinxi",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -67,15 +67,15 @@
67
67
  "radix3": "1.1.2",
68
68
  "vinxi": "0.5.11",
69
69
  "vite-tsconfig-paths": "6.0.5",
70
- "zod": "3.25.76"
70
+ "zod": "4.3.6"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "react": ">=19.2.0",
74
74
  "react-dom": ">=19.2.0",
75
- "@veloxts/auth": "0.6.102",
76
- "@veloxts/client": "0.6.102",
77
- "@veloxts/core": "0.6.102",
78
- "@veloxts/router": "0.6.102"
75
+ "@veloxts/auth": "0.6.104",
76
+ "@veloxts/router": "0.6.104",
77
+ "@veloxts/core": "0.6.104",
78
+ "@veloxts/client": "0.6.104"
79
79
  },
80
80
  "peerDependenciesMeta": {
81
81
  "@veloxts/auth": {
@@ -98,10 +98,10 @@
98
98
  "react-server-dom-webpack": "19.2.4",
99
99
  "typescript": "5.9.3",
100
100
  "vitest": "4.0.18",
101
- "@veloxts/auth": "0.6.102",
102
- "@veloxts/core": "0.6.102",
103
- "@veloxts/client": "0.6.102",
104
- "@veloxts/router": "0.6.102"
101
+ "@veloxts/auth": "0.6.104",
102
+ "@veloxts/core": "0.6.104",
103
+ "@veloxts/client": "0.6.104",
104
+ "@veloxts/router": "0.6.104"
105
105
  },
106
106
  "keywords": [
107
107
  "velox",