Skip to content

Commit bea0602

Browse files
authored
fix(typesync): initial | move to v2 indexer endpoint. update queries (#345)
1 parent 8a24c4b commit bea0602

File tree

12 files changed

+2249
-11741
lines changed

12 files changed

+2249
-11741
lines changed

apps/typesync/client/src/Components/App/CreateAppForm/SchemaBuilder/PropertyCombobox.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function PropertyCombobox({ id, label, propertySelected, ...rest }: Reado
5959
field.handleChange(val);
6060
return;
6161
}
62-
field.handleChange(val.entity.name || val.id);
62+
field.handleChange(val.name || val.id);
6363
propertySelected(val);
6464
}}
6565
onClose={() => setPropsFilter('')}
@@ -92,23 +92,21 @@ export function PropertyCombobox({ id, label, propertySelected, ...rest }: Reado
9292
<ComboboxOption
9393
key={_prop.id}
9494
value={_prop}
95-
data-selected={value === _prop.entity.name || value === _prop.id ? true : undefined}
95+
data-selected={value === _prop.name || value === _prop.id ? true : undefined}
9696
className="group relative cursor-default py-2 pr-9 pl-3 text-gray-900 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden"
9797
>
9898
<div className="flex-auto flex flex-col gap-y-1">
9999
<div className="flex items-center justify-between gap-x-2">
100100
<p className="text-sm font-medium text-gray-700 dark:text-gray-100 group-data-focus:text-gray-900 dark:group-data-focus:text-white flex items-center gap-x-1.5">
101-
{_prop.entity.name || _prop.id}
102-
<InlineCode>
103-
{mapKGDataTypeToPrimitiveType(_prop.dataType, _prop.entity.name || _prop.id)}
104-
</InlineCode>
101+
{_prop.name || _prop.id}
102+
<InlineCode>{mapKGDataTypeToPrimitiveType(_prop.dataType, _prop.name || _prop.id)}</InlineCode>
105103
</p>
106104
<p className="w-fit">
107105
<InlineCode>{_prop.id}</InlineCode>
108106
</p>
109107
</div>
110108
<p className="text-xs text-gray-500 dark:text-gray-300 group-data-focus:text-gray-700 dark:group-data-focus:text-gray-50">
111-
{_prop.entity.description}
109+
{_prop.description}
112110
</p>
113111
</div>
114112

apps/typesync/client/src/Components/App/CreateAppForm/SchemaBuilder/SchemaBrowser.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,9 @@ export function SchemaBrowser({ typeSelected }: SchemaBrowserProps) {
9595
<ul className="w-full pl-6 pr-3 divide-y divide-gray-300 dark:divide-gray-800">
9696
{properties.map((prop) => (
9797
<li key={prop.id} className="w-full text-xs py-1.5 flex items-center gap-x-2 list-disc">
98-
{prop.entity?.name || prop.id}
98+
{prop.name || prop.id}
9999
{prop.dataType != null ? (
100-
<InlineCode>
101-
{mapKGDataTypeToPrimitiveType(prop.dataType, prop.entity?.name || prop.id)}
102-
</InlineCode>
100+
<InlineCode>{mapKGDataTypeToPrimitiveType(prop.dataType, prop.name || prop.id)}</InlineCode>
103101
) : null}
104102
</li>
105103
))}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Graph } from '@graphprotocol/grc-20';
12
import { GraphQLClient } from 'graphql-request';
23

3-
export const graphqlClient = new GraphQLClient('https://hypergraph-v2-testnet.up.railway.app/graphql');
4+
export const graphqlClient = new GraphQLClient(`${Graph.TESTNET_API_ORIGIN}/graphql`);
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
export const API_ROOT_URL = 'http://localhost:3000/api/v1';
2-
export const ROOT_SPACE_ID = '2df11968-9d1c-489f-91b7-bdc88b472161';

apps/typesync/client/src/generated/gql.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* eslint-disable */
2-
import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
3-
42
import * as types from './graphql';
3+
import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
54

65
/**
76
* Map of all GraphQL operations in the project.
@@ -15,12 +14,12 @@ import * as types from './graphql';
1514
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1615
*/
1716
type Documents = {
18-
"\n query SchemaBrowserTypes($spaceId: String!, $limit: Int) {\n types(spaceId: $spaceId, limit: $limit) {\n id\n name\n properties {\n id\n dataType\n entity {\n id\n name\n }\n relationValueTypes {\n id\n name\n description\n properties {\n id\n dataType\n entity {\n id\n name\n }\n }\n }\n }\n }\n }\n": typeof types.SchemaBrowserTypesDocument,
19-
"\n query Properties {\n properties {\n id\n dataType \n entity {\n id\n name\n description\n }\n relationValueTypes {\n id\n name\n description\n properties {\n id\n dataType\n entity {\n id\n name\n }\n }\n }\n }\n }\n": typeof types.PropertiesDocument,
17+
"\n query SchemaBrowserTypes($first: Int) {\n typesList(first: $first) {\n id\n name\n description\n properties {\n id\n name\n dataType\n relationValueTypes {\n id\n name\n description\n properties {\n id\n name\n dataType\n }\n }\n }\n }\n }\n": typeof types.SchemaBrowserTypesDocument,
18+
"\n query Properties($first: Int) {\n properties(first: $first) {\n id\n name\n description\n dataType\n relationValueTypes {\n id\n name\n description\n properties {\n id\n dataType\n name\n }\n }\n }\n }\n": typeof types.PropertiesDocument,
2019
};
2120
const documents: Documents = {
22-
"\n query SchemaBrowserTypes($spaceId: String!, $limit: Int) {\n types(spaceId: $spaceId, limit: $limit) {\n id\n name\n properties {\n id\n dataType\n entity {\n id\n name\n }\n relationValueTypes {\n id\n name\n description\n properties {\n id\n dataType\n entity {\n id\n name\n }\n }\n }\n }\n }\n }\n": types.SchemaBrowserTypesDocument,
23-
"\n query Properties {\n properties {\n id\n dataType \n entity {\n id\n name\n description\n }\n relationValueTypes {\n id\n name\n description\n properties {\n id\n dataType\n entity {\n id\n name\n }\n }\n }\n }\n }\n": types.PropertiesDocument,
21+
"\n query SchemaBrowserTypes($first: Int) {\n typesList(first: $first) {\n id\n name\n description\n properties {\n id\n name\n dataType\n relationValueTypes {\n id\n name\n description\n properties {\n id\n name\n dataType\n }\n }\n }\n }\n }\n": types.SchemaBrowserTypesDocument,
22+
"\n query Properties($first: Int) {\n properties(first: $first) {\n id\n name\n description\n dataType\n relationValueTypes {\n id\n name\n description\n properties {\n id\n dataType\n name\n }\n }\n }\n }\n": types.PropertiesDocument,
2423
};
2524

2625
/**
@@ -40,11 +39,11 @@ export function graphql(source: string): unknown;
4039
/**
4140
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
4241
*/
43-
export function graphql(source: "\n query SchemaBrowserTypes($spaceId: String!, $limit: Int) {\n types(spaceId: $spaceId, limit: $limit) {\n id\n name\n properties {\n id\n dataType\n entity {\n id\n name\n }\n relationValueTypes {\n id\n name\n description\n properties {\n id\n dataType\n entity {\n id\n name\n }\n }\n }\n }\n }\n }\n"): (typeof documents)["\n query SchemaBrowserTypes($spaceId: String!, $limit: Int) {\n types(spaceId: $spaceId, limit: $limit) {\n id\n name\n properties {\n id\n dataType\n entity {\n id\n name\n }\n relationValueTypes {\n id\n name\n description\n properties {\n id\n dataType\n entity {\n id\n name\n }\n }\n }\n }\n }\n }\n"];
42+
export function graphql(source: "\n query SchemaBrowserTypes($first: Int) {\n typesList(first: $first) {\n id\n name\n description\n properties {\n id\n name\n dataType\n relationValueTypes {\n id\n name\n description\n properties {\n id\n name\n dataType\n }\n }\n }\n }\n }\n"): (typeof documents)["\n query SchemaBrowserTypes($first: Int) {\n typesList(first: $first) {\n id\n name\n description\n properties {\n id\n name\n dataType\n relationValueTypes {\n id\n name\n description\n properties {\n id\n name\n dataType\n }\n }\n }\n }\n }\n"];
4443
/**
4544
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
4645
*/
47-
export function graphql(source: "\n query Properties {\n properties {\n id\n dataType \n entity {\n id\n name\n description\n }\n relationValueTypes {\n id\n name\n description\n properties {\n id\n dataType\n entity {\n id\n name\n }\n }\n }\n }\n }\n"): (typeof documents)["\n query Properties {\n properties {\n id\n dataType \n entity {\n id\n name\n description\n }\n relationValueTypes {\n id\n name\n description\n properties {\n id\n dataType\n entity {\n id\n name\n }\n }\n }\n }\n }\n"];
46+
export function graphql(source: "\n query Properties($first: Int) {\n properties(first: $first) {\n id\n name\n description\n dataType\n relationValueTypes {\n id\n name\n description\n properties {\n id\n dataType\n name\n }\n }\n }\n }\n"): (typeof documents)["\n query Properties($first: Int) {\n properties(first: $first) {\n id\n name\n description\n dataType\n relationValueTypes {\n id\n name\n description\n properties {\n id\n dataType\n name\n }\n }\n }\n }\n"];
4847

4948
export function graphql(source: string) {
5049
return (documents as any)[source] ?? {};

0 commit comments

Comments
 (0)