Skip to content

Commit 0915726

Browse files
committed
Merge branch 'main' into chris.whited/fix-published-pkg
2 parents e3ea4cc + 063c6af commit 0915726

File tree

111 files changed

+5893
-2267
lines changed

Some content is hidden

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

111 files changed

+5893
-2267
lines changed

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ RUN \
3737
# Create an isolated deployment for the server.
3838
pnpm --filter server deploy --prod deployment --legacy && \
3939
# Move the runtime build artifacts into a separate directory.
40-
mkdir -p deployment/out && mv deployment/dist deployment/prisma deployment/node_modules deployment/package.json deployment/out
40+
mkdir -p deployment/out && mv deployment/dist deployment/node_modules deployment/package.json deployment/out && \
41+
# Add prisma client in dist
42+
mv deployment/prisma/generated/client/libquery_engine-linux-musl-arm64-openssl-3.0.x.so.node deployment/out/dist/libquery_engine-linux-musl-arm64-openssl-3.0.x.so.node && \
43+
mv deployment/prisma/generated/client/libquery_engine-linux-musl-openssl-3.0.x.so.node deployment/out/dist/libquery_engine-linux-musl-openssl-3.0.x.so.node
4144

4245
# Slim runtime image.
4346
FROM node:22-alpine AS server

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,17 @@ pnpm dev
4444

4545
```sh
4646
pnpm up --interactive --latest -r
47+
```
48+
49+
## Publishing
50+
51+
```sh
52+
# publish hypergraph
53+
pnpm build
54+
cd packages/hypergraph/publish
55+
pnpm publish
56+
# publish hypergraph-react
57+
pnpm build
58+
cd packages/hypergraph-react/publish
59+
pnpm publish
4760
```

apps/connect/.env.development

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
VITE_HYPERGRAPH_SYNC_SERVER_ORIGIN="http://localhost:3030"
1+
VITE_HYPERGRAPH_SYNC_SERVER_ORIGIN="http://localhost:3030"
2+
VITE_HYPERGRAPH_CHAIN="geogenesis"
3+
VITE_HYPERGRAPH_API_URL="https://hypergraph-v2.up.railway.app/graphql"
4+
VITE_HYPERGRAPH_RPC_URL="https://rpc-geo-genesis-h0q2s21xx8.t.conduit.xyz"

apps/connect/.env.production

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
VITE_HYPERGRAPH_SYNC_SERVER_ORIGIN="https://syncserver.hypergraph.thegraph.com"
1+
VITE_HYPERGRAPH_SYNC_SERVER_ORIGIN="https://syncserver.hypergraph.thegraph.com"
2+
VITE_HYPERGRAPH_CHAIN="geogenesis"
3+
VITE_HYPERGRAPH_API_URL="https://hypergraph-v2.up.railway.app/graphql"
4+
VITE_HYPERGRAPH_RPC_URL="https://rpc-geo-genesis-h0q2s21xx8.t.conduit.xyz"

apps/connect/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"preview": "vite preview"
99
},
1010
"dependencies": {
11-
"@graphprotocol/grc-20": "^0.11.5",
1211
"@graphprotocol/hypergraph": "workspace:*",
1312
"@graphprotocol/hypergraph-react": "workspace:*",
1413
"@privy-io/react-auth": "^2.13.0",
@@ -22,6 +21,7 @@
2221
"clsx": "^2.1.1",
2322
"effect": "^3.16.3",
2423
"framer-motion": "^12.10.1",
24+
"graphql-request": "^7.2.0",
2525
"lucide-react": "^0.508.0",
2626
"react": "^19.1.0",
2727
"react-dom": "^19.1.0",

apps/connect/src/components/create-space.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export function CreateSpace() {
5454

5555
const message: Messages.RequestConnectCreateSpaceEvent = {
5656
type: 'connect-create-space-event',
57+
accountAddress,
5758
event: spaceEvent,
5859
spaceId: spaceEvent.transaction.id,
5960
keyBox: {

apps/connect/src/components/spaces.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import { useSpaces } from '@/hooks/use-spaces';
1+
import { usePrivateSpaces } from '@/hooks/use-private-spaces';
22

33
export function Spaces() {
4-
const { isPending, error, data } = useSpaces();
5-
6-
if (isPending) return 'Loading spaces …';
7-
8-
if (error) return `An error has occurred: ${error.message}`;
4+
const { isPending, error, data } = usePrivateSpaces();
95

106
return (
117
<div>
128
<h2 className="font-bold mb-2 mt-2">Spaces</h2>
139
<ul className="space-y-4">
14-
{data.map((space) => (
10+
{!isPending && !error && data && data.length === 0 && <p>No spaces found</p>}
11+
{isPending && <p>Loading spaces …</p>}
12+
{error && <p>An error has occurred loading spaces: {error.message}</p>}
13+
{data?.map((space) => (
1514
<li key={space.id}>
1615
<p>{space.name}</p>
1716
<p className="text-xs text-gray-500 mt-2 mb-1">Apps with access to this space</p>

apps/connect/src/hooks/use-spaces.ts renamed to apps/connect/src/hooks/use-private-spaces.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { getAppInfoByIds } from '@/lib/get-app-info-by-ids';
2+
import { Connect } from '@graphprotocol/hypergraph';
23
import { useIdentityToken } from '@privy-io/react-auth';
3-
import { useQuery } from '@tanstack/react-query';
4+
import { type UseQueryResult, useQuery } from '@tanstack/react-query';
45

56
type SpaceData = {
67
id: string;
@@ -15,15 +16,17 @@ type SpaceData = {
1516
}[];
1617
};
1718

18-
export const useSpaces = () => {
19+
export const usePrivateSpaces = (): UseQueryResult<SpaceData[], Error> => {
1920
const { identityToken } = useIdentityToken();
2021

2122
return useQuery<SpaceData[]>({
22-
queryKey: ['spaces'],
23+
queryKey: ['private-spaces'],
2324
queryFn: async () => {
2425
if (!identityToken) return [];
26+
const accountAddress = Connect.loadAccountAddress(localStorage);
27+
if (!accountAddress) return [];
2528
const response = await fetch(`${import.meta.env.VITE_HYPERGRAPH_SYNC_SERVER_ORIGIN}/connect/spaces`, {
26-
headers: { 'privy-id-token': identityToken },
29+
headers: { 'privy-id-token': identityToken, 'account-address': accountAddress },
2730
});
2831
const data = await response.json();
2932
const appIds = new Set<string>();
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { Connect } from '@graphprotocol/hypergraph';
2+
import { type UseQueryResult, useQuery } from '@tanstack/react-query';
3+
import { gql, request } from 'graphql-request';
4+
5+
const publicSpacesQueryDocument = gql`
6+
query Spaces($accountAddress: String!) {
7+
spaces(filter: {
8+
member: { is: $accountAddress }
9+
}) {
10+
id
11+
type
12+
mainVotingAddress
13+
personalAddress
14+
entity {
15+
name
16+
}
17+
}
18+
}
19+
`;
20+
21+
type SpaceQueryResult = {
22+
id: string;
23+
type: string;
24+
mainVotingAddress: string;
25+
personalAddress: string;
26+
entity: {
27+
name: string;
28+
};
29+
};
30+
31+
type PublicSpacesQueryResult = {
32+
spaces: SpaceQueryResult[];
33+
};
34+
35+
export type PublicSpaceData = {
36+
id: string;
37+
type: string;
38+
mainVotingAddress: string;
39+
personalAddress: string;
40+
name: string;
41+
};
42+
43+
export const usePublicSpaces = (url: string): UseQueryResult<PublicSpaceData[], Error> => {
44+
return useQuery<PublicSpaceData[]>({
45+
queryKey: ['public-spaces'],
46+
queryFn: async () => {
47+
const accountAddress = Connect.loadAccountAddress(localStorage);
48+
if (!accountAddress) return [];
49+
const result = await request<PublicSpacesQueryResult>(url, publicSpacesQueryDocument, {
50+
accountAddress,
51+
});
52+
return result?.spaces
53+
? result.spaces.map((space: SpaceQueryResult) => ({
54+
id: space.id,
55+
name: space.entity.name,
56+
type: space.type,
57+
mainVotingAddress: space.mainVotingAddress,
58+
personalAddress: space.personalAddress,
59+
}))
60+
: [];
61+
},
62+
});
63+
};

apps/connect/src/routes/__root.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export const Route = createRootRoute({
1414
}
1515

1616
if (ready && !authenticated) {
17+
if (router.state.location.href.startsWith('/authenticate')) {
18+
localStorage.setItem('geo-connect-authenticate-redirect', router.state.location.href);
19+
}
1720
router.navigate({
1821
to: '/login',
1922
});

0 commit comments

Comments
 (0)