@trpc/server 10.36.0 → 10.37.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.
@@ -1 +1 @@
1
- {"version":3,"file":"getParseFn.d.ts","sourceRoot":"","sources":["../../../src/core/internals/getParseFn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,MAAM,OAAO,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;AAExE,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAqCzE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAC3C,eAAe,EAAE,MAAM,GAAG,SAAS,GAClC,OAAO,CAAC,KAAK,CAAC,CAKhB"}
1
+ {"version":3,"file":"getParseFn.d.ts","sourceRoot":"","sources":["../../../src/core/internals/getParseFn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,MAAM,OAAO,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;AAExE,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAsCzE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAC3C,eAAe,EAAE,MAAM,GAAG,SAAS,GAClC,OAAO,CAAC,KAAK,CAAC,CAKhB"}
@@ -2,6 +2,12 @@ export type ParserZodEsque<TInput, TParsedInput> = {
2
2
  _input: TInput;
3
3
  _output: TParsedInput;
4
4
  };
5
+ export type ParserValibotEsque<TInput, TParsedInput> = {
6
+ types?: {
7
+ input: TInput;
8
+ output: TParsedInput;
9
+ };
10
+ };
5
11
  export type ParserMyZodEsque<TInput> = {
6
12
  parse: (input: any) => TInput;
7
13
  };
@@ -16,7 +22,7 @@ export type ParserScaleEsque<TInput> = {
16
22
  assert(value: unknown): asserts value is TInput;
17
23
  };
18
24
  export type ParserWithoutInput<TInput> = ParserCustomValidatorEsque<TInput> | ParserMyZodEsque<TInput> | ParserScaleEsque<TInput> | ParserSuperstructEsque<TInput> | ParserYupEsque<TInput>;
19
- export type ParserWithInputOutput<TInput, TParsedInput> = ParserZodEsque<TInput, TParsedInput>;
25
+ export type ParserWithInputOutput<TInput, TParsedInput> = ParserZodEsque<TInput, TParsedInput> | ParserValibotEsque<TInput, TParsedInput>;
20
26
  export type Parser = ParserWithInputOutput<any, any> | ParserWithoutInput<any>;
21
27
  export type inferParser<TParser extends Parser> = TParser extends ParserWithInputOutput<infer $TIn, infer $TOut> ? {
22
28
  in: $TIn;
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/core/parser.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,CAAC,MAAM,EAAE,YAAY,IAAI;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,MAAM,IAAI;IACrC,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,MAAM,IAAI;IAC3C,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAAC,MAAM,IAAI,CAC/C,KAAK,EAAE,OAAO,KACX,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAE9B,MAAM,MAAM,cAAc,CAAC,MAAM,IAAI;IACnC,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;CAC1C,CAAC;AA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AK,CAAC;CACZ,GACD,OAAO,SAAS,kBAAkB,CAAC,MAAM,MAAM,CAAC,GAChD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb,GACD,KAAK,CAAC"}
package/dist/index.js CHANGED
@@ -185,23 +185,24 @@ function createProcedure(opts) {
185
185
  function getParseFn(procedureParser) {
186
186
  const parser = procedureParser;
187
187
  if (typeof parser === 'function') {
188
- // ProcedureParserCustomValidatorEsque
188
+ // ParserCustomValidatorEsque
189
189
  return parser;
190
190
  }
191
191
  if (typeof parser.parseAsync === 'function') {
192
- // ProcedureParserZodEsque
192
+ // ParserZodEsque
193
193
  return parser.parseAsync.bind(parser);
194
194
  }
195
195
  if (typeof parser.parse === 'function') {
196
- // ProcedureParserZodEsque
196
+ // ParserZodEsque
197
+ // ParserValibotEsque
197
198
  return parser.parse.bind(parser);
198
199
  }
199
200
  if (typeof parser.validateSync === 'function') {
200
- // ProcedureParserYupEsque
201
+ // ParserYupEsque
201
202
  return parser.validateSync.bind(parser);
202
203
  }
203
204
  if (typeof parser.create === 'function') {
204
- // ProcedureParserSuperstructEsque
205
+ // ParserSuperstructEsque
205
206
  return parser.create.bind(parser);
206
207
  }
207
208
  if (typeof parser.assert === 'function') {
package/dist/index.mjs CHANGED
@@ -183,23 +183,24 @@ function createProcedure(opts) {
183
183
  function getParseFn(procedureParser) {
184
184
  const parser = procedureParser;
185
185
  if (typeof parser === 'function') {
186
- // ProcedureParserCustomValidatorEsque
186
+ // ParserCustomValidatorEsque
187
187
  return parser;
188
188
  }
189
189
  if (typeof parser.parseAsync === 'function') {
190
- // ProcedureParserZodEsque
190
+ // ParserZodEsque
191
191
  return parser.parseAsync.bind(parser);
192
192
  }
193
193
  if (typeof parser.parse === 'function') {
194
- // ProcedureParserZodEsque
194
+ // ParserZodEsque
195
+ // ParserValibotEsque
195
196
  return parser.parse.bind(parser);
196
197
  }
197
198
  if (typeof parser.validateSync === 'function') {
198
- // ProcedureParserYupEsque
199
+ // ParserYupEsque
199
200
  return parser.validateSync.bind(parser);
200
201
  }
201
202
  if (typeof parser.create === 'function') {
202
- // ProcedureParserSuperstructEsque
203
+ // ParserSuperstructEsque
203
204
  return parser.create.bind(parser);
204
205
  }
205
206
  if (typeof parser.assert === 'function') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/server",
3
- "version": "10.36.0",
3
+ "version": "10.37.0",
4
4
  "description": "The tRPC server library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -165,6 +165,7 @@
165
165
  "tslib": "^2.5.0",
166
166
  "tsx": "^3.12.7",
167
167
  "typescript": "^5.1.3",
168
+ "valibot": "^0.8.0",
168
169
  "vitest": "^0.32.0",
169
170
  "ws": "^8.0.0",
170
171
  "yup": "^1.0.0",
@@ -173,5 +174,5 @@
173
174
  "funding": [
174
175
  "https://trpc.io/sponsor"
175
176
  ],
176
- "gitHead": "72b35dfc9ef2f33f15c87e8200414716cab5ee8c"
177
+ "gitHead": "5ffd21ca8d2ff505fef105db15b1e5e299e4ba19"
177
178
  }
@@ -6,27 +6,28 @@ export function getParseFn<TType>(procedureParser: Parser): ParseFn<TType> {
6
6
  const parser = procedureParser as any;
7
7
 
8
8
  if (typeof parser === 'function') {
9
- // ProcedureParserCustomValidatorEsque
9
+ // ParserCustomValidatorEsque
10
10
  return parser;
11
11
  }
12
12
 
13
13
  if (typeof parser.parseAsync === 'function') {
14
- // ProcedureParserZodEsque
14
+ // ParserZodEsque
15
15
  return parser.parseAsync.bind(parser);
16
16
  }
17
17
 
18
18
  if (typeof parser.parse === 'function') {
19
- // ProcedureParserZodEsque
19
+ // ParserZodEsque
20
+ // ParserValibotEsque
20
21
  return parser.parse.bind(parser);
21
22
  }
22
23
 
23
24
  if (typeof parser.validateSync === 'function') {
24
- // ProcedureParserYupEsque
25
+ // ParserYupEsque
25
26
  return parser.validateSync.bind(parser);
26
27
  }
27
28
 
28
29
  if (typeof parser.create === 'function') {
29
- // ProcedureParserSuperstructEsque
30
+ // ParserSuperstructEsque
30
31
  return parser.create.bind(parser);
31
32
  }
32
33
 
@@ -3,6 +3,13 @@ export type ParserZodEsque<TInput, TParsedInput> = {
3
3
  _output: TParsedInput;
4
4
  };
5
5
 
6
+ export type ParserValibotEsque<TInput, TParsedInput> = {
7
+ types?: {
8
+ input: TInput;
9
+ output: TParsedInput;
10
+ };
11
+ };
12
+
6
13
  export type ParserMyZodEsque<TInput> = {
7
14
  parse: (input: any) => TInput;
8
15
  };
@@ -30,10 +37,9 @@ export type ParserWithoutInput<TInput> =
30
37
  | ParserSuperstructEsque<TInput>
31
38
  | ParserYupEsque<TInput>;
32
39
 
33
- export type ParserWithInputOutput<TInput, TParsedInput> = ParserZodEsque<
34
- TInput,
35
- TParsedInput
36
- >;
40
+ export type ParserWithInputOutput<TInput, TParsedInput> =
41
+ | ParserZodEsque<TInput, TParsedInput>
42
+ | ParserValibotEsque<TInput, TParsedInput>;
37
43
 
38
44
  export type Parser = ParserWithInputOutput<any, any> | ParserWithoutInput<any>;
39
45