Skip to content

Commit bc8c8be

Browse files
committed
changelog for pre8
1 parent 830b098 commit bc8c8be

1 file changed

Lines changed: 66 additions & 1 deletion

File tree

packages/types/CHANGELOG.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,74 @@ Each higher version type can also inherit characteristics from the lower version
1616

1717
For prereleases:
1818

19-
- Pre-release versions (x.x.x-pre.x) are unstable releases for the designated API version. These contain work-in-progress types and annotations. Pre-release versions are not meant to be used except for trying out new API interfaces and giving feedback, and may change without prior programmatic notice. Pre-release versions are meant to be used with new builds from the `dev` branch of the base extension repo.
19+
- Pre-release versions (x.x.x-pre.x) are unstable releases for the designated API version. These contain work-in-progress types and annotations. Pre-release versions are not meant to be used except for trying out new API interfaces and giving feedback, and may change without prior programmatic or verbal notice. Pre-release versions are meant to be used with new builds from the `dev` branch of the base extension repo.
2020
- Release candidates (x.x.x-rc.x) are stable previews for the designated API version. These contain types that are more or less finalized for the designated release. Breaking changes should not be expected, both in type signature and functionality, but will always be highlighted in the changelog if necessary. This is also meant for feedback, but only for more subtle feedback before releasing that version such that it simply just contains bug fixes and very minor changes.
2121

22+
## 1.0.0-pre.8
23+
24+
### Breaking changes
25+
26+
- The `RCEContext` interface no longer has the following properties: `name`, `action`.
27+
- You may now get some extra type errors on action definitions where you wouldn't previously. Read below for more information.
28+
29+
### Added
30+
31+
- You may now use a [Standard JSON Schema](https://standardschema.dev/json-schema) compliant validator library to construct your schemas, instead of a normal JSON schema.
32+
- To allow for typing support with this, a new `defineAction` identity function has been added to the package. This function simply wraps an action, and provides type hints for action data in the context object.
33+
- Schema validation is still done with the `jsonschema` library. Refinements and modifications by the validation library is not allowed and will not be performed. Types for the action data reflect this (they use the validation schema's input types, not output types).
34+
- RCEContext will default to `unknown` for normal JSON schemas. This may now cause type errors in your code when it wouldn't previously.
35+
- Some validation library examples:
36+
37+
```ts
38+
// Zod
39+
import { defineAction } from '@vsc-neuropilot/api-types';
40+
import { z } from 'zod';
41+
42+
const zodAction = defineAction({
43+
name: 'zod_action',
44+
description: 'Zod action',
45+
schema: z.object({
46+
name: z.string().optional()
47+
}),
48+
handler: (ctx /* ctx.data is typed! */) => {
49+
const name = ctx.data.params.name // should not cause errors even without null checking or assertions
50+
}
51+
})
52+
53+
// Valibot
54+
import { defineAction } from '@vsc-neuropilot/api-types';
55+
import { v } from 'valibot';
56+
import { toStandardJsonSchema } from '@valibot/to-json-schema';
57+
58+
const valibotAction = defineAction({
59+
name: 'valibot_action',
60+
description: 'Valibot action',
61+
schema: v.object({
62+
name: v.optional(v.string())
63+
}),
64+
handler: (ctx /* ctx.data is typed! */) => {
65+
const name = ctx.data.params.name // should not cause errors even without null checking or assertions
66+
}
67+
})
68+
69+
// ArkType
70+
import { defineAction } from '@vsc-neuropilot/api-types';
71+
import { type } from 'arktype';
72+
73+
const arktypeAction = defineAction({
74+
name: 'arktype_action',
75+
description: 'ArkType action',
76+
schema: type({
77+
"name?": "string"
78+
}),
79+
handler: (ctx /* ctx.data is typed! */) => {
80+
const name = ctx.data.params.name // should not cause errors even without null checking or assertions
81+
}
82+
})
83+
```
84+
85+
Read the linked page about the Standard JSON Schema specification to determine if your library implements it, and how to use it.
86+
2287
## 1.0.0-pre.7
2388

2489
Nothing in terms of package functionality was fixed this update. However, git tags *should* hopefully be pushed from CI now.

0 commit comments

Comments
 (0)