Skip to content

Commit c9afc3d

Browse files
committed
fix types
1 parent 1c820b2 commit c9afc3d

File tree

6 files changed

+78
-16
lines changed

6 files changed

+78
-16
lines changed

apps/events/src/components/events/events.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Entity } from '@graphprotocol/hypergraph';
12
import {
23
preparePublish,
34
publishOps,
@@ -19,7 +20,7 @@ export const Events = () => {
1920
const { data: spaces } = useSpaces({ mode: 'public' });
2021
const [selectedSpace, setSelectedSpace] = useState<string>('');
2122

22-
const handlePublish = async (event: Event) => {
23+
const handlePublish = async (event: Entity.Entity<typeof Event>) => {
2324
if (!selectedSpace) {
2425
alert('No space selected');
2526
return;

apps/events/src/components/user-entry.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import type { Entity } from '@graphprotocol/hypergraph';
12
import { useDeleteEntity, useUpdateEntity } from '@graphprotocol/hypergraph-react';
23
import { useState } from 'react';
34
import { User } from '../schema.js';
45
import { Button } from './ui/button';
56
import { Input } from './ui/input.js';
67

7-
export const UserEntry = (user: User & { id: string }) => {
8+
export const UserEntry = (user: Entity.Entity<typeof User> & { id: string }) => {
89
const deleteEntity = useDeleteEntity();
910
const updateEntity = useUpdateEntity(User);
1011
const [editMode, setEditMode] = useState(false);

apps/privy-login-example/src/components/events/events.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Entity } from '@graphprotocol/hypergraph';
12
import {
23
preparePublish,
34
publishOps,
@@ -19,7 +20,7 @@ export const Events = () => {
1920
const { data: spaces } = useSpaces({ mode: 'public' });
2021
const [selectedSpace, setSelectedSpace] = useState<string>('');
2122

22-
const handlePublish = async (event: Event) => {
23+
const handlePublish = async (event: Entity.Entity<typeof Event>) => {
2324
if (!selectedSpace) {
2425
alert('No space selected');
2526
return;

apps/privy-login-example/src/components/user-entry.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import type { Entity } from '@graphprotocol/hypergraph';
12
import { useDeleteEntity, useUpdateEntity } from '@graphprotocol/hypergraph-react';
23
import { useState } from 'react';
34
import { User } from '../schema.js';
45
import { Button } from './ui/button';
56
import { Input } from './ui/input.js';
67

7-
export const UserEntry = (user: User & { id: string }) => {
8+
export const UserEntry = (user: Entity.Entity<typeof User> & { id: string }) => {
89
const deleteEntity = useDeleteEntity();
910
const updateEntity = useUpdateEntity(User);
1011
const [editMode, setEditMode] = useState(false);
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import type { Mapping } from '@graphprotocol/hypergraph';
2+
import { Id } from '@graphprotocol/hypergraph';
3+
4+
export const mapping: Mapping.Mapping = {
5+
User: {
6+
typeIds: [Id('bffa181e-a333-495b-949c-57f2831d7eca')],
7+
properties: {
8+
name: Id('c9c79675-850a-42c5-bbbd-9e5c55d3f4e7'),
9+
},
10+
},
11+
Todo: {
12+
typeIds: [Id('44fe82a9-e4c2-4330-a395-ce85ed78e421')],
13+
properties: {
14+
name: Id('c668aa67-bbca-4b2c-908c-9c5599035eab'),
15+
completed: Id('71e7654f-2623-4794-88fb-841c8f3dd9b4'),
16+
},
17+
relations: {
18+
assignees: Id('5b80d3ee-2463-4246-b628-44ba808ab3e1'),
19+
},
20+
},
21+
Todo2: {
22+
typeIds: [Id('210f4e94-234c-49d7-af0f-f3b74fb07650')],
23+
properties: {
24+
name: Id('e291f4da-632d-4b70-aca8-5c6c01dbf1ca'),
25+
checked: Id('d1cc82ef-8bde-45f4-b31c-56b6d59279ec'),
26+
due: Id('6a28f275-b31c-47bc-83cd-ad416aaa7073'),
27+
amount: Id('0c8219be-e284-4738-bd95-91a1c113c78e'),
28+
point: Id('7f032477-c60e-4c85-a161-019b70db05ca'),
29+
website: Id('75b6a647-5c2b-41e7-92c0-b0a0c9b28b02'),
30+
},
31+
relations: {
32+
assignees: Id('1115e9f8-db2e-41df-8969-c5d34c367c10'),
33+
},
34+
},
35+
JobOffer: {
36+
typeIds: [Id('a4c1b288-756e-477b-aab2-007decf01c61')],
37+
properties: {
38+
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
39+
salary: Id('86ff5361-b820-4ba8-b689-b48e815e07d2'),
40+
},
41+
},
42+
Company: {
43+
typeIds: [Id('bcf56f59-c532-47d5-a005-2d802f512c85')],
44+
properties: {
45+
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
46+
},
47+
relations: {
48+
jobOffers: Id('54190b30-1c68-499c-9ed8-5c6190810e31'),
49+
},
50+
},
51+
Event: {
52+
typeIds: [Id('239bc639-938e-427c-bebb-d562d82ae272')],
53+
properties: {
54+
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
55+
description: Id('9b1f76ff-9711-404c-861e-59dc3fa7d037'),
56+
},
57+
relations: {
58+
sponsors: Id('926b00ee-68b5-4462-a27f-3806af705118'),
59+
},
60+
},
61+
Todo3: {
62+
typeIds: [Id('4f7bba76-7855-4d63-b59d-1d9f2be866df')],
63+
properties: {
64+
name: Id('47006386-d351-411c-8287-1dae1c1aa8c1'),
65+
completed: Id('9f9f00eb-4f32-4f71-92ba-b266566d0013'),
66+
description: Id('89cac80a-1dbd-4bca-97b2-45e1556d9122'),
67+
},
68+
},
69+
};

packages/hypergraph-react/test/internal/translate-filter-to-graphql.test.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Graph, Id } from '@graphprotocol/grc-20';
2-
import { type Entity, EntitySchema, type Mapping, Type } from '@graphprotocol/hypergraph';
2+
import { type Entity, EntitySchema, Type } from '@graphprotocol/hypergraph';
33
import type * as Schema from 'effect/Schema';
44
import { describe, expect, it } from 'vitest';
55
import { translateFilterToGraphql } from '../../src/internal/translate-filter-to-graphql.js';
@@ -20,17 +20,6 @@ export const Todo = EntitySchema(
2020
},
2121
);
2222

23-
const _mapping: Mapping.Mapping = {
24-
Todo: {
25-
typeIds: [Id('a288444f-06a3-4037-9ace-66fe325864d0')],
26-
properties: {
27-
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
28-
completed: Id('d2d64cd3-a337-4784-9e30-25bea0349471'),
29-
priority: Id('ee920534-42ce-4113-a63b-8f3c889dd772'),
30-
},
31-
},
32-
};
33-
3423
type TodoFilter = Entity.EntityFilter<Schema.Schema.Type<typeof Todo>>;
3524

3625
describe('translateFilterToGraphql string filters', () => {

0 commit comments

Comments
 (0)