Skip to content

Commit f803129

Browse files
Merge pull request #86 from basehub-ai/changeset-release/main
Version Packages
2 parents a122845 + 02cc1a7 commit f803129

File tree

5 files changed

+109
-50
lines changed

5 files changed

+109
-50
lines changed

.changeset/smooth-dots-greet.md

-48
This file was deleted.

packages/basehub/CHANGELOG.md

+52
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,57 @@
11
# basehub
22

3+
## 4.0.0
4+
5+
### Major Changes
6+
7+
- 7a85095: # New `fragmentOn` helper to extract fragments
8+
9+
In this new major version, we're introducing `fragmentOn`, a simpler way to create fragments in the `basehub` SDK.
10+
11+
Previously, in order to reuse a fragment, you'd do something like this:
12+
13+
```ts
14+
// old way 👎
15+
import {
16+
LinkComponentGenqlSelection,
17+
LinkComponent,
18+
FieldsSelection,
19+
} from "basehub";
20+
21+
const LinkFragment = {
22+
href: true,
23+
label: true,
24+
} satisfies LinkComponentGenqlSelection;
25+
26+
// extract the type
27+
type LinkFragment = FieldsSelection<LinkComponent, typeof LinkFragment>;
28+
```
29+
30+
Looks simple, but it's a bit hard to understand. You need to know that we're exposing a `LinkComponentGenqlSelection`, and that you should use the `satisfies` so the object's type is constrained but also can be more specific. Then, to extract the type, you'd get `FieldsSelection`, and finally, `LinkComponent`. A lot of types!
31+
32+
Moreover, if you needed to create another fragment, it'd be this same process, over and over again.
33+
34+
This is how it's done in the new version:
35+
36+
```ts
37+
// new way 👍
38+
import { fragmentOn } from "basehub";
39+
40+
const LinkFragment = fragmentOn("LinkComponent", {
41+
href: true,
42+
label: true,
43+
});
44+
45+
// extract the type
46+
type LinkFragment = fragmentOn.infer<typeof LinkFragment>;
47+
```
48+
49+
Much simpler!
50+
51+
## Why is this a breaking change
52+
53+
Before this version, we exposed a lot of the internal types from `'basehub'`. We now don't. Some applications might depend on this, and that's why this is a breaking change. If you need those types for some reason that wasn't discussed in this document, feel free to raise an issue and we can see to bring them back.
54+
355
## 3.2.0
456

557
### Minor Changes

packages/basehub/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "basehub",
33
"description": "The first AI-native content hub.",
44
"author": "JB <[email protected]>",
5-
"version": "3.2.0",
5+
"version": "4.0.0",
66
"license": "MIT",
77
"repository": "basehub-ai/basehub",
88
"bugs": "https://github.com/basehub-ai/basehub/issues",

playground/CHANGELOG.md

+55
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,60 @@
11
# playground
22

3+
## 0.0.70
4+
5+
### Patch Changes
6+
7+
- 7a85095: # New `fragmentOn` helper to extract fragments
8+
9+
In this new major version, we're introducing `fragmentOn`, a simpler way to create fragments in the `basehub` SDK.
10+
11+
Previously, in order to reuse a fragment, you'd do something like this:
12+
13+
```ts
14+
// old way 👎
15+
import {
16+
LinkComponentGenqlSelection,
17+
LinkComponent,
18+
FieldsSelection,
19+
} from "basehub";
20+
21+
const LinkFragment = {
22+
href: true,
23+
label: true,
24+
} satisfies LinkComponentGenqlSelection;
25+
26+
// extract the type
27+
type LinkFragment = FieldsSelection<LinkComponent, typeof LinkFragment>;
28+
```
29+
30+
Looks simple, but it's a bit hard to understand. You need to know that we're exposing a `LinkComponentGenqlSelection`, and that you should use the `satisfies` so the object's type is constrained but also can be more specific. Then, to extract the type, you'd get `FieldsSelection`, and finally, `LinkComponent`. A lot of types!
31+
32+
Moreover, if you needed to create another fragment, it'd be this same process, over and over again.
33+
34+
This is how it's done in the new version:
35+
36+
```ts
37+
// new way 👍
38+
import { fragmentOn } from "basehub";
39+
40+
const LinkFragment = fragmentOn("LinkComponent", {
41+
href: true,
42+
label: true,
43+
});
44+
45+
// extract the type
46+
type LinkFragment = fragmentOn.infer<typeof LinkFragment>;
47+
```
48+
49+
Much simpler!
50+
51+
## Why is this a breaking change
52+
53+
Before this version, we exposed a lot of the internal types from `'basehub'`. We now don't. Some applications might depend on this, and that's why this is a breaking change. If you need those types for some reason that wasn't discussed in this document, feel free to raise an issue and we can see to bring them back.
54+
55+
- Updated dependencies [7a85095]
56+
57+
358
## 0.0.69
459

560
### Patch Changes

playground/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "playground",
33
"private": true,
4-
"version": "0.0.69",
4+
"version": "0.0.70",
55
"scripts": {
66
"dev": "basehub dev & next dev",
77
"build": "next build",

0 commit comments

Comments
 (0)