@hugomrdias/foxer-client 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +39 -15
  2. package/package.json +30 -29
package/README.md CHANGED
@@ -1,52 +1,76 @@
1
1
  # foxer-client
2
2
 
3
- `foxer-client` provides a typed Drizzle-compatible client for querying `foxer` SQL endpoints, including live updates over SSE.
3
+ `@hugomrdias/foxer-client` provides a typed Drizzle-compatible client for querying `foxer` SQL endpoints, including live updates over Server-Sent Events.
4
4
 
5
- ## Features
5
+ ## What it includes
6
6
 
7
- - Typed remote Drizzle client via `createClient`.
8
- - Query compilation helper with `compileQuery`.
9
- - Live query subscriptions using Server-Sent Events.
10
- - Works with schema + relations for end-to-end type safety.
7
+ - `createClient()` for a typed remote Drizzle client
8
+ - `compileQuery()` for turning Drizzle query builders into SQL payloads
9
+ - `client.live()` for live query subscriptions over SSE
10
+ - Schema and relations support for end-to-end type safety
11
11
 
12
12
  ## Install
13
13
 
14
14
  ```bash
15
- npm install foxer-client viem
15
+ npm install @hugomrdias/foxer-client viem
16
16
  ```
17
17
 
18
- ## Entrypoint
18
+ ## Package entrypoint
19
19
 
20
- - Package root: `foxer-client`
21
- - Main export: `createClient`
20
+ - Package: `@hugomrdias/foxer-client`
21
+ - Main exports: `createClient`, `compileQuery`
22
22
 
23
- ## Usage
23
+ ## Create a client
24
+
25
+ Point the client at the `foxer` SQL endpoint, usually `http://localhost:4200/sql` during local development:
24
26
 
25
27
  ```ts
26
- import { createClient } from 'foxer-client'
27
- import { schema, relations } from './schema'
28
+ import { createClient } from '@hugomrdias/foxer-client'
29
+ import { relations, schema } from './schema'
28
30
 
29
31
  const client = createClient({
30
32
  baseUrl: 'http://localhost:4200/sql',
31
33
  schema,
32
34
  relations,
33
35
  })
36
+ ```
37
+
38
+ ## Query data
34
39
 
40
+ ```ts
35
41
  const rows = await client.db.query.sessionKeys.findMany({
36
42
  limit: 10,
37
43
  orderBy: { blockNumber: 'desc' },
38
44
  })
45
+ ```
46
+
47
+ ## Subscribe to live updates
39
48
 
49
+ ```ts
40
50
  const { unsubscribe } = client.live(
41
- (db) => db.query.sessionKeys.findMany({ limit: 10 }),
51
+ (db) =>
52
+ db.query.sessionKeys.findMany({
53
+ limit: 10,
54
+ orderBy: { blockNumber: 'desc' },
55
+ }),
42
56
  (data) => {
43
57
  console.log('live rows', data)
44
58
  },
45
59
  (error) => {
46
60
  console.error(error)
47
- }
61
+ },
48
62
  )
49
63
 
50
64
  // later
51
65
  unsubscribe()
52
66
  ```
67
+
68
+ The `queryFn` passed to `live()` must return a Drizzle query builder, not an executed promise. In practice that means returning the query directly and not calling `.execute()`.
69
+
70
+ ## When to use it
71
+
72
+ Use `@hugomrdias/foxer-client` when you want:
73
+
74
+ - typed reads against a remote `foxer` API
75
+ - live query refreshes without writing SSE plumbing yourself
76
+ - a shared schema contract between your API package and frontend
package/package.json CHANGED
@@ -1,28 +1,34 @@
1
1
  {
2
2
  "name": "@hugomrdias/foxer-client",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "description": "React hooks for interacting with Filecoin Onchain Cloud smart contracts",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/hugomrdias/foxer.git"
8
- },
9
- "sideEffects": false,
10
5
  "keywords": [
11
6
  "filecoin",
12
- "synapse",
13
- "filecoin pay",
14
7
  "filecoin onchain cloud",
15
- "web3",
8
+ "filecoin pay",
9
+ "hooks",
16
10
  "react",
17
- "hooks"
11
+ "synapse",
12
+ "web3"
18
13
  ],
19
- "author": "Hugo Dias <hugomrdias@gmail.com>",
20
- "license": "Apache-2.0 OR MIT",
14
+ "homepage": "https://github.com/hugomrdias/foxer/tree/main/packages/foxer-client",
21
15
  "bugs": {
22
16
  "url": "https://github.com/hugomrdias/foxer/issues"
23
17
  },
24
- "homepage": "https://github.com/hugomrdias/foxer/tree/main/packages/foxer-client",
18
+ "license": "Apache-2.0 OR MIT",
19
+ "author": "Hugo Dias <hugomrdias@gmail.com>",
20
+ "repository": {
21
+ "url": "hugomrdias/foxer",
22
+ "directory": "packages/foxer-client"
23
+ },
24
+ "files": [
25
+ "src",
26
+ "dist/src",
27
+ "dist/src/**/*.d.ts",
28
+ "dist/src/**/*.d.ts.map"
29
+ ],
25
30
  "type": "module",
31
+ "sideEffects": false,
26
32
  "main": "dist/src/index.js",
27
33
  "module": "dist/src/index.js",
28
34
  "types": "dist/src/index.d.ts",
@@ -32,31 +38,26 @@
32
38
  "default": "./dist/src/index.js"
33
39
  }
34
40
  },
35
- "files": [
36
- "src",
37
- "dist/src",
38
- "dist/src/**/*.d.ts",
39
- "dist/src/**/*.d.ts.map"
40
- ],
41
+ "publishConfig": {
42
+ "access": "public",
43
+ "provenance": true
44
+ },
41
45
  "scripts": {
46
+ "check": "tsc --noEmit && biome check .",
42
47
  "build": "tsc --build",
43
- "lint": "tsc --build && biome check ."
48
+ "prepublishOnly": "bun run build"
44
49
  },
45
50
  "dependencies": {
46
- "drizzle-orm": "1.0.0-beta.15-859cf75",
51
+ "drizzle-orm": "1.0.0-beta.17-67b1795",
47
52
  "eventsource": "^4.1.0"
48
53
  },
49
54
  "devDependencies": {
50
- "@biomejs/biome": "2.4.5",
51
- "@types/node": "25.3.3",
52
- "type-fest": "^5.4.4",
55
+ "@types/node": "25.5.0",
56
+ "type-fest": "^5.5.0",
53
57
  "typescript": "5.9.3",
54
- "viem": "2.46.3"
55
- },
56
- "publishConfig": {
57
- "access": "public"
58
+ "viem": "2.47.6"
58
59
  },
59
60
  "peerDependencies": {
60
- "viem": "2.x"
61
+ "viem": "2.47.6"
61
62
  }
62
63
  }