@orpc/arktype 1.2.0 → 1.4.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
@@ -49,6 +49,7 @@ You can find the full documentation [here](https://orpc.unnoq.com).
49
49
  - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
50
50
  - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
51
51
  - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
52
+ - [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with NestJS.
52
53
  - [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
53
54
  - [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
54
55
  - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
package/dist/index.d.mts CHANGED
@@ -1,7 +1,10 @@
1
+ import { ToJsonSchema } from '@ark/schema';
1
2
  import { AnySchema } from '@orpc/contract';
2
3
  import { ConditionalSchemaConverter, SchemaConvertOptions, JSONSchema } from '@orpc/openapi';
3
4
 
4
5
  declare class experimental_ArkTypeToJsonSchemaConverter implements ConditionalSchemaConverter {
6
+ #private;
7
+ constructor(options?: ToJsonSchema.Options);
5
8
  condition(schema: AnySchema | undefined): boolean;
6
9
  convert(schema: AnySchema | undefined, _options: SchemaConvertOptions): [required: boolean, jsonSchema: Exclude<JSONSchema, boolean>];
7
10
  }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
+ import { ToJsonSchema } from '@ark/schema';
1
2
  import { AnySchema } from '@orpc/contract';
2
3
  import { ConditionalSchemaConverter, SchemaConvertOptions, JSONSchema } from '@orpc/openapi';
3
4
 
4
5
  declare class experimental_ArkTypeToJsonSchemaConverter implements ConditionalSchemaConverter {
6
+ #private;
7
+ constructor(options?: ToJsonSchema.Options);
5
8
  condition(schema: AnySchema | undefined): boolean;
6
9
  convert(schema: AnySchema | undefined, _options: SchemaConvertOptions): [required: boolean, jsonSchema: Exclude<JSONSchema, boolean>];
7
10
  }
package/dist/index.mjs CHANGED
@@ -1,9 +1,28 @@
1
+ import { JSONSchemaFormat } from '@orpc/openapi';
2
+
3
+ const defaultToJsonSchemaFallback = {
4
+ date: (ctx) => ({
5
+ ...ctx.base,
6
+ type: "string",
7
+ format: JSONSchemaFormat.DateTime
8
+ })
9
+ };
1
10
  class experimental_ArkTypeToJsonSchemaConverter {
11
+ #options;
12
+ constructor(options = {}) {
13
+ this.#options = {
14
+ ...options,
15
+ fallback: {
16
+ ...defaultToJsonSchemaFallback,
17
+ ...options?.fallback
18
+ }
19
+ };
20
+ }
2
21
  condition(schema) {
3
22
  return schema !== void 0 && schema["~standard"].vendor === "arktype";
4
23
  }
5
24
  convert(schema, _options) {
6
- const jsonSchema = schema.toJsonSchema();
25
+ const jsonSchema = schema.toJsonSchema(this.#options);
7
26
  return [true, jsonSchema];
8
27
  }
9
28
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/arktype",
3
3
  "type": "module",
4
- "version": "1.2.0",
4
+ "version": "1.4.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -24,12 +24,12 @@
24
24
  "dist"
25
25
  ],
26
26
  "peerDependencies": {
27
+ "@ark/schema": "*",
27
28
  "arktype": "*",
28
- "@orpc/contract": "1.2.0",
29
- "@orpc/server": "1.2.0"
29
+ "@orpc/contract": "1.4.0"
30
30
  },
31
31
  "dependencies": {
32
- "@orpc/openapi": "1.2.0"
32
+ "@orpc/openapi": "1.4.0"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "unbuild",