Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/icy-emus-tap.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class User extends Entity.Class<User>('User')({

After:
```ts
export const User = EntitySchema(
export const User = Entity.Schema(
{ name: Type.String },
{
types: [Id('bffa181e-a333-495b-949c-57f2831d7eca')],
Expand Down
18 changes: 9 additions & 9 deletions apps/events/src/schema.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EntitySchema, Id, Type } from '@graphprotocol/hypergraph';
import { Entity, Id, Type } from '@graphprotocol/hypergraph';

export const User = EntitySchema(
export const User = Entity.Schema(
{ name: Type.String },
{
types: [Id('bffa181e-a333-495b-949c-57f2831d7eca')],
Expand All @@ -10,7 +10,7 @@ export const User = EntitySchema(
},
);

export const Todo = EntitySchema(
export const Todo = Entity.Schema(
{
name: Type.String,
completed: Type.Boolean,
Expand All @@ -26,7 +26,7 @@ export const Todo = EntitySchema(
},
);

export const Todo2 = EntitySchema(
export const Todo2 = Entity.Schema(
{
name: Type.String,
checked: Type.Boolean,
Expand All @@ -50,7 +50,7 @@ export const Todo2 = EntitySchema(
},
);

export const JobOffer = EntitySchema(
export const JobOffer = Entity.Schema(
{
name: Type.String,
salary: Type.Number,
Expand All @@ -64,7 +64,7 @@ export const JobOffer = EntitySchema(
},
);

export const Company = EntitySchema(
export const Company = Entity.Schema(
{
name: Type.String,
jobOffers: Type.Relation(JobOffer),
Expand All @@ -78,7 +78,7 @@ export const Company = EntitySchema(
},
);

export const Event = EntitySchema(
export const Event = Entity.Schema(
{
name: Type.String,
description: Type.optional(Type.String),
Expand All @@ -94,7 +94,7 @@ export const Event = EntitySchema(
},
);

export const Image = EntitySchema(
export const Image = Entity.Schema(
{
url: Type.String,
},
Expand All @@ -106,7 +106,7 @@ export const Image = EntitySchema(
},
);

export const Project = EntitySchema(
export const Project = Entity.Schema(
{
name: Type.String,
description: Type.optional(Type.String),
Expand Down
18 changes: 9 additions & 9 deletions apps/privy-login-example/src/schema.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EntitySchema, Id, Type } from '@graphprotocol/hypergraph';
import { Entity, Id, Type } from '@graphprotocol/hypergraph';

export const User = EntitySchema(
export const User = Entity.Schema(
{ name: Type.String },
{
types: [Id('bffa181e-a333-495b-949c-57f2831d7eca')],
Expand All @@ -10,7 +10,7 @@ export const User = EntitySchema(
},
);

export const Todo = EntitySchema(
export const Todo = Entity.Schema(
{
name: Type.String,
completed: Type.Boolean,
Expand All @@ -26,7 +26,7 @@ export const Todo = EntitySchema(
},
);

export const Todo2 = EntitySchema(
export const Todo2 = Entity.Schema(
{
name: Type.String,
checked: Type.Boolean,
Expand All @@ -50,7 +50,7 @@ export const Todo2 = EntitySchema(
},
);

export const JobOffer = EntitySchema(
export const JobOffer = Entity.Schema(
{
name: Type.String,
salary: Type.Number,
Expand All @@ -64,7 +64,7 @@ export const JobOffer = EntitySchema(
},
);

export const Company = EntitySchema(
export const Company = Entity.Schema(
{
name: Type.String,
jobOffers: Type.Relation(JobOffer),
Expand All @@ -78,7 +78,7 @@ export const Company = EntitySchema(
},
);

export const Event = EntitySchema(
export const Event = Entity.Schema(
{
name: Type.String,
description: Type.optional(Type.String),
Expand All @@ -94,7 +94,7 @@ export const Event = EntitySchema(
},
);

export const Image = EntitySchema(
export const Image = Entity.Schema(
{
url: Type.String,
},
Expand All @@ -106,7 +106,7 @@ export const Image = EntitySchema(
},
);

export const Project = EntitySchema(
export const Project = Entity.Schema(
{
name: Type.String,
description: Type.optional(Type.String),
Expand Down
16 changes: 8 additions & 8 deletions apps/template-nextjs/app/schema.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EntitySchema, Id, Type } from '@graphprotocol/hypergraph';
import { Entity, Id, Type } from '@graphprotocol/hypergraph';

export const Image = EntitySchema(
export const Image = Entity.Schema(
{
url: Type.String,
},
Expand All @@ -12,7 +12,7 @@ export const Image = EntitySchema(
},
);

export const Project = EntitySchema(
export const Project = Entity.Schema(
{
name: Type.String,
description: Type.optional(Type.String),
Expand All @@ -30,7 +30,7 @@ export const Project = EntitySchema(
},
);

export const Dapp = EntitySchema(
export const Dapp = Entity.Schema(
{
name: Type.String,
description: Type.optional(Type.String),
Expand All @@ -50,7 +50,7 @@ export const Dapp = EntitySchema(
},
);

export const Investor = EntitySchema(
export const Investor = Entity.Schema(
{
name: Type.String,
},
Expand All @@ -62,7 +62,7 @@ export const Investor = EntitySchema(
},
);

export const FundingStage = EntitySchema(
export const FundingStage = Entity.Schema(
{
name: Type.String,
},
Expand All @@ -74,7 +74,7 @@ export const FundingStage = EntitySchema(
},
);

export const InvestmentRound = EntitySchema(
export const InvestmentRound = Entity.Schema(
{
name: Type.String,
raisedAmount: Type.optional(Type.Number),
Expand All @@ -94,7 +94,7 @@ export const InvestmentRound = EntitySchema(
},
);

export const Asset = EntitySchema(
export const Asset = Entity.Schema(
{
name: Type.String,
symbol: Type.optional(Type.String),
Expand Down
16 changes: 8 additions & 8 deletions apps/template-vite-react/src/schema.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EntitySchema, Id, Type } from '@graphprotocol/hypergraph';
import { Entity, Id, Type } from '@graphprotocol/hypergraph';

export const Image = EntitySchema(
export const Image = Entity.Schema(
{
url: Type.String,
},
Expand All @@ -12,7 +12,7 @@ export const Image = EntitySchema(
},
);

export const Project = EntitySchema(
export const Project = Entity.Schema(
{
name: Type.String,
description: Type.optional(Type.String),
Expand All @@ -30,7 +30,7 @@ export const Project = EntitySchema(
},
);

export const Dapp = EntitySchema(
export const Dapp = Entity.Schema(
{
name: Type.String,
description: Type.optional(Type.String),
Expand All @@ -50,7 +50,7 @@ export const Dapp = EntitySchema(
},
);

export const Investor = EntitySchema(
export const Investor = Entity.Schema(
{
name: Type.String,
},
Expand All @@ -62,7 +62,7 @@ export const Investor = EntitySchema(
},
);

export const FundingStage = EntitySchema(
export const FundingStage = Entity.Schema(
{
name: Type.String,
},
Expand All @@ -74,7 +74,7 @@ export const FundingStage = EntitySchema(
},
);

export const InvestmentRound = EntitySchema(
export const InvestmentRound = Entity.Schema(
{
name: Type.String,
raisedAmount: Type.optional(Type.Number),
Expand All @@ -94,7 +94,7 @@ export const InvestmentRound = EntitySchema(
},
);

export const Asset = EntitySchema(
export const Asset = Entity.Schema(
{
name: Type.String,
symbol: Type.optional(Type.String),
Expand Down
47 changes: 29 additions & 18 deletions docs/docs/filtering-query-results.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ The filter API allows you to filter the results of a query by property values an
## Filtering by property values

```tsx
export class Event extends Entity.Class<Event>("Event")({
name: Type.String,
cancelled: Type.Boolean,
}) {}
export const Event = Entity.Schema(
{ name: Type.String, cancelled: Type.Boolean },
{
types: [Id('event-type-id')],
properties: { name: Id('name-property-id'), cancelled: Id('cancelled-property-id') },
},
);

// inside the React component
const { data } = useEntities(Event, {
Expand Down Expand Up @@ -128,11 +131,17 @@ const { data } = useEntities(Person, {

```tsx
// schema
export class Todo extends Entity.Class<Todo2>('Todo')({
name: Type.String,
checked: Type.Boolean,
assignees: Type.Relation(User),
})
export const Todo = Entity.Schema(
{ name: Type.String, checked: Type.Boolean, assignees: Type.Relation(User) },
{
types: [Id('todo-type-id')],
properties: {
name: Id('name-property-id'),
checked: Id('checked-property-id'),
assignees: Id('assignees-property-id'),
},
},
);
```

1 level filtering
Expand Down Expand Up @@ -171,15 +180,17 @@ const { data } = useEntities(Person, {

```tsx
// schema
export class Todo extends Entity.Class<Todo2>('Todo')({
name: Type.String,
checked: Type.Boolean,
assignees: Type.Relation(User, {
entity: {
assignedAt: Type.DateTime,
}
}),
})
export const Todo = Entity.Schema(
{ name: Type.String, checked: Type.Boolean, assignees: Type.Relation(User) },
{
types: [Id('todo-type-id')],
properties: {
name: Id('name-property-id'),
checked: Id('checked-property-id'),
assignees: Id('assignees-property-id'),
},
},
);
```

```tsx
Expand Down
41 changes: 0 additions & 41 deletions docs/docs/mapping.md

This file was deleted.

Loading
Loading