@orpc/arktype 1.14.11 → 1.14.12
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 +77 -52
- package/dist/index.d.mts +8 -11
- package/dist/index.d.ts +8 -11
- package/dist/index.mjs +19 -46
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
<
|
|
1
|
+
<div align="center">
|
|
2
|
+
<image align="center" src="https://orpc.dev/logo.webp" width=280 alt="oRPC logo" />
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<h1></h1>
|
|
2
6
|
|
|
3
7
|
<div align="center">
|
|
4
8
|
<a href="https://codecov.io/gh/middleapi/orpc">
|
|
5
|
-
<img alt="codecov" src="https://codecov.io/gh/middleapi/orpc/branch/
|
|
9
|
+
<img alt="codecov" src="https://codecov.io/gh/middleapi/orpc/branch/1.x/graph/badge.svg">
|
|
6
10
|
</a>
|
|
7
11
|
<a href="https://www.npmjs.com/package/@orpc/arktype">
|
|
8
12
|
<img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40orpc%2Farktype?logo=npm" />
|
|
9
13
|
</a>
|
|
10
|
-
<a href="https://
|
|
11
|
-
<img alt="CodSpeed" src="https://img.shields.io/endpoint?url=https://codspeed.io/badge.json" />
|
|
12
|
-
</a>
|
|
13
|
-
<a href="https://github.com/middleapi/orpc/blob/main/LICENSE">
|
|
14
|
+
<a href="https://github.com/middleapi/orpc/blob/1.x/LICENSE">
|
|
14
15
|
<img alt="MIT License" src="https://img.shields.io/github/license/middleapi/orpc?logo=open-source-initiative" />
|
|
15
16
|
</a>
|
|
16
17
|
<a href="https://discord.gg/TXEbwRBvQn">
|
|
@@ -21,53 +22,84 @@
|
|
|
21
22
|
</a>
|
|
22
23
|
</div>
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
You can read the documentation [here](https://orpc.dev).
|
|
27
|
-
|
|
28
|
-
## Packages
|
|
29
|
-
|
|
30
|
-
**Core**
|
|
25
|
+
<h3 align="center">Typesafe APIs Made Simple 🪄</h3>
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build APIs or implement contracts.
|
|
34
|
-
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume APIs with end-to-end type safety.
|
|
35
|
-
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Add OpenAPI compatibility to APIs.
|
|
27
|
+
**oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards
|
|
36
28
|
|
|
37
|
-
|
|
29
|
+
---
|
|
38
30
|
|
|
39
|
-
|
|
40
|
-
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): Integrate with [Valibot](https://valibot.dev/).
|
|
41
|
-
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): Integrate with [ArkType](https://arktype.io/).
|
|
31
|
+
## Highlights
|
|
42
32
|
|
|
43
|
-
|
|
33
|
+
- **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
|
|
34
|
+
- **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
|
|
35
|
+
- **📝 Contract-First Development**: Optionally define your API contract before implementation.
|
|
36
|
+
- **🔍 First-Class OpenTelemetry**: Seamlessly integrate with OpenTelemetry for observability.
|
|
37
|
+
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), SWR, Pinia Colada, and more.
|
|
38
|
+
- **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
|
|
39
|
+
- **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
|
|
40
|
+
- **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
|
|
41
|
+
- **⏱️ Lazy Router**: Enhance cold start times with our lazy routing feature.
|
|
42
|
+
- **📡 SSE & Streaming**: Enjoy full type-safe support for SSE and streaming.
|
|
43
|
+
- **🌍 Multi-Runtime Support**: Fast and lightweight on Cloudflare, Deno, Bun, Node.js, and beyond.
|
|
44
|
+
- **🔌 Extendability**: Easily extend functionality with plugins, middleware, and interceptors.
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
- [@orpc/ratelimit](https://www.npmjs.com/package/@orpc/ratelimit): Rate limiting with memory, Redis, and Upstash adapters.
|
|
47
|
-
- [@orpc/json-schema](https://www.npmjs.com/package/@orpc/json-schema): Smart coercion for OpenAPI requests.
|
|
48
|
-
|
|
49
|
-
**Framework & ecosystem integrations**
|
|
46
|
+
## Documentation
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
- [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk): Turn contracts and procedures into [AI SDK](https://ai-sdk.dev/) tools.
|
|
53
|
-
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): Integrate with [TanStack Query](https://tanstack.com/query/latest).
|
|
54
|
-
- [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada): Integrate with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
55
|
-
- [@orpc/swr](https://www.npmjs.com/package/@orpc/swr): Integrate with [SWR](https://swr.vercel.app/).
|
|
56
|
-
- [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect): Integrate with [Effect](https://effect.website/).
|
|
57
|
-
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Implement your contract with [NestJS](https://nestjs.com/).
|
|
58
|
-
- [@orpc/bun](https://www.npmjs.com/package/@orpc/bun): Adapters for [Bun's Redis](https://bun.sh/).
|
|
59
|
-
- [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare): Adapters for [Cloudflare's RateLimit and Durable Objects](https://developers.cloudflare.com/workers/).
|
|
60
|
-
- [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc): Reuse existing [tRPC](https://trpc.io/) routers within oRPC.
|
|
48
|
+
You can find the full documentation [here](https://orpc.dev).
|
|
61
49
|
|
|
62
|
-
|
|
50
|
+
## Packages
|
|
63
51
|
|
|
64
|
-
- [@orpc/
|
|
65
|
-
- [@orpc/
|
|
66
|
-
- [@orpc/
|
|
52
|
+
- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
|
|
53
|
+
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
|
|
54
|
+
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
|
55
|
+
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
|
56
|
+
- [@orpc/otel](https://www.npmjs.com/package/@orpc/otel): [OpenTelemetry](https://opentelemetry.io/) integration for observability.
|
|
57
|
+
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
|
|
58
|
+
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
|
59
|
+
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
|
|
60
|
+
- [@orpc/experimental-react-swr](https://www.npmjs.com/package/@orpc/experimental-react-swr): [SWR](https://swr.vercel.app/) integration.
|
|
61
|
+
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
62
|
+
- [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
|
|
63
|
+
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
|
64
|
+
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
|
|
65
|
+
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
|
|
66
|
+
|
|
67
|
+
## `@orpc/arktype`
|
|
68
|
+
|
|
69
|
+
Provides `ArkTypeToJsonSchemaConverter` for generating OpenAPI specs from [ArkType](https://arktype.io/).
|
|
70
|
+
|
|
71
|
+
### Generate OpenAPI Spec
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import {
|
|
75
|
+
experimental_ArkTypeToJsonSchemaConverter as ArkTypeToJsonSchemaConverter
|
|
76
|
+
} from '@orpc/arktype'
|
|
77
|
+
import { OpenAPIGenerator } from '@orpc/openapi'
|
|
78
|
+
|
|
79
|
+
const openAPIGenerator = new OpenAPIGenerator({
|
|
80
|
+
schemaConverters: [
|
|
81
|
+
new ArkTypeToJsonSchemaConverter()
|
|
82
|
+
],
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
const specFromContract = await openAPIGenerator.generate(contract, {
|
|
86
|
+
info: {
|
|
87
|
+
title: 'My App',
|
|
88
|
+
version: '0.0.0',
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
const specFromRouter = await openAPIGenerator.generate(router, {
|
|
93
|
+
info: {
|
|
94
|
+
title: 'My App',
|
|
95
|
+
version: '0.0.0',
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
```
|
|
67
99
|
|
|
68
100
|
## Sponsors
|
|
69
101
|
|
|
70
|
-
|
|
102
|
+
If you find oRPC valuable and would like to support its development, you can do so here: [GitHub Sponsors](https://github.com/sponsors/dinwwwh).
|
|
71
103
|
|
|
72
104
|
### 🏆 Platinum Sponsor
|
|
73
105
|
|
|
@@ -109,10 +141,11 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
109
141
|
<td align="center"><a href="https://github.com/valerii15298?ref=orpc" target="_blank" rel="noopener" title="Valerii Petryniak"><img src="https://avatars.githubusercontent.com/u/44531564?u=88ac74d9bacd20401518441907acad21063cd397&v=4" width="139" alt="Valerii Petryniak"/><br />Valerii Petryniak</a></td>
|
|
110
142
|
<td align="center"><a href="https://github.com/letstri?ref=orpc" target="_blank" rel="noopener" title="Valerii Strilets"><img src="https://avatars.githubusercontent.com/u/13253748?u=c7b10399ccc8f8081e24db94ec32cd9858e86ac3&v=4" width="139" alt="Valerii Strilets"/><br />Valerii Strilets</a></td>
|
|
111
143
|
<td align="center"><a href="https://github.com/K-Mistele?ref=orpc" target="_blank" rel="noopener" title="Kyle Mistele"><img src="https://avatars.githubusercontent.com/u/18430555?u=3afebeb81de666e35aaac3ed46f14159d7603ffb&v=4" width="139" alt="Kyle Mistele"/><br />Kyle Mistele</a></td>
|
|
144
|
+
<td align="center"><a href="https://github.com/R44VC0RP?ref=orpc" target="_blank" rel="noopener" title="Ryan Vogel"><img src="https://avatars.githubusercontent.com/u/89211796?u=1857347b9787d8d8a7ea5bfc333f96be92d5a683&v=4" width="139" alt="Ryan Vogel"/><br />Ryan Vogel</a></td>
|
|
112
145
|
<td align="center"><a href="https://github.com/christ12938?ref=orpc" target="_blank" rel="noopener" title="christ12938"><img src="https://avatars.githubusercontent.com/u/25758598?v=4" width="139" alt="christ12938"/><br />christ12938</a></td>
|
|
113
|
-
<td align="center"><a href="https://github.com/Ryanjso?ref=orpc" target="_blank" rel="noopener" title="Ryan Soderberg"><img src="https://avatars.githubusercontent.com/u/39172778?u=5ed913c31d57e7221b75784abcad48c7ebddde27&v=4" width="139" alt="Ryan Soderberg"/><br />Ryan Soderberg</a></td>
|
|
114
146
|
</tr>
|
|
115
147
|
<tr>
|
|
148
|
+
<td align="center"><a href="https://github.com/Ryanjso?ref=orpc" target="_blank" rel="noopener" title="Ryan Soderberg"><img src="https://avatars.githubusercontent.com/u/39172778?u=5ed913c31d57e7221b75784abcad48c7ebddde27&v=4" width="139" alt="Ryan Soderberg"/><br />Ryan Soderberg</a></td>
|
|
116
149
|
<td align="center"><a href="https://github.com/itigoore01?ref=orpc" target="_blank" rel="noopener" title="shota"><img src="https://avatars.githubusercontent.com/u/11831107?u=c976a6dc7e055eb026304c46c99100ed22b0c8e0&v=4" width="139" alt="shota"/><br />shota</a></td>
|
|
117
150
|
</tr>
|
|
118
151
|
</table>
|
|
@@ -172,7 +205,6 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
172
205
|
<a href="https://github.com/nguyenlc1993?ref=orpc" target="_blank" rel="noopener" title="Lê Cao Nguyên"><img src="https://avatars.githubusercontent.com/u/13871971?u=83c8b69d9e35b589c4e1f066cc113b1d9461386f&v=4" width="32" height="32" alt="Lê Cao Nguyên" /></a>
|
|
173
206
|
<a href="https://github.com/wobsoriano?ref=orpc" target="_blank" rel="noopener" title="Robert Soriano"><img src="https://avatars.githubusercontent.com/u/13049130?u=6d72104182e7c9ed25934815313fb69107332111&v=4" width="32" height="32" alt="Robert Soriano" /></a>
|
|
174
207
|
<a href="https://github.com/andrewpeters9?ref=orpc" target="_blank" rel="noopener" title="Andrew Peters"><img src="https://avatars.githubusercontent.com/u/36251325?v=4" width="32" height="32" alt="Andrew Peters" /></a>
|
|
175
|
-
<a href="https://github.com/R44VC0RP?ref=orpc" target="_blank" rel="noopener" title="Ryan Vogel"><img src="https://avatars.githubusercontent.com/u/89211796?u=1857347b9787d8d8a7ea5bfc333f96be92d5a683&v=4" width="32" height="32" alt="Ryan Vogel" /></a>
|
|
176
208
|
<a href="https://github.com/SKostyukovich?ref=orpc" target="_blank" rel="noopener" title="SKostyukovich"><img src="https://avatars.githubusercontent.com/u/10700067?v=4" width="32" height="32" alt="SKostyukovich" /></a>
|
|
177
209
|
<a href="https://github.com/peter-adam-dy?ref=orpc" target="_blank" rel="noopener" title="Peter Adam"><img src="https://avatars.githubusercontent.com/u/132129459?u=4f3dbbb3b443990b56acb7d6a5d11ed2c555f6db&v=4" width="32" height="32" alt="Peter Adam" /></a>
|
|
178
210
|
<a href="https://github.com/FabworksHQ?ref=orpc" target="_blank" rel="noopener" title="Fabworks"><img src="https://avatars.githubusercontent.com/u/160179500?v=4" width="32" height="32" alt="Fabworks" /></a>
|
|
@@ -187,13 +219,6 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
187
219
|
<a href="https://github.com/plancraft?ref=orpc" target="_blank" rel="noopener" title="plancraft"><img src="https://avatars.githubusercontent.com/u/46482287?v=4" width="32" height="32" alt="plancraft" /></a>
|
|
188
220
|
</p>
|
|
189
221
|
|
|
190
|
-
## References
|
|
191
|
-
|
|
192
|
-
oRPC is inspired by existing solutions that prioritize type safety and developer experience. Special acknowledgments to:
|
|
193
|
-
|
|
194
|
-
- [tRPC](https://trpc.io): For pioneering the concept of end-to-end type-safe RPC and influencing the development of type-safe APIs.
|
|
195
|
-
- [ts-rest](https://ts-rest.com): For its emphasis on contract-first development and OpenAPI integration, which have greatly inspired oRPC's feature set.
|
|
196
|
-
|
|
197
222
|
## License
|
|
198
223
|
|
|
199
|
-
Distributed under the MIT License. See [LICENSE](https://github.com/middleapi/orpc/blob/
|
|
224
|
+
Distributed under the MIT License. See [LICENSE](https://github.com/middleapi/orpc/blob/1.x/LICENSE) for more information.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { ToJsonSchema } from '@ark/schema';
|
|
2
|
-
import {
|
|
2
|
+
import { AnySchema } from '@orpc/contract';
|
|
3
|
+
import { ConditionalSchemaConverter, SchemaConvertOptions, JSONSchema } from '@orpc/openapi';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
condition(schema: AnySchema | undefined, _direction: JsonSchemaConverterDirection): boolean;
|
|
10
|
-
convert(schema: AnySchema | undefined, direction: JsonSchemaConverterDirection): [jsonSchema: JsonSchema, optional: boolean];
|
|
11
|
-
private convertArkType;
|
|
5
|
+
declare class experimental_ArkTypeToJsonSchemaConverter implements ConditionalSchemaConverter {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(options?: ToJsonSchema.Options);
|
|
8
|
+
condition(schema: AnySchema | undefined): boolean;
|
|
9
|
+
convert(schema: AnySchema | undefined, _options: SchemaConvertOptions): [required: boolean, jsonSchema: Exclude<JSONSchema, boolean>];
|
|
12
10
|
}
|
|
13
11
|
|
|
14
|
-
export {
|
|
15
|
-
export type { ArkTypeToJsonSchemaConverterOptions };
|
|
12
|
+
export { experimental_ArkTypeToJsonSchemaConverter };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { ToJsonSchema } from '@ark/schema';
|
|
2
|
-
import {
|
|
2
|
+
import { AnySchema } from '@orpc/contract';
|
|
3
|
+
import { ConditionalSchemaConverter, SchemaConvertOptions, JSONSchema } from '@orpc/openapi';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
condition(schema: AnySchema | undefined, _direction: JsonSchemaConverterDirection): boolean;
|
|
10
|
-
convert(schema: AnySchema | undefined, direction: JsonSchemaConverterDirection): [jsonSchema: JsonSchema, optional: boolean];
|
|
11
|
-
private convertArkType;
|
|
5
|
+
declare class experimental_ArkTypeToJsonSchemaConverter implements ConditionalSchemaConverter {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(options?: ToJsonSchema.Options);
|
|
8
|
+
condition(schema: AnySchema | undefined): boolean;
|
|
9
|
+
convert(schema: AnySchema | undefined, _options: SchemaConvertOptions): [required: boolean, jsonSchema: Exclude<JSONSchema, boolean>];
|
|
12
10
|
}
|
|
13
11
|
|
|
14
|
-
export {
|
|
15
|
-
export type { ArkTypeToJsonSchemaConverterOptions };
|
|
12
|
+
export { experimental_ArkTypeToJsonSchemaConverter };
|
package/dist/index.mjs
CHANGED
|
@@ -1,57 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JSONSchemaFormat } from '@orpc/openapi';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const defaultToJsonSchemaFallback = {
|
|
4
|
+
date: (ctx) => ({
|
|
5
|
+
...ctx.base,
|
|
6
|
+
type: "string",
|
|
7
|
+
format: JSONSchemaFormat.DateTime
|
|
8
|
+
})
|
|
9
|
+
};
|
|
10
|
+
class experimental_ArkTypeToJsonSchemaConverter {
|
|
11
|
+
#options;
|
|
5
12
|
constructor(options = {}) {
|
|
6
|
-
this
|
|
13
|
+
this.#options = {
|
|
7
14
|
...options,
|
|
8
|
-
target: "draft-2020-12",
|
|
9
15
|
fallback: {
|
|
10
|
-
...
|
|
11
|
-
|
|
12
|
-
if (ctx.code === "domain") {
|
|
13
|
-
if (ctx.domain === "bigint") {
|
|
14
|
-
ctx.base.type = "string";
|
|
15
|
-
ctx.base.pattern = "^-?[0-9]+$";
|
|
16
|
-
ctx.base["x-native-type"] = JsonSchemaXNativeType.BigInt;
|
|
17
|
-
}
|
|
18
|
-
} else if (ctx.code === "date") {
|
|
19
|
-
ctx.base.type = "string";
|
|
20
|
-
ctx.base.format = JsonSchemaFormat.DateTime;
|
|
21
|
-
ctx.base["x-native-type"] = JsonSchemaXNativeType.Date;
|
|
22
|
-
}
|
|
23
|
-
if (typeof options.fallback === "function") {
|
|
24
|
-
return options.fallback(ctx);
|
|
25
|
-
}
|
|
26
|
-
if (options.fallback?.default) {
|
|
27
|
-
return options.fallback.default(ctx);
|
|
28
|
-
}
|
|
29
|
-
return ctx.base;
|
|
30
|
-
}
|
|
16
|
+
...defaultToJsonSchemaFallback,
|
|
17
|
+
...options?.fallback
|
|
31
18
|
}
|
|
32
19
|
};
|
|
33
20
|
}
|
|
34
|
-
condition(schema
|
|
35
|
-
return schema
|
|
21
|
+
condition(schema) {
|
|
22
|
+
return schema !== void 0 && schema["~standard"].vendor === "arktype";
|
|
36
23
|
}
|
|
37
|
-
convert(schema,
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
let optional = false;
|
|
41
|
-
try {
|
|
42
|
-
const result = arkTypeSchema["~standard"].validate(void 0);
|
|
43
|
-
if (!(result instanceof Promise) && !result.issues) {
|
|
44
|
-
optional = direction === "input" ? true : result.value === void 0;
|
|
45
|
-
}
|
|
46
|
-
} catch {
|
|
47
|
-
}
|
|
48
|
-
return [jsonSchema, optional];
|
|
49
|
-
}
|
|
50
|
-
convertArkType(schema, _direction) {
|
|
51
|
-
const jsonSchema = schema.toJsonSchema(this.toJsonSchemaOptions);
|
|
52
|
-
const { $schema, ...rest } = jsonSchema;
|
|
53
|
-
return rest;
|
|
24
|
+
convert(schema, _options) {
|
|
25
|
+
const jsonSchema = schema.toJsonSchema(this.#options);
|
|
26
|
+
return [true, jsonSchema];
|
|
54
27
|
}
|
|
55
28
|
}
|
|
56
29
|
|
|
57
|
-
export {
|
|
30
|
+
export { experimental_ArkTypeToJsonSchemaConverter };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/arktype",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.14.
|
|
4
|
+
"version": "1.14.12",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
],
|
|
15
15
|
"sideEffects": false,
|
|
16
16
|
"exports": {
|
|
17
|
-
"./package.json": "./package.json",
|
|
18
17
|
".": {
|
|
19
18
|
"types": "./dist/index.d.mts",
|
|
20
19
|
"import": "./dist/index.mjs",
|
|
@@ -26,18 +25,20 @@
|
|
|
26
25
|
],
|
|
27
26
|
"peerDependencies": {
|
|
28
27
|
"@ark/schema": "*",
|
|
29
|
-
"arktype": "*"
|
|
28
|
+
"arktype": "*",
|
|
29
|
+
"@orpc/contract": "1.14.12"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@orpc/
|
|
32
|
+
"@orpc/openapi": "1.14.12"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@ark/schema": "^0.56.0",
|
|
36
|
-
"arktype": "^2.2.
|
|
37
|
-
"zod": "^4.
|
|
36
|
+
"arktype": "^2.2.0",
|
|
37
|
+
"zod": "^4.3.6"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "unbuild",
|
|
41
|
+
"build:watch": "pnpm run build --watch",
|
|
41
42
|
"type:check": "tsc -b"
|
|
42
43
|
}
|
|
43
44
|
}
|