@arrirpc/typebox-adapter 0.71.1 → 0.72.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/README.md CHANGED
@@ -1,7 +1,3 @@
1
- ## NOTICE:
2
-
3
- Currently not in development. Doesn't work with latest Arri version or Typescript version. I may resurrect this down the road if I have time. Although I probably will want to rethink the proper way to approach supporting different validation libraries (i.e. TypeBox, Zod, etc)
4
-
5
1
  # Arri Typebox Adapter
6
2
 
7
3
  Let's you reuse your [Typebox](https://github.com/sinclairzx81/typebox) schemas with Arri-RPC
@@ -20,9 +16,9 @@ Simply wrap your typebox schemas with `typeboxAdapter()` to use them with arrirp
20
16
 
21
17
  ```ts
22
18
  // updateUser.rpc.ts
23
- import { defineRpc } from "@arrirpc/server";
24
- import { typeboxAdapter } from "@arrripc/typebox-adapter";
25
- import { Type } from "typebox";
19
+ import { defineRpc } from '@arrirpc/server';
20
+ import { typeboxAdapter } from '@arrripc/typebox-adapter';
21
+ import { Type } from 'typebox';
26
22
 
27
23
  const User = Type.Object(
28
24
  {
@@ -30,7 +26,7 @@ const User = Type.Object(
30
26
  name: Type.String(),
31
27
  },
32
28
  {
33
- $id: "User",
29
+ $id: 'User',
34
30
  },
35
31
  );
36
32
 
package/dist/index.d.cts CHANGED
@@ -1,6 +1,11 @@
1
1
  import { AObjectSchema, ASchema } from '@arrirpc/schema';
2
- import { TSchema, TObject, Static } from '@sinclair/typebox';
2
+ import { TSchema, TObject } from '@sinclair/typebox';
3
3
 
4
- declare function typeboxAdapter<TInput extends TSchema>(input: TInput): TInput extends TObject ? AObjectSchema<Static<TInput>> : ASchema<Static<TInput>>;
4
+ type CleanedTSchema = Omit<TSchema, symbol>;
5
+ type CleanedStatic<T extends CleanedTSchema, P extends unknown[] = []> = (T & {
6
+ params: P;
7
+ })['static'];
8
+ type CleanedTObject = Omit<TObject, symbol>;
9
+ declare function typeboxAdapter<TInput extends CleanedTSchema>(input: TInput): TInput extends CleanedTObject ? AObjectSchema<CleanedStatic<TInput>> : ASchema<CleanedStatic<TInput>>;
5
10
 
6
- export { typeboxAdapter };
11
+ export { type CleanedStatic, typeboxAdapter };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,11 @@
1
1
  import { AObjectSchema, ASchema } from '@arrirpc/schema';
2
- import { TSchema, TObject, Static } from '@sinclair/typebox';
2
+ import { TSchema, TObject } from '@sinclair/typebox';
3
3
 
4
- declare function typeboxAdapter<TInput extends TSchema>(input: TInput): TInput extends TObject ? AObjectSchema<Static<TInput>> : ASchema<Static<TInput>>;
4
+ type CleanedTSchema = Omit<TSchema, symbol>;
5
+ type CleanedStatic<T extends CleanedTSchema, P extends unknown[] = []> = (T & {
6
+ params: P;
7
+ })['static'];
8
+ type CleanedTObject = Omit<TObject, symbol>;
9
+ declare function typeboxAdapter<TInput extends CleanedTSchema>(input: TInput): TInput extends CleanedTObject ? AObjectSchema<CleanedStatic<TInput>> : ASchema<CleanedStatic<TInput>>;
5
10
 
6
- export { typeboxAdapter };
11
+ export { type CleanedStatic, typeboxAdapter };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  import { AObjectSchema, ASchema } from '@arrirpc/schema';
2
- import { TSchema, TObject, Static } from '@sinclair/typebox';
2
+ import { TSchema, TObject } from '@sinclair/typebox';
3
3
 
4
- declare function typeboxAdapter<TInput extends TSchema>(input: TInput): TInput extends TObject ? AObjectSchema<Static<TInput>> : ASchema<Static<TInput>>;
4
+ type CleanedTSchema = Omit<TSchema, symbol>;
5
+ type CleanedStatic<T extends CleanedTSchema, P extends unknown[] = []> = (T & {
6
+ params: P;
7
+ })['static'];
8
+ type CleanedTObject = Omit<TObject, symbol>;
9
+ declare function typeboxAdapter<TInput extends CleanedTSchema>(input: TInput): TInput extends CleanedTObject ? AObjectSchema<CleanedStatic<TInput>> : ASchema<CleanedStatic<TInput>>;
5
10
 
6
- export { typeboxAdapter };
11
+ export { type CleanedStatic, typeboxAdapter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrirpc/typebox-adapter",
3
- "version": "0.71.1",
3
+ "version": "0.72.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -22,11 +22,11 @@
22
22
  "directory": "languages/ts/ts-schema-typebox-adapter"
23
23
  },
24
24
  "dependencies": {
25
- "json-schema-to-atd": "0.71.1",
26
- "@arrirpc/schema": "0.71.1"
25
+ "@arrirpc/schema": "0.72.0",
26
+ "json-schema-to-atd": "0.72.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@arrirpc/server": "0.71.1"
29
+ "@arrirpc/server": "0.72.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@sinclair/typebox": "^0.32"