Skip to content

Commit cbc98ed

Browse files
cmwhitednikgraf
andauthored
feat(#352 | Typesync v2): buildout typesync-studio as a distributable cli/ui tool from hypergraph (#474)
Co-authored-by: Nik Graf <nik@nikgraf.com>
1 parent 7fbf1eb commit cbc98ed

79 files changed

Lines changed: 11995 additions & 1339 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/tame-horses-try.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
"@graphprotocol/hypergraph": minor
3+
---
4+
5+
Introduced a cli tool and typesync studio UI to let users graphically visualize, update, and publish their hypergraph schemas.
6+
7+
1. install the latest `@graphprotocol/hypergraph` version: `pnpm add @graphprotocol/hypergraph@latest`
8+
2. add a script to your `package.json` to open the typesync studio: `"typesync": "hg typesync --open"`
9+
3. open your browser to http://localhost:3000
10+
4. view your current Hypergraph app schema, parsed from your `schema.ts` file
11+
5. update your schema, view existing types and properties on the Knowledge Graph. add types and properties.
12+
6. sync your schema updates to your schema.ts file
13+
7. publish your schema to the Knowledge Graph.

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
{
2+
"files.watcherExclude": {
3+
"**/routeTree.gen.ts": true
4+
},
5+
"search.exclude": {
6+
"**/routeTree.gen.ts": true
7+
},
8+
"files.readonlyInclude": {
9+
"**/routeTree.gen.ts": true
10+
},
211
"editor.formatOnSave": true,
312
"editor.codeActionsOnSave": {
413
"source.organizeImports.biome": "explicit"

apps/connect/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
"@tanstack/react-router-devtools": "^1.122.0",
2626
"@xstate/store": "^3.5.1",
2727
"clsx": "^2.1.1",
28-
"effect": "^3.17.3",
28+
"effect": "^3.17.6",
2929
"graphql-request": "^7.2.0",
30-
"react": "^19.1.0",
31-
"react-dom": "^19.1.0",
30+
"react": "^19.1.1",
31+
"react-dom": "^19.1.1",
3232
"tailwind-merge": "^3.3.1",
3333
"viem": "^2.30.6",
3434
"vite": "^6.3.5"
@@ -37,8 +37,8 @@
3737
"@tailwindcss/vite": "^4.1.11",
3838
"@tanstack/router-plugin": "^1.120.2",
3939
"@types/node": "^24.1.0",
40-
"@types/react": "^19.1.3",
41-
"@types/react-dom": "^19.1.3",
40+
"@types/react": "^19.1.9",
41+
"@types/react-dom": "^19.1.7",
4242
"@vitejs/plugin-react": "^4.4.1",
4343
"prettier": "^3.6.2",
4444
"prettier-plugin-tailwindcss": "^0.6.14",

apps/create-hypergraph/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@
5555
"homepage": "https://github.com/graphprotocol/hypergraph/tree/main/apps/create-hypergraph-app#readme",
5656
"devDependencies": {
5757
"@effect/cli": "^0.69.0",
58-
"@effect/language-service": "^0.31.2",
58+
"@effect/language-service": "^0.34.0",
5959
"@effect/platform": "^0.90.0",
60-
"@effect/platform-node": "^0.94.0",
60+
"@effect/platform-node": "^0.94.1",
6161
"@effect/printer-ansi": "^0.45.0",
6262
"@effect/vitest": "^0.25.0",
63-
"@types/node": "^24.1.0",
64-
"effect": "^3.17.3",
63+
"@types/node": "^24.2.0",
64+
"effect": "^3.17.6",
6565
"execa": "^9.6.0",
66-
"tsdown": "^0.13.0",
66+
"tsdown": "^0.13.3",
6767
"tsx": "^4.20.3"
6868
}
6969
}

apps/create-hypergraph/template-nextjs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"lucide-react": "^0.525.0",
2727
"next": "15.4.3",
2828
"postcss": "^8.5.6",
29-
"react": "^19.1.0",
30-
"react-dom": "^19.1.0",
29+
"react": "^19.1.1",
30+
"react-dom": "^19.1.1",
3131
"tailwind-merge": "^3.3.1",
3232
"tailwindcss": "^4.1.11"
3333
},

apps/create-hypergraph/template-vite-react/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@
2121
"@tanstack/react-router": "^1.129.2",
2222
"class-variance-authority": "^0.7.1",
2323
"clsx": "^2.1.1",
24-
"effect": "^3.17.3",
24+
"effect": "^3.17.6",
2525
"lucide-react": "^0.525.0",
26-
"react": "^19.1.0",
27-
"react-dom": "^19.1.0",
26+
"react": "^19.1.1",
27+
"react-dom": "^19.1.1",
2828
"tailwind-merge": "^3.3.1",
2929
"tailwindcss": "^4.1.11",
3030
"vite": "^7.0.5"
3131
},
3232
"devDependencies": {
3333
"@eslint/js": "^9.31.0",
3434
"@tanstack/router-plugin": "^1.129.2",
35-
"@types/node": "^24.1.0",
36-
"@types/react": "^19.1.8",
37-
"@types/react-dom": "^19.1.6",
35+
"@types/node": "^24.2.0",
36+
"@types/react": "^19.1.9",
37+
"@types/react-dom": "^19.1.7",
3838
"@vitejs/plugin-react": "^4.7.0",
3939
"eslint": "^9.31.0",
4040
"eslint-plugin-react-hooks": "^5.2.0",

apps/events/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
"@xstate/store": "^3.5.1",
2424
"class-variance-authority": "^0.7.1",
2525
"clsx": "^2.1.1",
26-
"effect": "^3.17.3",
26+
"effect": "^3.17.6",
2727
"framer-motion": "^12.10.1",
2828
"graphql-request": "^7.1.2",
2929
"isomorphic-ws": "^5.0.0",
3030
"lucide-react": "^0.508.0",
31-
"react": "^19.1.0",
32-
"react-dom": "^19.1.0",
31+
"react": "^19.1.1",
32+
"react-dom": "^19.1.1",
3333
"react-select": "^5.10.1",
3434
"siwe": "^3.0.0",
3535
"tailwind-merge": "^3.2.0",
@@ -42,9 +42,9 @@
4242
"@biomejs/biome": "1.9.4",
4343
"@tailwindcss/vite": "^4.1.5",
4444
"@tanstack/router-plugin": "^1.120.2",
45-
"@types/node": "^24.1.0",
46-
"@types/react": "^19.1.3",
47-
"@types/react-dom": "^19.1.3",
45+
"@types/node": "^24.2.0",
46+
"@types/react": "^19.1.9",
47+
"@types/react-dom": "^19.1.7",
4848
"@types/uuid": "^10.0.0",
4949
"@vitejs/plugin-react": "^4.4.1",
5050
"globals": "^16.1.0",

apps/events/src/mapping.ts

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,43 @@
1-
import type { Mapping } from '@graphprotocol/hypergraph';
21
import { Id } from '@graphprotocol/hypergraph';
2+
import type { Mapping } from '@graphprotocol/hypergraph/mapping';
33

4-
export const mapping: Mapping.Mapping = {
5-
Event: {
6-
typeIds: [Id('7f9562d4-034d-4385-bf5c-f02cdebba47a')],
4+
export const mapping: Mapping = {
5+
User: {
6+
typeIds: [Id('bffa181e-a333-495b-949c-57f2831d7eca')],
77
properties: {
8-
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
9-
description: Id('9b1f76ff-9711-404c-861e-59dc3fa7d037'),
8+
name: Id('c9c79675-850a-42c5-bbbd-9e5c55d3f4e7'),
9+
created: Id('f8df1caf-14b4-4c1e-85fb-4e97f7d7070a'),
10+
},
11+
},
12+
Todo: {
13+
typeIds: [Id('44fe82a9-e4c2-4330-a395-ce85ed78e421')],
14+
properties: {
15+
name: Id('c668aa67-bbca-4b2c-908c-9c5599035eab'),
16+
completed: Id('71e7654f-2623-4794-88fb-841c8f3dd9b4'),
1017
},
1118
relations: {
12-
sponsors: Id('6860bfac-f703-4289-b789-972d0aaf3abe'),
19+
assignees: Id('5b80d3ee-2463-4246-b628-44ba808ab3e1'),
20+
},
21+
},
22+
Todo2: {
23+
typeIds: [Id('210f4e94-234c-49d7-af0f-f3b74fb07650')],
24+
properties: {
25+
name: Id('e291f4da-632d-4b70-aca8-5c6c01dbf1ca'),
26+
checked: Id('d1cc82ef-8bde-45f4-b31c-56b6d59279ec'),
27+
due: Id('6a28f275-b31c-47bc-83cd-ad416aaa7073'),
28+
amount: Id('0c8219be-e284-4738-bd95-91a1c113c78e'),
29+
point: Id('7f032477-c60e-4c85-a161-019b70db05ca'),
30+
website: Id('75b6a647-5c2b-41e7-92c0-b0a0c9b28b02'),
31+
},
32+
relations: {
33+
assignees: Id('1115e9f8-db2e-41df-8969-c5d34c367c10'),
34+
},
35+
},
36+
JobOffer: {
37+
typeIds: [Id('f60585af-71b6-4674-9a26-b74ca6c1cceb')],
38+
properties: {
39+
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
40+
salary: Id('baa36ac9-78ac-4cf7-8394-6b2d3006bebe'),
1341
},
1442
},
1543
Company: {
@@ -21,32 +49,24 @@ export const mapping: Mapping.Mapping = {
2149
jobOffers: Id('1203064e-9741-4235-89d4-97f4b22eddfb'),
2250
},
2351
},
24-
JobOffer: {
25-
typeIds: [Id('f60585af-71b6-4674-9a26-b74ca6c1cceb')],
52+
Event: {
53+
typeIds: [Id('7f9562d4-034d-4385-bf5c-f02cdebba47a')],
2654
properties: {
2755
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
28-
salary: Id('baa36ac9-78ac-4cf7-8394-6b2d3006bebe'),
56+
description: Id('9b1f76ff-9711-404c-861e-59dc3fa7d037'),
57+
createdAt: Id('e2e6906b-d2b6-48d2-8aa2-54e8b29f6933'),
58+
updatedAt: Id('2e877fe0-a504-4ea0-b43c-210d011db434'),
59+
},
60+
relations: {
61+
sponsors: Id('6860bfac-f703-4289-b789-972d0aaf3abe'),
62+
},
63+
},
64+
Todo3: {
65+
typeIds: [Id('4f7bba76-7855-4d63-b59d-1d9f2be866df')],
66+
properties: {
67+
name: Id('47006386-d351-411c-8287-1dae1c1aa8c1'),
68+
completed: Id('9f9f00eb-4f32-4f71-92ba-b266566d0013'),
69+
description: Id('89cac80a-1dbd-4bca-97b2-45e1556d9122'),
2970
},
3071
},
31-
32-
// Todo2: {
33-
// typeIds: [Id('LJuM8ju67mCv78FhAiK9k9')],
34-
// properties: {
35-
// name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
36-
// checked: Id('Ud9kn9gAUsCr1pxvxcgDj8'),
37-
// due: Id('CFisPgjjWVdnaMtSWJDBqA'),
38-
// point: Id('BkcVo7JZHF5LsWw7XZJwwe'),
39-
// website: Id('XZmLQ8XyaUHnNWgSSbzaHU'),
40-
// amount: Id('LfzKTfgy5Qg3PxAfKB2BL7'),
41-
// },
42-
// relations: {
43-
// assignees: Id('HCdFcTRyMyZMXScKox738i'),
44-
// },
45-
// },
46-
// User: {
47-
// typeIds: [Id('Fk5qzwdpKsD35gm5ts4SZA')],
48-
// properties: {
49-
// name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
50-
// },
51-
// },
5272
};

apps/events/src/schema.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Entity, Type } from '@graphprotocol/hypergraph';
22

33
export class User extends Entity.Class<User>('User')({
44
name: Type.String,
5+
created: Type.Date,
56
}) {}
67

78
export class Todo extends Entity.Class<Todo>('Todo')({
@@ -27,12 +28,19 @@ export class JobOffer extends Entity.Class<JobOffer>('JobOffer')({
2728

2829
export class Company extends Entity.Class<Company>('Company')({
2930
name: Type.String,
30-
// address: Type.String,
3131
jobOffers: Type.Relation(JobOffer),
3232
}) {}
3333

3434
export class Event extends Entity.Class<Event>('Event')({
3535
name: Type.String,
36-
description: Type.optional(Type.String),
36+
description: Type.String,
3737
sponsors: Type.Relation(Company),
38+
createdAt: Type.Date,
39+
updatedAt: Type.Date,
40+
}) {}
41+
42+
export class Todo3 extends Entity.Class<Todo3>('Todo3')({
43+
name: Type.String,
44+
completed: Type.Boolean,
45+
description: Type.String,
3846
}) {}

apps/next-example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@graphprotocol/hypergraph": "workspace:*",
1616
"@graphprotocol/hypergraph-react": "workspace:*",
1717
"next": "15.3.2",
18-
"react": "^19.0.0",
19-
"react-dom": "^19.0.0"
18+
"react": "^19.1.1",
19+
"react-dom": "^19.1.1"
2020
},
2121
"devDependencies": {
2222
"@types/node": "^22",

0 commit comments

Comments
 (0)