Skip to content
Closed
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
1 change: 1 addition & 0 deletions apps/events/src/components/add-user.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const AddUser: React.FC = () => {
name: newUserName,
age: 30,
email: '[email protected]',
badge: { name: 'new user' },
});
setNewUserName('');
}}
Expand Down
2 changes: 1 addition & 1 deletion apps/events/src/lib/deserialize.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const deserialize = (data: string) => {
return JSON.parse(data, (key, value) => {
return JSON.parse(data, (__key, value) => {
if (typeof value === 'object' && value !== null && value.type === 'Uint8Array') {
return new Uint8Array(value.data);
Comment on lines +2 to 4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤮🤮🤮🤮

}
Expand Down
4 changes: 2 additions & 2 deletions apps/events/src/lib/serialize.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
export const serialize = (data: any) => {
return JSON.stringify(data, (key, value) => {
return JSON.stringify(data, (_key, value) => {
if (value instanceof Uint8Array) {
return { type: 'Uint8Array', data: Array.from(value) };
Comment on lines +3 to 5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤮🤮🤮🤮

}
Expand Down
9 changes: 3 additions & 6 deletions apps/events/src/routes/login.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ const Login = () => {

const connectWallet = async () => {
let newSigner = null;
let provider;
let provider: ethers.AbstractProvider | ethers.BrowserProvider;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use Viem instead of Ethers? https://github.com/wevm/viem
Or maybe even go as low as Ox? https://github.com/wevm/ox


try {
// @ts-expect-error ethereum is defined in the browser
if (window.ethereum == null) {
// If MetaMask is not installed, we use the default provider,
// which is backed by a variety of third-party services (such
Expand All @@ -25,13 +24,12 @@ const Login = () => {
// Connect to the MetaMask EIP-1193 object. This is a standard
// protocol that allows Ethers access to make all read-only
// requests through MetaMask.
// @ts-expect-error ethereum is defined in the browser
provider = new ethers.BrowserProvider(window.ethereum);

// It also provides an opportunity to request access to write
// operations, which will be performed by the private key
// that MetaMask manages for the user.
newSigner = await provider.getSigner();
newSigner = await (provider as ethers.BrowserProvider).getSigner();

setSigner(newSigner);
const address = await newSigner?.getAddress();
Expand All @@ -46,7 +44,6 @@ const Login = () => {
async function runEffect() {
const storedSignerAddress = localStorage.getItem('signerAddress');
if (storedSignerAddress) {
// @ts-expect-error ethereum is defined in the browser
const provider = new ethers.BrowserProvider(window.ethereum);
const newSigner = await provider.getSigner();
setSigner(newSigner);
Expand Down Expand Up @@ -89,9 +86,9 @@ function XmtpLogin({ signer }: { signer: Signer }) {
redirect({ to: '/space/$spaceId', params: { spaceId: 'abc' } });
};

// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
useEffect(() => {
void initXmtpWithKeys();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

if (isLoading) {
Expand Down
6 changes: 5 additions & 1 deletion apps/events/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"references": [{ "path": "../../packages/graph-framework" }],
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
Expand All @@ -24,7 +26,9 @@
/* Shadcn */
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
"@/*": ["./src/*"],
"graph-framework": ["../../packages/graph-framework/src/index.js"],
"graph-framework/*": ["../../packages/graph-framework/src/*.js"]
}
},
"include": ["src"]
Expand Down
4 changes: 3 additions & 1 deletion apps/events/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
/* Shadcn */
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
"@/*": ["./src/*"],
"graph-framework": ["../../packages/graph-framework/src/index.js"],
"graph-framework/*": ["../../packages/graph-framework/src/*.js"]
}
}
}
2 changes: 2 additions & 0 deletions apps/events/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"references": [{ "path": "../../packages/graph-framework" }],
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2023"],
Expand Down
2 changes: 1 addition & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"files": {
"ignoreUnknown": false,
"ignore": ["node_modules/", "**/node_modules", "**/dist", "routeTree.gen.ts"]
"ignore": ["node_modules/", "**/node_modules", "**/build", "**/dist", "routeTree.gen.ts"]
},
"formatter": {
"enabled": true,
Expand Down
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,30 @@
"type": "module",
"workspaces": ["apps/*", "packages/*"],
"devDependencies": {
"@babel/cli": "^7.25.9",
"@babel/core": "^7.26.0",
"@babel/plugin-transform-export-namespace-from": "^7.25.9",
"@babel/plugin-transform-modules-commonjs": "^7.25.9",
"@biomejs/biome": "1.9.4",
"@effect/build-utils": "^0.7.8",
"babel-plugin-annotate-pure-calls": "^0.4.0",
"escape-string-regexp": "^5.0.0",
"typescript": "^5.6.3",
"vite": "^5.4.10",
"vitest": "^2.1.4",
"vite-plugin-dts": "^4.3.0"
},
"scripts": {
"build": "pnpm --filter graph-framework-utils build",
"build": "tsc -b tsconfig.build.json && pnpm --recursive --parallel run build",
"ts:check": "pnpm -r ts:check",
"test": "pnpm -r test",
"lint": "pnpm -r lint",
"format": "pnpm -r format",
"check": "pnpm -r check"
},
"pnpm": {
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll also need to remember to add the changeset patches. Otherwise every minor or patch bump of a dependent package will cause a major version increment.

}
}
}
21 changes: 21 additions & 0 deletions packages/graph-framework-identity/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023-present The Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions packages/graph-framework-identity/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Graph Framework Identity

Utilities around identity/authentication in the Graph Framework
30 changes: 23 additions & 7 deletions packages/graph-framework-identity/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
{
"name": "graph-framework-identity",
"version": "0.0.1",
"description": "",
"description": "Utilities around identity/authentication in the Graph Framework",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/geobrowser/graph-framework.git",
"directory": "packages/graph-framework-identity"
},
"license": "MIT",
"publishConfig": {
"access": "public",
"directory": "dist",
"provenance": true
},
"main": "./src/index.js",
"types": "./build/dts/index.d.ts",
"exports": {
".": {
"types": "./build/dts/index.d.ts",
"default": "./src/index.js"
}
},
"scripts": {
"build": "pnpm build-esm && build-utils pack-v2",
"build-esm": "tsc -b tsconfig.build.json",
"test": "vitest run --typecheck",
"ts:check": "tsc --noEmit",
"ts:check": "tsc -b tsconfig.json",
"lint": "pnpm biome lint src/*",
"lint:fix": "pnpm biome lint --write src/*",
"format": "pnpm biome format src/*",
"format:fix": "pnpm biome format --write src/*",
"check": "pnpm biome check src/*",
"check:fix": "pnpm biome check --write src/*"
},
"exports": {
".": {
"default": "./src/index.js"
}
},
"peerDependencies": {
"effect": "^3.10.12"
},
Expand Down
12 changes: 7 additions & 5 deletions packages/graph-framework-identity/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"extends": "../../tsconfig.options.json",
"extends": "./tsconfig.src.json",
"references": [{ "path": "../graph-framework-utils/tsconfig.build.json" }],
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src"
"tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo",
"outDir": "build/esm",
"declarationDir": "build/dts",
"stripInternal": true
},
"include": ["./src"],
"exclude": ["node_modules", "src/**/*.test.ts", "src/**/*.spec.ts", "dist"]
"exclude": ["node_modules", "src/**/*.test.ts", "src/**/*.spec.ts"]
}
11 changes: 3 additions & 8 deletions packages/graph-framework-identity/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{
"extends": "../../tsconfig.options.json",
"compilerOptions": {
"baseUrl": ".",
"rootDir": ".",
"noEmit": true
},
"include": ["**/*", "vite.config.mts"],
"exclude": ["**/node_modules", "**/dist"]
"extends": "../../tsconfig.base.json",
"include": [],
"references": [{ "path": "tsconfig.src.json" }]
}
10 changes: 10 additions & 0 deletions packages/graph-framework-identity/tsconfig.src.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src"],
"references": [{ "path": "../graph-framework-utils" }],
"compilerOptions": {
"tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo",
"rootDir": "src",
"outDir": "build/src"
}
}
4 changes: 0 additions & 4 deletions packages/graph-framework-identity/vite.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions packages/graph-framework-identity/vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
globals: true,
environment: 'jsdom',
},
});
21 changes: 21 additions & 0 deletions packages/graph-framework-schema/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023-present The Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions packages/graph-framework-schema/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Graph Framework Schema

Tools to generate and define the space schema
30 changes: 23 additions & 7 deletions packages/graph-framework-schema/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
{
"name": "graph-framework-schema",
"version": "0.0.1",
"description": "",
"description": "Tools to generate and define the space schema",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/geobrowser/graph-framework.git",
"directory": "packages/graph-framework-schema"
},
"license": "MIT",
"publishConfig": {
"access": "public",
"directory": "dist",
"provenance": true
},
"main": "./src/index.js",
"types": "./build/dts/index.d.ts",
"exports": {
".": {
"types": "./build/dts/index.d.ts",
"default": "./src/index.js"
}
},
"scripts": {
"build": "pnpm build-esm && build-utils pack-v2",
"build-esm": "tsc -b tsconfig.build.json",
"test": "vitest run --typecheck",
"ts:check": "tsc --noEmit",
"ts:check": "tsc -b tsconfig.json",
"lint": "pnpm biome lint src/*",
"lint:fix": "pnpm biome lint --write src/*",
"format": "pnpm biome format src/*",
"format:fix": "pnpm biome format --write src/*",
"check": "pnpm biome check src/*",
"check:fix": "pnpm biome check --write src/*"
},
"exports": {
".": {
"default": "./src/index.js"
}
},
"peerDependencies": {
"@automerge/automerge": "^2",
"@automerge/automerge-repo": "^1",
Expand Down
13 changes: 1 addition & 12 deletions packages/graph-framework-schema/src/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export function createFunctions<T extends SchemaDefinition>(schema: T) {
(acc, type) => {
const typeSchema = schema.types[type];

// @ts-expect-error
for (const [key, prop] of Object.entries(typeSchema)) {
if (isRelation(prop)) {
// Handle Relation
Expand Down Expand Up @@ -224,11 +223,8 @@ export function createFunctions<T extends SchemaDefinition>(schema: T) {
const resultData = { ...data };
for (const entityType of entityTypes) {
const typeSchema = schema.types[entityType];
// @ts-expect-error
for (const key of Object.keys(typeSchema)) {
// @ts-expect-error
const prop = typeSchema[key];
// @ts-expect-error
if (isRelation(prop)) {
const relationProp = prop as Relation<SchemaTypeUnknown, SchemaTypeUnknown>;
const { types: relatedTypes, cardinality } = relationProp;
Expand Down Expand Up @@ -360,13 +356,7 @@ export function createFunctions<T extends SchemaDefinition>(schema: T) {
const visitedEntities = new Set<string>();
for (const entityId in filteredEntities) {
const entity = filteredEntities[entityId];
const resolvedEntity = resolveEntity(
entityId,
entity,
// @ts-expect-error
entity.types,
visitedEntities,
);
const resolvedEntity = resolveEntity(entityId, entity, entity.types, visitedEntities);
filteredEntities[entityId] = resolvedEntity;
}

Expand Down Expand Up @@ -397,7 +387,6 @@ export function createFunctions<T extends SchemaDefinition>(schema: T) {
const typeSchema = schema.types[entityType];
for (const key in typeSchema) {
const prop = typeSchema[key];
// @ts-expect-error
if (isRelation(prop)) {
const relationProp = prop as Relation<SchemaTypeUnknown, SchemaTypeUnknown>;
const { cardinality } = relationProp;
Expand Down
Loading
Loading