my-crud-lib 1.0.4 → 2.1.0

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 (50) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/LICENSE +21 -0
  3. package/README.md +224 -129
  4. package/RELEASE.md +36 -0
  5. package/dist/adapter-prisma.d.ts +1 -0
  6. package/dist/adapter-prisma.js +1 -0
  7. package/dist/adapters/prisma.d.ts +5 -0
  8. package/dist/adapters/prisma.js +125 -0
  9. package/dist/auth.d.ts +6 -0
  10. package/dist/auth.js +4 -0
  11. package/dist/config/env.d.ts +3 -2
  12. package/dist/config/env.js +9 -3
  13. package/dist/core/ports/user.repo.d.ts +2 -0
  14. package/dist/dev.js +1 -1
  15. package/dist/index.d.ts +22 -2
  16. package/dist/index.js +28 -16
  17. package/dist/middleware/hasRole.js +1 -2
  18. package/dist/middleware/isAuth.d.ts +1 -1
  19. package/dist/middleware.d.ts +2 -0
  20. package/dist/middleware.js +2 -0
  21. package/dist/modules/auth/auth.controller.d.ts +2 -1
  22. package/dist/modules/auth/auth.controller.js +83 -22
  23. package/dist/modules/auth/auth.defaults.d.ts +3 -0
  24. package/dist/modules/auth/auth.defaults.js +4 -0
  25. package/dist/modules/auth/auth.schemas.d.ts +35 -0
  26. package/dist/modules/auth/auth.schemas.js +13 -0
  27. package/dist/modules/auth/auth.service.d.ts +26 -24
  28. package/dist/modules/auth/auth.service.js +265 -32
  29. package/dist/modules/auth/auth.types.d.ts +145 -1
  30. package/dist/modules/user/user.schemas.d.ts +1 -1
  31. package/dist/modules/user/user.types.d.ts +1 -0
  32. package/dist/schemas.d.ts +2 -0
  33. package/dist/schemas.js +2 -0
  34. package/dist/user.d.ts +5 -0
  35. package/dist/user.js +3 -0
  36. package/dist/utils/jwt.d.ts +3 -1
  37. package/dist/utils/jwt.js +4 -4
  38. package/docs/auth-extensions.md +120 -0
  39. package/docs/github-self-hosted-runner.md +76 -0
  40. package/docs/migration-v2.md +131 -0
  41. package/examples/custom-repo/README.md +5 -0
  42. package/examples/custom-repo/server.ts +70 -0
  43. package/examples/express-prisma/.env.example +6 -0
  44. package/examples/express-prisma/README.md +25 -0
  45. package/examples/express-prisma/package.json +23 -0
  46. package/examples/express-prisma/prisma/schema.prisma +93 -0
  47. package/examples/express-prisma/src/server.ts +25 -0
  48. package/package.json +56 -18
  49. package/prisma/schema.prisma +69 -8
  50. package/prisma.config.ts +6 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,45 @@
1
+ # Changelog
2
+
3
+ All notable changes to `my-crud-lib` are documented here.
4
+
5
+ This project follows semantic versioning. Breaking changes are called out explicitly and should be reviewed before upgrading.
6
+
7
+ ## 2.1.0 - Unreleased
8
+
9
+ ### Added
10
+
11
+ - Added a repeatable changelog and release-note workflow.
12
+ - Added a v2 migration guide for applications upgrading from the pre-v2 API shape.
13
+ - Added `prisma.config.ts` so Prisma CLI configuration no longer relies on the deprecated `package.json#prisma` field.
14
+ - Added self-hosted GitHub Actions runner documentation and configured CI to target the `local-ci` runner label.
15
+ - Added optional persistent refresh token rotation/revocation ports and Prisma adapter.
16
+ - Added optional password reset request/confirm service methods, routes, hooks, token repository port, and Prisma adapter.
17
+ - Added optional email verification request/confirm service methods, routes, hooks, token repository port, and Prisma adapter.
18
+ - Added provider-agnostic OAuth account linking service methods, port, and Prisma adapter.
19
+
20
+ ### Changed
21
+
22
+ - Bumped the package version to `2.1.0`.
23
+ - Expanded the starter Prisma schema with optional auth extension storage models.
24
+
25
+ ## 2.0.0 - 2026-05-14
26
+
27
+ ### Breaking Changes
28
+
29
+ - Auth routes are now dependency-injected. `createAuthRouter()` requires a `userRepo` dependency instead of constructing Prisma access internally.
30
+ - `createLibrary()` now receives application dependencies separately from route configuration.
31
+ - Self-registration creates `USER` accounts by default. Applications must create `ADMIN` users intentionally through their own seed or admin workflow.
32
+ - Public imports were consolidated around documented package entry points: `my-crud-lib`, `my-crud-lib/auth`, `my-crud-lib/user`, `my-crud-lib/schemas`, `my-crud-lib/middleware`, `my-crud-lib/adapter-prisma`, and `my-crud-lib/adapters/prisma`.
33
+
34
+ ### Added
35
+
36
+ - Added public Express router factories for auth and user/profile CRUD.
37
+ - Added `UserRepo` as the core persistence port.
38
+ - Added Prisma adapter exports.
39
+ - Added smoke tests for public package exports, auth safety defaults, and adapter-driven auth service behavior.
40
+
41
+ ### Changed
42
+
43
+ - Prisma is optional for consumers that provide a custom repository adapter.
44
+ - Auth behavior now strips `passwordHash` from service responses.
45
+ - JWT configuration validates `JWT_SECRET` before signing or verifying tokens.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Riccardo Sensi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,214 +1,309 @@
1
1
  # my-crud-lib
2
2
 
3
- A modular, TypeScript-first **Auth + User/Profile CRUD** library for Node.js, designed to be **framework-light**, **DB-agnostic** (via adapters), and **highly extensible** (schemas + hooks). Ship a secure `/auth/register`, `/auth/login`, and `/me` in minutes—then customize without forking the core.
3
+ [![CI](https://github.com/riccardosensi99/CRUD-lib/actions/workflows/ci.yml/badge.svg)](https://github.com/riccardosensi99/CRUD-lib/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/my-crud-lib.svg)](https://www.npmjs.com/package/my-crud-lib)
4
5
 
5
- > Works great with Express and Prisma out of the box, but you can plug in your own repo adapter.
6
+ TypeScript-first auth and user/profile CRUD helpers for Node.js and Express.
6
7
 
7
- ---
8
+ The package currently provides:
8
9
 
9
- ## Features
10
+ - Express routers for auth and user CRUD.
11
+ - JWT access and refresh token helpers.
12
+ - Optional persistent refresh token rotation and revocation.
13
+ - Optional password reset and email verification hooks.
14
+ - Provider-agnostic OAuth account linking extension points.
15
+ - Zod schemas for request validation.
16
+ - A `UserRepo` port plus a Prisma adapter.
17
+ - Convenience setup helpers for small Express APIs.
10
18
 
11
- - Ready-made routes: `POST /auth/register`, `POST /auth/login`, `GET /me`
12
- - 🔐 JWT-based auth with pluggable lifecycle hooks (before/after create, before issuing JWT, etc.)
13
- - 🧩 Extensible validation via **Zod**: merge your own fields into the base schemas
14
- - 🗄️ Repository interfaces (DB-agnostic) + optional Prisma adapter
15
- - 🧰 Cleanly separated core logic & web router
16
- - 🧪 TypeScript types exported for DX
17
-
18
- ---
19
+ For advanced auth flows, see [docs/auth-extensions.md](docs/auth-extensions.md). For v1 to v2 upgrades, see [docs/migration-v2.md](docs/migration-v2.md). Release history and breaking changes are tracked in [CHANGELOG.md](CHANGELOG.md).
19
20
 
20
21
  ## Installation
21
22
 
22
23
  ```bash
23
- npm i my-crud-lib zod jsonwebtoken bcryptjs
24
- # If using Prisma adapter in your app:
25
- npm i @prisma/client
24
+ npm i my-crud-lib express cors body-parser
26
25
  ```
27
26
 
28
- > Node.js `>= 18.17` is required.
27
+ If you use the bundled Prisma adapter:
28
+
29
+ ```bash
30
+ npm i @prisma/client prisma
31
+ npx prisma generate
32
+ ```
29
33
 
30
- ---
34
+ Node.js `>=18.17` is required.
31
35
 
32
- ## Quickstart (Express)
36
+ ## Environment
37
+
38
+ ```bash
39
+ DATABASE_URL="postgresql://user:password@localhost:5432/app"
40
+ JWT_SECRET="replace-with-a-long-random-secret"
41
+ JWT_ACCESS_EXPIRES_IN="15m"
42
+ JWT_REFRESH_EXPIRES_IN="7d"
43
+ BCRYPT_SALT="10"
44
+ ```
45
+
46
+ `JWT_ACCESS_EXPIRES_IN` and `JWT_REFRESH_EXPIRES_IN` have defaults. `JWT_SECRET` and `DATABASE_URL` must be set before using the default auth and Prisma paths.
47
+
48
+ ## Quickstart With Express And Prisma
33
49
 
34
50
  ```ts
35
- import express from "express";
36
- import { json } from "body-parser";
37
- import { createLibrary } from "my-crud-lib";
38
- // Optional: Prisma adapter (provided in your app)
39
51
  import { PrismaClient } from "@prisma/client";
40
- import { makePrismaUserRepo } from "my-crud-lib/adapter-prisma"; // if you expose this path
52
+ import { createLibrary, createServer } from "my-crud-lib";
53
+ import { makePrismaUserRepo } from "my-crud-lib/adapter-prisma";
41
54
 
42
55
  const prisma = new PrismaClient();
43
-
44
- const app = express();
45
- app.use(json());
56
+ const app = createServer();
46
57
 
47
58
  const lib = createLibrary(
48
59
  {
60
+ routesPrefix: "/api",
49
61
  auth: {
50
- jwtSecret: process.env.JWT_SECRET!, // e.g. "supersecret"
51
- jwtExpiresIn: "7d",
52
62
  passwordHashRounds: 10,
53
63
  },
54
- routesPrefix: "/api", // optional
55
64
  },
56
65
  { userRepo: makePrismaUserRepo(prisma) }
57
66
  );
58
67
 
59
68
  app.use(lib.router);
60
69
 
61
- app.listen(3000, () => console.log("API running on http://localhost:3000"));
70
+ app.listen(3000, () => {
71
+ console.log("API running on http://localhost:3000");
72
+ });
62
73
  ```
63
74
 
64
- ### Available Routes
75
+ With the `/api` prefix, the mounted routes include:
65
76
 
66
- - `POST /auth/register` → create user (email + password + optional name)
67
- - `POST /auth/login` → returns `{ accessToken }`
68
- - `GET /me` → authenticated endpoint, returns the current user
77
+ - `POST /api/auth/register`
78
+ - `POST /api/auth/login`
79
+ - `POST /api/auth/refresh`
80
+ - `POST /api/auth/logout`
81
+ - `POST /api/auth/password-reset/request`
82
+ - `POST /api/auth/password-reset/confirm`
83
+ - `POST /api/auth/email-verification/request`
84
+ - `POST /api/auth/email-verification/confirm`
85
+ - `GET /api/auth/me`
86
+ - `GET /api/users`
87
+ - `GET /api/users/me`
88
+ - `PUT /api/users/me`
89
+ - `POST /api/users`
90
+ - `GET /api/users/:id`
91
+ - `PUT /api/users/:id`
92
+ - `DELETE /api/users/:id`
69
93
 
70
- > Protect `/me` with the `isAuth` middleware already wired inside the library router.
94
+ Admin user routes require a bearer token with role `ADMIN`.
71
95
 
72
- ---
96
+ ## Examples
73
97
 
74
- ## Configuration
98
+ - `examples/express-prisma` is a runnable Express + Prisma app.
99
+ - `examples/custom-repo` shows the `UserRepo` shape with an in-memory adapter.
75
100
 
76
- ```ts
77
- type AuthConfig = {
78
- jwtSecret: string;
79
- jwtExpiresIn: string; // e.g. "7d"
80
- passwordHashRounds: number; // e.g. 10
81
- };
82
-
83
- type LibraryConfig = {
84
- auth: AuthConfig;
85
- routesPrefix?: string; // e.g. "/api"
86
- };
101
+ Run the Prisma example:
102
+
103
+ ```bash
104
+ cd examples/express-prisma
105
+ npm install
106
+ cp .env.example .env
107
+ npx prisma generate
108
+ npx prisma migrate dev --name init
109
+ npm run dev
87
110
  ```
88
111
 
89
- Create the library:
112
+ ## Response Examples
90
113
 
91
- ```ts
92
- const lib = createLibrary(config, { userRepo });
114
+ Register:
115
+
116
+ ```http
117
+ POST /api/auth/register
118
+ Content-Type: application/json
119
+
120
+ {
121
+ "email": "reader@example.com",
122
+ "password": "password123",
123
+ "name": "Reader"
124
+ }
93
125
  ```
94
126
 
95
- ---
127
+ Response:
96
128
 
97
- ## Extending Schemas (Zod)
129
+ ```json
130
+ {
131
+ "user": {
132
+ "id": 1,
133
+ "email": "reader@example.com",
134
+ "name": "Reader",
135
+ "role": "USER"
136
+ },
137
+ "accessToken": "eyJ...",
138
+ "refreshToken": "eyJ..."
139
+ }
140
+ ```
98
141
 
99
- The library exports base Zod schemas and a factory to merge your custom fields.
142
+ Login:
100
143
 
101
- ```ts
102
- // consumer app
103
- import { z } from "zod";
104
- import { makeCreateUserSchema } from "my-crud-lib/schemas";
144
+ ```http
145
+ POST /api/auth/login
146
+ Content-Type: application/json
105
147
 
106
- const ExtraUserFields = z.object({
107
- companyVat: z.string().min(5),
108
- marketingOptIn: z.boolean().default(false),
109
- });
148
+ {
149
+ "email": "reader@example.com",
150
+ "password": "password123"
151
+ }
152
+ ```
110
153
 
111
- export const CreateUserSchema = makeCreateUserSchema(ExtraUserFields);
154
+ Protected request:
112
155
 
113
- // Later in your route (if you override the built-in):
114
- const data = CreateUserSchema.parse(req.body);
156
+ ```http
157
+ GET /api/auth/me
158
+ Authorization: Bearer <accessToken>
115
159
  ```
116
160
 
117
- **Tip:** The default Prisma schema (if you use it) exposes `profile.extra: Json?` so you can store arbitrary fields without altering the core tables.
161
+ ## Public Imports
118
162
 
119
- ---
163
+ ```ts
164
+ import {
165
+ createLibrary,
166
+ createServer,
167
+ mountDefaultRoutes,
168
+ createAuthRouter,
169
+ createUserRouter,
170
+ isAuth,
171
+ hasRole,
172
+ } from "my-crud-lib";
173
+
174
+ import { createAuthRouter, makeAuthService, registerSchema, loginSchema } from "my-crud-lib/auth";
175
+ import { createUserRouter, type UserRepo } from "my-crud-lib/user";
176
+ import { registerSchema, listUsersQuerySchema } from "my-crud-lib/schemas";
177
+ import { isAuth, hasRole } from "my-crud-lib/middleware";
178
+ import { makePrismaUserRepo } from "my-crud-lib/adapter-prisma";
179
+ import { makePrismaUserRepo as makePrismaUserRepoCanonical } from "my-crud-lib/adapters/prisma";
180
+ ```
120
181
 
121
- ## Hooks (Lifecycle)
182
+ ## Repository Adapter
122
183
 
123
- Use hooks to change data or enrich tokens without forking.
184
+ User CRUD is driven by the `UserRepo` interface:
124
185
 
125
186
  ```ts
126
- import { plugins } from "my-crud-lib";
127
-
128
- plugins.use({
129
- beforeCreateUser: async (data, ctx) => {
130
- if (data.companyVat) data.companyVat = data.companyVat.toUpperCase();
131
- return data;
132
- },
133
- afterCreateUser: async (user, ctx) => {
134
- // e.g., send welcome email or audit log
135
- },
136
- beforeIssueJwt: (payload, ctx) => {
137
- return { ...payload, tenantId: "acme-123" };
138
- },
139
- });
187
+ export interface UserRepo {
188
+ count(where: { role?: string; search?: string }): Promise<number>;
189
+ findMany(params: {
190
+ page: number;
191
+ pageSize: number;
192
+ role?: string;
193
+ search?: string;
194
+ sortField: "createdAt" | "updatedAt" | "email" | "name";
195
+ sortDir: "asc" | "desc";
196
+ }): Promise<UserListItem[]>;
197
+ findById(id: number | string): Promise<UserListItem | null>;
198
+ findByEmail(email: string): Promise<(UserListItem & { passwordHash?: string }) | null>;
199
+ create(input: {
200
+ email: string;
201
+ passwordHash: string;
202
+ name?: string | null;
203
+ role?: string;
204
+ bio?: string | null;
205
+ avatarUrl?: string | null;
206
+ }): Promise<UserListItem>;
207
+ update(id: number | string, input: AdminUpdateUserInput): Promise<UserListItem>;
208
+ delete(id: number | string): Promise<void>;
209
+ updateMe(
210
+ userId: number | string,
211
+ input: { name?: string | null; bio?: string | null; avatarUrl?: string | null }
212
+ ): Promise<UserListItem>;
213
+ }
140
214
  ```
141
215
 
142
- **Available hooks**
143
- - `beforeCreateUser(data, ctx)`
144
- - `afterCreateUser(user, ctx)`
145
- - `beforeUpdateUser(data, ctx)`
146
- - `beforeIssueJwt(payload, ctx)`
216
+ The Prisma adapter is available from both import paths:
147
217
 
148
- `ctx` includes the request and useful dependencies (e.g., repos).
218
+ ```ts
219
+ import {
220
+ makePrismaEmailVerificationTokenRepo,
221
+ makePrismaOAuthAccountRepo,
222
+ makePrismaPasswordResetTokenRepo,
223
+ makePrismaRefreshTokenRepo,
224
+ makePrismaUserRepo,
225
+ } from "my-crud-lib/adapter-prisma";
226
+ // or
227
+ import { makePrismaUserRepo } from "my-crud-lib/adapters/prisma";
228
+ ```
149
229
 
150
- ---
230
+ Auth also receives the same repository dependency:
151
231
 
152
- ## Repository Adapters (DB-agnostic)
232
+ ```ts
233
+ import { createAuthRouter } from "my-crud-lib/auth";
153
234
 
154
- Core interface:
235
+ app.use("/auth", createAuthRouter({ userRepo }));
236
+ ```
237
+
238
+ Optional auth extensions use additional ports:
155
239
 
156
240
  ```ts
157
- export interface UserRepo {
158
- create(data: any): Promise<any>;
159
- update(id: string, data: any): Promise<any>;
160
- findById(id: string): Promise<any | null>;
161
- findByEmail(email: string): Promise<any | null>;
162
- }
241
+ app.use(
242
+ "/auth",
243
+ createAuthRouter({
244
+ userRepo,
245
+ refreshTokenRepo,
246
+ passwordResetTokenRepo,
247
+ emailVerificationTokenRepo,
248
+ oauthAccountRepo,
249
+ async sendPasswordReset({ user, token }) {
250
+ await emailProvider.sendPasswordReset(user.email, token);
251
+ },
252
+ async sendEmailVerification({ user, token }) {
253
+ await emailProvider.sendVerification(user.email, token);
254
+ },
255
+ })
256
+ );
163
257
  ```
164
258
 
165
- Example Prisma adapter (in your app or provided by the lib):
259
+ These dependencies are optional. Without them, the existing stateless refresh-token flow remains available and password reset, email verification, and OAuth methods report that they are not configured.
166
260
 
167
- ```ts
168
- export function makePrismaUserRepo(prisma: any): UserRepo {
169
- return {
170
- create: (data) => prisma.user.create({ data }),
171
- update: (id, data) => prisma.user.update({ where: { id }, data }),
172
- findById: (id) => prisma.user.findUnique({ where: { id } }),
173
- findByEmail: (email) => prisma.user.findUnique({ where: { email } }),
174
- };
175
- }
261
+ ## Build Checks
262
+
263
+ ```bash
264
+ npm run build
265
+ npm test
266
+ npm run smoke:exports
267
+ npm run smoke:auth-hardening
268
+ npm run smoke:auth-service
176
269
  ```
177
270
 
178
- ---
271
+ `smoke:exports` builds the package and imports the documented public paths from `dist`.
272
+ `smoke:auth-hardening` checks auth safety defaults and JWT secret validation.
273
+ `smoke:auth-service` verifies register/login/refresh/me with an in-memory repo.
179
274
 
180
- ## Types
275
+ ## Current Limitations
181
276
 
182
- The package exports the main public types:
277
+ - Lifecycle hooks and schema factories are not part of the current public API.
278
+ - The Prisma schema is included as a starter schema; consumer apps should own their migrations.
183
279
 
184
- - `LibraryConfig`, `AuthConfig`
185
- - `UserRepo`
186
- - schema types (e.g., `CreateUserBase`)
280
+ ## Troubleshooting
187
281
 
188
- ---
282
+ `Cannot find module '@prisma/client'`
189
283
 
190
- ## Security Notes
284
+ Install Prisma dependencies in your app and run `npx prisma generate`.
191
285
 
192
- - Keep `JWT_SECRET` secure; rotate if compromised.
193
- - Consider adding rate limiting in your app (e.g., `express-rate-limit`).
194
- - Store password hashes using `bcryptjs` with adequate rounds (default shown: `10`).
195
- - Use HTTPS in production.
286
+ `JWT_SECRET is required before signing or verifying tokens`
196
287
 
197
- ---
288
+ Set `JWT_SECRET` before mounting or calling auth routes. Use a long random value.
198
289
 
199
- ## Optional
290
+ `Invalid or expired token`
200
291
 
201
- if you want to use the prisma adeapter use:
292
+ Send the access token in the `Authorization` header as `Bearer <accessToken>`. Use `/auth/refresh` with a refresh token to get a new pair.
202
293
 
203
- npm i @prisma/client prisma
204
- npx prisma generate
294
+ ESM import errors
205
295
 
206
- ## Contributing
296
+ Use Node.js `>=18.17` and import from the documented package paths, for example `my-crud-lib`, `my-crud-lib/auth`, or `my-crud-lib/adapter-prisma`.
207
297
 
208
- PRs and issues are welcome! Please follow conventional commits or include a clear description. For releases, we recommend Changesets or semantic-release.
298
+ ## Security Notes
209
299
 
210
- ---
300
+ - Use a long random `JWT_SECRET` and rotate it if compromised.
301
+ - Keep access tokens short-lived.
302
+ - Add rate limiting around auth endpoints in production.
303
+ - Use HTTPS in production.
304
+ - Self-registration creates `USER` accounts by default.
305
+ - Create `ADMIN` accounts intentionally through your own seed/admin workflow.
211
306
 
212
307
  ## License
213
308
 
214
- MIT © Riccardo
309
+ MIT
package/RELEASE.md ADDED
@@ -0,0 +1,36 @@
1
+ # Release Checklist
2
+
3
+ Use this checklist before publishing `my-crud-lib` to npm.
4
+
5
+ ## Preflight
6
+
7
+ - Confirm `package.json` version is the intended release version.
8
+ - Add an entry to `CHANGELOG.md` under the target version.
9
+ - Move `CHANGELOG.md` entries from `Unreleased` to the release date before publishing.
10
+ - Confirm `README.md` examples match tested public imports.
11
+ - Confirm migration notes are linked when the release contains breaking changes.
12
+ - Confirm `LICENSE`, `README.md`, `examples`, `dist`, and `prisma/schema.prisma` are included in the package.
13
+ - Review open issues for release blockers.
14
+
15
+ ## Verify
16
+
17
+ ```bash
18
+ npm ci
19
+ npm run ci
20
+ npm pack --dry-run
21
+ ```
22
+
23
+ Inspect the dry-run file list before publishing.
24
+
25
+ ## Publish
26
+
27
+ ```bash
28
+ npm publish --access public
29
+ ```
30
+
31
+ ## After Publish
32
+
33
+ - Create a GitHub release or tag for the published version.
34
+ - Use `CHANGELOG.md` as the release body, and include migration links for breaking releases.
35
+ - Confirm the npm page shows repository, license, README, examples, and keywords.
36
+ - Smoke test installation in a fresh temporary project.
@@ -0,0 +1 @@
1
+ export { makePrismaEmailVerificationTokenRepo, makePrismaOAuthAccountRepo, makePrismaPasswordResetTokenRepo, makePrismaRefreshTokenRepo, makePrismaUserRepo, } from './adapters/prisma.js';
@@ -0,0 +1 @@
1
+ export { makePrismaEmailVerificationTokenRepo, makePrismaOAuthAccountRepo, makePrismaPasswordResetTokenRepo, makePrismaRefreshTokenRepo, makePrismaUserRepo, } from './adapters/prisma.js';
@@ -1,3 +1,8 @@
1
1
  import type { PrismaClient } from '@prisma/client';
2
2
  import type { UserRepo } from '../core/ports/user.repo.js';
3
+ import type { EmailVerificationTokenRepo, OAuthAccountRepo, PasswordResetTokenRepo, RefreshTokenRepo } from '../modules/auth/auth.types.js';
3
4
  export declare function makePrismaUserRepo(prisma: PrismaClient): UserRepo;
5
+ export declare function makePrismaRefreshTokenRepo(prisma: PrismaClient): RefreshTokenRepo;
6
+ export declare function makePrismaPasswordResetTokenRepo(prisma: PrismaClient): PasswordResetTokenRepo;
7
+ export declare function makePrismaEmailVerificationTokenRepo(prisma: PrismaClient): EmailVerificationTokenRepo;
8
+ export declare function makePrismaOAuthAccountRepo(prisma: PrismaClient): OAuthAccountRepo;