Skip to content

Commit

Permalink
Lucia v2 (lucia-auth#682)
Browse files Browse the repository at this point in the history
  • Loading branch information
pilcrowonpaper authored Jun 10, 2023
1 parent b02ae0a commit b000db6
Show file tree
Hide file tree
Showing 319 changed files with 4,765 additions and 6,060 deletions.
8 changes: 8 additions & 0 deletions .auri/$160srass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
package: "@lucia-auth/oauth" # package name
type: "minor" # "major", "minor", "patch"
---

Require `lucia@^2.0.0`
- Export `useAuth()`
- Remove `provider()`
15 changes: 15 additions & 0 deletions .auri/$1gd2c9ca.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Update configuration
- Remove `autoDatabaseCleanup`
- Remove `transformDatabaseUser()` (see `transformUserAttributes()`)
- Replace `generateCustomUserId()` with `generateUserId()`
- Replace `hash` with `passwordHash`
- Replace `origin` with `requestOrigins`
- Replace `sessionCookie` with `sessionCookie.attributes`
- Add `sessionCookie.name` for setting session cookie name
- Add `transformUserAttributes()` for defining user attributes (**`userId` is automatically included**)
- Add `transformSessionAttributes()` for defining session attributes
11 changes: 11 additions & 0 deletions .auri/$3i5r5bib.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Update `Auth` methods:
- Remove `getSessionUser()`
- Remove `validateSessionUser()`
- Remove `parseRequestHeaders()`
- Add `readSessionCookie()`
- Add `validateRequestOrigin()`
8 changes: 8 additions & 0 deletions .auri/$4g93h2e1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
package: "lucia" # package name
type: "minor" # "major", "minor", "patch"
---

Support bearer tokens
- Add `Auth.readBearerToken()`
- Add `AuthRequest.validateBearerToken()`
9 changes: 9 additions & 0 deletions .auri/$4omphity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Remove primary keys
- Remove `Key.primary`
- Rename `Auth.createUser()` params `options.primaryKey` to `options.key`
- Remove column `key(primary_key)`
6 changes: 6 additions & 0 deletions .auri/$5gbqip09.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "@lucia-auth/adapter-sqlite" # package name
type: "minor" # "major", "minor", "patch"
---

Add option to configure table names in `betterSqlite3()` and `d1()`
6 changes: 6 additions & 0 deletions .auri/$5xnm1vze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "@lucia-auth/adapter-mysql" # package name
type: "minor" # "major", "minor", "patch"
---

Add option to configure table names in `mysql2()` and `planetscale()`
6 changes: 6 additions & 0 deletions .auri/$8fe25uuj.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "@lucia-auth/adapter-postgresql" # package name
type: "minor" # "major", "minor", "patch"
---

Add option to configure table names in `pg()`
6 changes: 6 additions & 0 deletions .auri/$97z0unep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "@lucia-auth/oauth" # package name
type: "major" # "major", "minor", "patch"
---

Remove `redirectUri` from `getAuthorizationUrl()`
7 changes: 7 additions & 0 deletions .auri/$awt53nzt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
package: "@lucia-auth/adapter-test" # package name
type: "major" # "major", "minor", "patch"
---

Require `lucia@^2.0.0`
- Update tests
9 changes: 9 additions & 0 deletions .auri/$buyqgbd1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
package: "@lucia-auth/adapter-test" # package name
type: "major" # "major", "minor", "patch"
---

Update `testAdapter()` and `testSessionAdapter()`
- Rename type `QueryHandler` to `LuciaQueryHandler`
- Remove `testUserAdapter()`
- Test modules no longer end process by default
10 changes: 10 additions & 0 deletions .auri/$cadjkp1x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Remove single use keys
- **Lucia v2 no longer supports `@lucia-auth/tokens`**
- Remove `Session.type`
- Update `Auth.createKey()` params
- Remove column `key(expires)`
8 changes: 8 additions & 0 deletions .auri/$cvfrkv1s.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Update `Session`
- Remove `Session.userId`
- Add `Session.user`
6 changes: 6 additions & 0 deletions .auri/$ecvf1yna.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Remove `AuthRequest.validateUser()`
7 changes: 7 additions & 0 deletions .auri/$eyl1lq81.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
package: "@lucia-auth/adapter-session-redis" # package name
type: "major" # "major", "minor", "patch"
---

Require `lucia@^2.0.0`
- `redis()` expects az single Redis instance instead of 2
8 changes: 8 additions & 0 deletions .auri/$fgtw8yla.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Introduce custom session attributes
- Update `Auth.createSession()` params
- Update behavior of `Auth.renewSession()` to include attributes of old session to renewed session automatically
18 changes: 18 additions & 0 deletions .auri/$fozb3rpo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Overhaul adapter API
- Remove `UserAdapter.updateUserAttributes()`
- Remove `UserAdapter.deleteNonPrimaryKey()`
- Remove `UserAdapter.updateKeyPassword()`
- Remove `Adapter?.getSessionAndUserBySessionId()`
- Update `UserAdapter.setUser()` params
- Remove `UserAdapter.getKey()` params `shouldDataBeDeleted()`
- Add `UserAdapter.updateUser()`
- Add `UserAdapter.deleteKey()`
- Add `UserAdapter.updateKey()`
- Add `SessionAdapter.updateSession()`
- Add `Adapter.getSessionAndUser()`
- Rename type `AdapterFunction` to `InitializeAdapter`
9 changes: 9 additions & 0 deletions .auri/$jey1qi9j.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Update adapter specifications
- Insert and update methods do not return anything
- Insert and update methods for sessions and keys may optionally throw a Lucia error on invalid user id
- Insert methods do not throw Lucia errors on duplicate session and user ids
9 changes: 9 additions & 0 deletions .auri/$jhfpjptb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Remove errors:
- `AUTH_DUPLICATE_SESSION_ID`
- `AUTO_USER_ID_GENERATION_NOT_SUPPORTED`
- `AUTH_EXPIRED_KEY`
6 changes: 6 additions & 0 deletions .auri/$msq2k30f.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Remove auto database clean up functionality
6 changes: 6 additions & 0 deletions .auri/$oba8uk7e.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "@lucia-auth/adapter-sqlite" # package name
type: "major" # "major", "minor", "patch"
---

Require `lucia@^2.0.0`
8 changes: 8 additions & 0 deletions .auri/$osupufo1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
package: "major" # package name
type: "major" # "major", "minor", "patch"
---

Update `Lucia` namespace
- Rename `Lucia.UserAttributes` to `Lucia.DatabaseUserAttributes`
- Add `Lucia.DatabaseSessionAttributes`
6 changes: 6 additions & 0 deletions .auri/$oto9r3vz.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Update `Middleware` takes a new `Context` params
6 changes: 6 additions & 0 deletions .auri/$q972t1ak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "@lucia-auth/adapter-mysql" # package name
type: "major" # "major", "minor", "patch"
---

Require `lucia@^2.0.0`
10 changes: 10 additions & 0 deletions .auri/$qcdnw329.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Update exports:
- **Replace default export with named `lucia()`**
- Removed `generateRandomString()`
- Removed `serializeCookie()`
- Removed `Cookie`
6 changes: 6 additions & 0 deletions .auri/$rlqdhur2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "@lucia-auth/adapter-postgresql" # package name
type: "major" # "major", "minor", "patch"
---

Require `lucia@^2.0.0`
6 changes: 6 additions & 0 deletions .auri/$sbxeojc3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Rename `SESSION_COOKIE_NAME` to `DEFAULT_SESSION_COOKIE_NAME`
9 changes: 9 additions & 0 deletions .auri/$sc875rn3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
package: "lucia" # package name
type: "minor" # "major", "minor", "patch"
---

New `lucia/utils` export:
- `generateRandomString()`
- `serializeCookie()`
- `isWithinExpiration()`
8 changes: 8 additions & 0 deletions .auri/$tt1sakae.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
package: "@lucia-auth/adapter-mongoose" # package name
type: "major" # "major", "minor", "patch"
---

Require `lucia@^2.0.0`
- Export adapter as named exports (`mongoose()`)
- Update adapter params
6 changes: 6 additions & 0 deletions .auri/$w6gqe7de.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

**NPM package `lucia-auth` is renamed to `lucia`**
8 changes: 8 additions & 0 deletions .auri/$xwujxvj7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
package: "@lucia-auth/adapter-prisma" # package name
type: "major" # "major", "minor", "patch"
---

Require `lucia@^2.0.0`
- Export adapter as named exports (`prisma()`)
- Update adapter params
8 changes: 8 additions & 0 deletions .auri/$yk3hou53.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
package: "lucia" # package name
type: "major" # "major", "minor", "patch"
---

Update `RequestContext`:
- Add `RequestContext.headers.authorization`
- Add optional `RequestContext.storedSessionCookie`
3 changes: 3 additions & 0 deletions .auri/release.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"stage": "beta"
}
3 changes: 2 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ module.exports = {
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-empty-interface": "off",
"no-async-promise-executor": "off"
"no-async-promise-executor": "off",
"no-useless-catch": "off"
},
parser: "@typescript-eslint/parser",
extends: [
Expand Down
2 changes: 1 addition & 1 deletion documentation/content/main/adapters/d1.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ yarn add @lucia-auth/adapter-sqlite
Since the database instance is bound to the request, Lucia and the adapter must be initialized on a per-request basis.

```ts
import lucia from "lucia-auth";
import lucia from "lucia";
import { d1 } from "@lucia-auth/adapter-sqlite";
import type { D1Database } from "@cloudflare/workers-types";

Expand Down
8 changes: 4 additions & 4 deletions documentation/content/main/adapters/drizzle.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Refer to the [`mysql2`](/adapters/mysql#mysql2) section.
```ts
import mysql from "mysql2/promise";
import { drizzle } from "drizzle-orm/mysql2";
import lucia from "lucia-auth";
import lucia from "lucia";
import { mysql2 } from "@lucia-auth/adapter-mysql";

const connectionPool = mysql.createPool({
Expand All @@ -93,7 +93,7 @@ Refer to the [`planetscale`](/adapters/mysql#planetscale) section.
```ts
import { connect } from "@planetscale/database";
import { drizzle } from "drizzle-orm/planetscale";
import lucia from "lucia-auth";
import lucia from "lucia";
import { planetscale } from "@lucia-auth/adapter-mysql";

const connection = connect({
Expand Down Expand Up @@ -163,7 +163,7 @@ Refer to the [`pg`](/adapters/postgresql#pg) section.
```ts
import postgres from "pg";
import { drizzle } from "drizzle-orm/node-postgres";
import lucia from "lucia-auth";
import lucia from "lucia";
import { pg } from "@lucia-auth/adapter-postgresql";

const connectionPool = new postgres.Pool({
Expand Down Expand Up @@ -216,7 +216,7 @@ Refer to the [`better-sqlite3`](/adapters/sqlite#better-sqlite3) section.
```ts
import sqlite from "better-sqlite3";
import { drizzle } from "drizzle-orm/better-sqlite3";
import lucia from "lucia-auth";
import lucia from "lucia";
import { betterSqlite3 } from "@lucia-auth/adapter-sqlite";

const database = sqlite(pathToDbFile);
Expand Down
Loading

0 comments on commit b000db6

Please sign in to comment.