@edium/halifax 2.2.0 → 2.2.2

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 (3) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +17 -46
  3. package/package.json +2 -3
package/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
3
3
  All notable changes to this project are documented here. This project adheres to
4
4
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [2.2.2]
7
+
8
+ ### Fixed
9
+
10
+ - Removed the `preinstall` script from both `@edium/halifax` and `@edium/halifax-client`. The
11
+ script was a developer-convenience guard that enforced pnpm usage inside the monorepo, but because it shipped in the published package it caused npm (v7+) to prompt consumers with an "approve build scripts" confirmation on every install. End-users no longer need to approve anything to install either package.
12
+
13
+ ## [2.2.1]
14
+
15
+ ### Added
16
+
17
+ - Published `README.md` files for `@edium/halifax-client` and `@edium/halifax-types` — both
18
+ packages now ship documentation with the npm tarball.
19
+
20
+ ### Fixed
21
+
22
+ - `@edium/halifax-types` was re-versioned from `0.1.0` to `2.2.1` to align with the rest of
23
+ the suite. Consumers importing from this package directly should update their version
24
+ constraint accordingly.
25
+
6
26
  ## [2.2.0]
7
27
 
8
28
  ### Added
package/README.md CHANGED
@@ -65,69 +65,40 @@ Halifax ships as two packages from the same repository:
65
65
  | [`@edium/halifax`](https://www.npmjs.com/package/@edium/halifax) | Server — auto-CRUD engine, adapters, auth, caching, OpenAPI |
66
66
  | [`@edium/halifax-client`](https://www.npmjs.com/package/@edium/halifax-client) | Browser/Node client — typed CRUD, query builder, TanStack Query integration |
67
67
 
68
- ## Browser Client — React & Vue
68
+ ## Browser Client
69
69
 
70
70
  [`@edium/halifax-client`](https://www.npmjs.com/package/@edium/halifax-client) is the companion
71
71
  frontend package. It ships a fully-typed resource client, a fluent query builder, and **built-in
72
72
  TanStack Query option factories** so list/detail queries and mutations wire up in a few lines —
73
- with automatic cache invalidation on writes.
73
+ with automatic cache invalidation on writes. Five HTTP transports ship out of the box: `fetch`
74
+ (default), `axios`, `ky`, `ofetch`, and `superagent` — swap with one line.
74
75
 
75
76
  ```bash
76
77
  pnpm add @edium/halifax-client
77
-
78
- # add whichever TanStack Query adapter your framework uses
79
78
  pnpm add @tanstack/react-query # React
80
79
  pnpm add @tanstack/vue-query # Vue
81
80
  ```
82
81
 
83
- **React**
84
-
85
- ```tsx
86
- import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
87
- import { HalifaxClient } from '@edium/halifax-client'
82
+ ```ts
83
+ import { HalifaxClient, QueryBuilder, SqlComparison } from '@edium/halifax-client'
88
84
 
89
85
  const client = new HalifaxClient({ baseUrl: '/api/v1' })
90
- const posts = client.resource<Post, NewPost, PatchPost>('posts')
91
-
92
- // Paginated list — queryKey is managed for you
93
- function usePostList(page: number) {
94
- return useQuery(posts.getManyOptions({ limit: 20, offset: page * 20 }))
95
- }
86
+ const posts = client.resource<Post, Omit<Post, 'id'>, Partial<Omit<Post, 'id'>>>('posts')
96
87
 
97
- // Create with automatic list invalidation
98
- function useCreatePost() {
99
- const qc = useQueryClient()
100
- return useMutation({
101
- ...posts.createOneMutation(),
102
- onSuccess: () => qc.invalidateQueries({ queryKey: posts.queryKey() })
103
- })
104
- }
105
- ```
88
+ // CRUD
89
+ const { results, count } = await posts.getMany({ limit: 20 })
90
+ const post = await posts.getOne(1)
91
+ await posts.createOne({ title: 'Hello', published: false })
106
92
 
107
- **Vue**
93
+ // Query builder — sends to POST /posts/query
94
+ const q = new QueryBuilder().where('published', SqlComparison.Equal, true).limit(10)
95
+ const { results: published } = await posts.query(q)
108
96
 
109
- ```ts
110
- import { computed, ref } from 'vue'
111
- import { useQuery, useMutation, useQueryClient } from '@tanstack/vue-query'
112
- import { HalifaxClient } from '@edium/halifax-client'
113
-
114
- const client = new HalifaxClient({ baseUrl: '/api/v1' })
115
- const posts = client.resource<Post, NewPost, PatchPost>('posts')
116
-
117
- // Reactive query — re-fetches automatically when page changes
118
- const page = ref(0)
119
- const postList = useQuery(computed(() => posts.getManyOptions({ limit: 20, offset: page.value * 20 })))
120
-
121
- // Mutation with cache invalidation
122
- const qc = useQueryClient()
123
- const createPost = useMutation({
124
- ...posts.createOneMutation(),
125
- onSuccess: () => qc.invalidateQueries({ queryKey: posts.queryKey() })
126
- })
97
+ // React — queryKey + queryFn wired automatically
98
+ const { data } = useQuery(posts.getManyOptions({ limit: 20 }))
127
99
  ```
128
100
 
129
- Five HTTP transports are included out of the box: `fetch` (default), `axios`, `ky`, `ofetch`, and
130
- `superagent` — swap with one line. Full docs: [README_CLIENT.md](./README_CLIENT.md).
101
+ Full docs: [README_CLIENT.md](./README_CLIENT.md) · [npm](https://www.npmjs.com/package/@edium/halifax-client)
131
102
 
132
103
  ---
133
104
 
@@ -188,7 +159,7 @@ app.listen(3000)
188
159
 
189
160
  | Guide | Contents |
190
161
  | ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
191
- | [README_CLIENT.md](./README_CLIENT.md) | `@edium/halifax-client` — install, transports, query builder, React & Vue TanStack Query examples |
162
+ | [README_CLIENT.md](./README_CLIENT.md) · [npm](https://www.npmjs.com/package/@edium/halifax-client) | `@edium/halifax-client` — install, transports, query builder, React & Vue TanStack Query examples |
192
163
  | [README_AUTOCRUD.md](./README_AUTOCRUD.md) | Resource definitions, field flags, ID types, pagination, query-string filtering, error shapes |
193
164
  | [README_REPO_ADAPTERS.md](./README_REPO_ADAPTERS.md) | Prisma 7 (and 6) setup, `PrismaAdapter`, `DrizzleAdapter`, capabilities, custom repositories |
194
165
  | [README_HTTP_ADAPTERS.md](./README_HTTP_ADAPTERS.md) | Express, Fastify, HyperExpress & Ultimate Express adapters, and custom HTTP adapters |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edium/halifax",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Auto-generate type-safe REST CRUD APIs from your data models. Adapter-driven: Express/Fastify/HyperExpress, Prisma (PostgreSQL, MySQL, MariaDB, SQL Server, CockroachDB, SQLite), JWT/API-key auth, multi-tenancy, a dynamic query builder, and pluggable Redis caching.",
5
5
  "author": "David LaTour <david@edium.com>",
6
6
  "homepage": "https://github.com/splayfee/halifax#readme",
@@ -166,10 +166,9 @@
166
166
  ],
167
167
  "dependencies": {
168
168
  "uuid": "^14.0.0",
169
- "@edium/halifax-types": "0.1.0"
169
+ "@edium/halifax-types": "2.2.2"
170
170
  },
171
171
  "scripts": {
172
- "preinstall": "node -e \"const ua = process.env.npm_config_user_agent; if (ua && !ua.startsWith('pnpm')) { console.error('\\nERROR: This repo requires pnpm. Run: pnpm install\\n'); process.exit(1); }\"",
173
172
  "build": "rm -rf dist && tsc --build && tsc-alias",
174
173
  "dev": "tsx watch ./examples/http-express.ts",
175
174
  "lint": "eslint .",