Skip to content

Commit fbbd71b

Browse files
authored
fix(#392 | typesync api): move @graphprotocol/typesync Mapping api into @graphprotocol/hypergraph (#393)
1 parent 1e8fa58 commit fbbd71b

File tree

20 files changed

+1479
-31
lines changed

20 files changed

+1479
-31
lines changed

apps/connect/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# connect
22

3+
## 0.1.1
4+
### Patch Changes
5+
6+
- Updated dependencies [8622688]
7+
- @graphprotocol/hypergraph-react@1.0.0
8+
- @graphprotocol/hypergraph@0.2.0
9+
310
## 0.1.0
411
### Patch Changes
512

apps/connect/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "connect",
33
"private": true,
4-
"version": "0.1.0",
4+
"version": "0.1.1",
55
"type": "module",
66
"scripts": {
77
"dev": "vite --force",

apps/events/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"@graphprotocol/grc-20": "^0.21.6",
1212
"@graphprotocol/hypergraph": "workspace:*",
1313
"@graphprotocol/hypergraph-react": "workspace:*",
14-
"@graphprotocol/typesync": "workspace:*",
1514
"@noble/hashes": "^1.8.0",
1615
"@radix-ui/react-avatar": "^1.1.9",
1716
"@radix-ui/react-icons": "^1.3.2",

apps/events/src/mapping.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Id } from '@graphprotocol/grc-20';
2-
import type { Mapping } from '@graphprotocol/typesync/Mapping';
2+
import type { Mapping } from '@graphprotocol/hypergraph';
33

4-
export const mapping: Mapping = {
4+
export const mapping: Mapping.Mapping = {
55
Event: {
66
typeIds: [Id.Id('7f9562d4-034d-4385-bf5c-f02cdebba47a')],
77
properties: {

apps/server/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# server
22

3+
## 0.1.1
4+
### Patch Changes
5+
6+
- Updated dependencies [8622688]
7+
- @graphprotocol/hypergraph@0.2.0
8+
39
## 0.1.0
410
### Patch Changes
511

apps/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "server",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"private": true,
55
"type": "module",
66
"scripts": {

packages/hypergraph-react/CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# @graphprotocol/hypergraph-react
22

3+
## 1.0.0
4+
### Minor Changes
5+
6+
- 8622688: Move @graphprotocol/typesync Mapping and Utils into @graphprotocol/hypergraph package and export from there. Update @graphprotocol/hypergraph-react to use mapping from @graphprotocol/hypergraph.
7+
8+
9+
## Changes needed
10+
11+
Any use of `@graphprotocol/typesync` should use the exported mapping and utils from `@graphprotocol/hypergraph` instead.
12+
13+
### Example
14+
15+
```ts
16+
// before
17+
import type { Mapping } from '@graphprotocol/typesync/Mapping'
18+
19+
// after
20+
import type { Mapping } from '@graphprotocol/hypergraph/mapping'
21+
```
22+
23+
### Patch Changes
24+
25+
- Updated dependencies [8622688]
26+
- @graphprotocol/hypergraph@0.2.0
27+
328
## 0.1.0
429
### Patch Changes
530

packages/hypergraph-react/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/hypergraph-react",
3-
"version": "0.1.0",
3+
"version": "1.0.0",
44
"description": "React implementation and additional functionality, components, and hooks for the hypergraph SDK framework",
55
"keywords": [
66
"Web3",
@@ -31,12 +31,10 @@
3131
},
3232
"peerDependencies": {
3333
"@graphprotocol/hypergraph": "workspace:*",
34-
"@graphprotocol/typesync": "workspace:*",
3534
"react": "^18.0.0 || ^19.0.0"
3635
},
3736
"devDependencies": {
3837
"@graphprotocol/hypergraph": "workspace:*",
39-
"@graphprotocol/typesync": "workspace:*",
4038
"@testing-library/jest-dom": "^6.6.3",
4139
"@testing-library/react": "^16.3.0",
4240
"@types/react": "^19.1.3",

packages/hypergraph-react/src/HypergraphAppContext.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ import {
1515
Inboxes,
1616
type InboxMessageStorageEntry,
1717
Key,
18+
type Mapping,
1819
Messages,
1920
SpaceEvents,
2021
type SpaceStorageEntry,
2122
store,
2223
Utils,
2324
} from '@graphprotocol/hypergraph';
24-
import type { Mapping } from '@graphprotocol/typesync/Mapping';
2525
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
2626
import { useSelector as useSelectorStore } from '@xstate/store/react';
2727
import { Effect, Exit } from 'effect';
@@ -219,7 +219,7 @@ export type HypergraphAppProviderProps = Readonly<{
219219
syncServerUri?: string;
220220
chainId?: number;
221221
children: ReactNode;
222-
mapping: Mapping;
222+
mapping: Mapping.Mapping;
223223
appId: string;
224224
}>;
225225

packages/hypergraph-react/src/internal/use-query-public.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Graph } from '@graphprotocol/grc-20';
2-
import { type Entity, store, Type } from '@graphprotocol/hypergraph';
3-
import type { Mapping, MappingEntry } from '@graphprotocol/typesync/Mapping';
2+
import { type Entity, type Mapping, store, Type } from '@graphprotocol/hypergraph';
43
import { useQuery as useQueryTanstack } from '@tanstack/react-query';
54
import { useSelector } from '@xstate/store/react';
65
import * as Either from 'effect/Either';
@@ -172,8 +171,8 @@ const convertPropertyValue = (
172171
const convertRelations = <S extends Entity.AnyNoContext>(
173172
queryEntity: RecursiveQueryEntity,
174173
type: S,
175-
mappingEntry: MappingEntry,
176-
mapping: Mapping,
174+
mappingEntry: Mapping.MappingEntry,
175+
mapping: Mapping.Mapping,
177176
) => {
178177
const rawEntity: Record<string, string | boolean | number | unknown[] | Date> = {};
179178

@@ -251,8 +250,8 @@ const convertRelations = <S extends Entity.AnyNoContext>(
251250
export const parseResult = <S extends Entity.AnyNoContext>(
252251
queryData: EntityQueryResult,
253252
type: S,
254-
mappingEntry: MappingEntry,
255-
mapping: Mapping,
253+
mappingEntry: Mapping.MappingEntry,
254+
mapping: Mapping.Mapping,
256255
) => {
257256
const decode = Schema.decodeUnknownEither(type);
258257
const data: Entity.Entity<S>[] = [];

0 commit comments

Comments
 (0)