@yielded/auth-persistence-drizzle 0.1.0-beta.0 → 0.1.0-beta.12
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.
- package/README.md +6 -1
- package/dist/D1.d.mts +155 -40
- package/dist/D1.mjs +10 -6
- package/dist/D1.mjs.map +1 -1
- package/dist/Libsql.d.mts +251 -129
- package/dist/Libsql.mjs +20 -21
- package/dist/Libsql.mjs.map +1 -1
- package/dist/Mysql2.d.mts +208 -56
- package/dist/Mysql2.mjs +13 -8
- package/dist/Mysql2.mjs.map +1 -1
- package/dist/Pglite.d.mts +209 -57
- package/dist/Pglite.mjs +13 -9
- package/dist/Pglite.mjs.map +1 -1
- package/dist/Postgres.d.mts +207 -55
- package/dist/Postgres.mjs +13 -9
- package/dist/Postgres.mjs.map +1 -1
- package/dist/SqliteBun.d.mts +249 -126
- package/dist/SqliteBun.mjs +20 -18
- package/dist/SqliteBun.mjs.map +1 -1
- package/dist/SqliteDo.d.mts +248 -158
- package/dist/SqliteDo.mjs +26 -44
- package/dist/SqliteDo.mjs.map +1 -1
- package/dist/SqliteNode.d.mts +247 -124
- package/dist/SqliteNode.mjs +20 -18
- package/dist/SqliteNode.mjs.map +1 -1
- package/dist/SqliteWasm.d.mts +251 -128
- package/dist/SqliteWasm.mjs +20 -18
- package/dist/SqliteWasm.mjs.map +1 -1
- package/dist/drizzle/D1BatchStatements.d.mts +1 -1
- package/dist/drizzle/D1BatchStatements.mjs.map +1 -1
- package/dist/drizzle/d1-database.d.mts +11 -0
- package/dist/drizzle/d1-database.mjs +8 -0
- package/dist/drizzle/d1-database.mjs.map +1 -0
- package/dist/drizzle/d1-emails.d.mts +8 -7
- package/dist/drizzle/d1-emails.mjs +7 -4
- package/dist/drizzle/d1-emails.mjs.map +1 -1
- package/dist/drizzle/d1-generated-statement.mjs.map +1 -1
- package/dist/drizzle/d1-identity.mjs +12 -9
- package/dist/drizzle/d1-identity.mjs.map +1 -1
- package/dist/drizzle/d1-oauth.d.mts +41 -10
- package/dist/drizzle/d1-oauth.mjs +8 -5
- package/dist/drizzle/d1-oauth.mjs.map +1 -1
- package/dist/drizzle/d1-passkey.d.mts +3 -14
- package/dist/drizzle/d1-passkey.mjs +2 -1
- package/dist/drizzle/d1-passkey.mjs.map +1 -1
- package/dist/drizzle/d1-password-prepared.d.mts +4 -3
- package/dist/drizzle/d1-password-prepared.mjs +3 -1
- package/dist/drizzle/d1-password-prepared.mjs.map +1 -1
- package/dist/drizzle/d1-passwords.d.mts +7 -6
- package/dist/drizzle/d1-passwords.mjs +5 -2
- package/dist/drizzle/d1-passwords.mjs.map +1 -1
- package/dist/drizzle/d1-phone.d.mts +3 -4
- package/dist/drizzle/d1-phone.mjs +2 -1
- package/dist/drizzle/d1-phone.mjs.map +1 -1
- package/dist/drizzle/d1-planning.d.mts +1 -1
- package/dist/drizzle/d1-proofs.d.mts +5 -4
- package/dist/drizzle/d1-proofs.mjs +3 -1
- package/dist/drizzle/d1-proofs.mjs.map +1 -1
- package/dist/drizzle/d1-sessions.d.mts +14 -13
- package/dist/drizzle/d1-sessions.mjs +15 -9
- package/dist/drizzle/d1-sessions.mjs.map +1 -1
- package/dist/drizzle/d1-totp.d.mts +3 -4
- package/dist/drizzle/d1-totp.mjs +2 -1
- package/dist/drizzle/d1-totp.mjs.map +1 -1
- package/dist/drizzle/email-registration.d.mts +1 -1
- package/dist/drizzle/email-registration.mjs +2 -1
- package/dist/drizzle/email-registration.mjs.map +1 -1
- package/dist/drizzle/email-target.d.mts +8 -7
- package/dist/drizzle/email-target.mjs +10 -10
- package/dist/drizzle/email-target.mjs.map +1 -1
- package/dist/drizzle/model.d.mts +2 -126
- package/dist/drizzle/model.mjs +2 -21
- package/dist/drizzle/model.mjs.map +1 -1
- package/dist/drizzle/mysql-database.d.mts +8 -0
- package/dist/drizzle/mysql-database.mjs +8 -0
- package/dist/drizzle/mysql-database.mjs.map +1 -0
- package/dist/drizzle/mysql-emails.d.mts +8 -7
- package/dist/drizzle/mysql-emails.mjs +12 -8
- package/dist/drizzle/mysql-emails.mjs.map +1 -1
- package/dist/drizzle/mysql-identity.mjs +12 -9
- package/dist/drizzle/mysql-identity.mjs.map +1 -1
- package/dist/drizzle/mysql-password-prepared.d.mts +4 -3
- package/dist/drizzle/mysql-password-prepared.mjs +6 -2
- package/dist/drizzle/mysql-password-prepared.mjs.map +1 -1
- package/dist/drizzle/mysql-passwords.d.mts +7 -5
- package/dist/drizzle/mysql-passwords.mjs +11 -7
- package/dist/drizzle/mysql-passwords.mjs.map +1 -1
- package/dist/drizzle/mysql-proofs.d.mts +4 -3
- package/dist/drizzle/mysql-proofs.mjs +8 -4
- package/dist/drizzle/mysql-proofs.mjs.map +1 -1
- package/dist/drizzle/mysql-sessions.d.mts +12 -11
- package/dist/drizzle/mysql-sessions.mjs +16 -12
- package/dist/drizzle/mysql-sessions.mjs.map +1 -1
- package/dist/drizzle/native-database.mjs +10 -0
- package/dist/drizzle/native-database.mjs.map +1 -0
- package/dist/drizzle/oauth-accounts.mjs +1 -1
- package/dist/drizzle/oauth-connected-access.mjs +14 -12
- package/dist/drizzle/oauth-connected-access.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-custody.mjs +2 -2
- package/dist/drizzle/oauth-connected-drivers.mjs +11 -6
- package/dist/drizzle/oauth-connected-drivers.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-flow.mjs +2 -2
- package/dist/drizzle/oauth-connected-input.mjs +14 -1
- package/dist/drizzle/oauth-connected-input.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-maintenance.mjs +1 -1
- package/dist/drizzle/oauth-connected-management.mjs +2 -2
- package/dist/drizzle/oauth-connected-model.d.mts +17 -3
- package/dist/drizzle/oauth-connected-model.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-settlement.mjs +51 -41
- package/dist/drizzle/oauth-connected-settlement.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-sign-in.mjs +263 -0
- package/dist/drizzle/oauth-connected-sign-in.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-state.d.mts +110 -2
- package/dist/drizzle/oauth-connected-state.mjs +9 -4
- package/dist/drizzle/oauth-connected-state.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-target.d.mts +142 -15
- package/dist/drizzle/oauth-connected-target.mjs +9 -6
- package/dist/drizzle/oauth-connected-target.mjs.map +1 -1
- package/dist/drizzle/oauth-drivers.mjs +9 -7
- package/dist/drizzle/oauth-drivers.mjs.map +1 -1
- package/dist/drizzle/oauth-flow.d.mts +1 -1
- package/dist/drizzle/oauth-flow.mjs +1 -1
- package/dist/drizzle/oauth-input.mjs +1 -1
- package/dist/drizzle/oauth-model.d.mts +1 -1
- package/dist/drizzle/oauth-owner.d.mts +1 -1
- package/dist/drizzle/oauth-registration.d.mts +2 -2
- package/dist/drizzle/oauth-registration.mjs +1 -1
- package/dist/drizzle/oauth-state.mjs +5 -4
- package/dist/drizzle/oauth-state.mjs.map +1 -1
- package/dist/drizzle/oauth-target.d.mts +14 -13
- package/dist/drizzle/oauth-target.mjs +14 -13
- package/dist/drizzle/oauth-target.mjs.map +1 -1
- package/dist/drizzle/passkey-drivers.mjs +8 -6
- package/dist/drizzle/passkey-drivers.mjs.map +1 -1
- package/dist/drizzle/passkey-write-drivers.mjs +5 -3
- package/dist/drizzle/passkey-write-drivers.mjs.map +1 -1
- package/dist/drizzle/passkey-write-target.d.mts +1 -1
- package/dist/drizzle/password-prepared-sql.mjs +2 -1
- package/dist/drizzle/password-prepared-sql.mjs.map +1 -1
- package/dist/drizzle/password-prepared-state.mjs +1 -1
- package/dist/drizzle/password-prepared-target.d.mts +4 -3
- package/dist/drizzle/password-prepared-target.mjs +4 -3
- package/dist/drizzle/password-prepared-target.mjs.map +1 -1
- package/dist/drizzle/password-registration.mjs +2 -1
- package/dist/drizzle/password-registration.mjs.map +1 -1
- package/dist/drizzle/password-target.d.mts +6 -5
- package/dist/drizzle/password-target.mjs +8 -8
- package/dist/drizzle/password-target.mjs.map +1 -1
- package/dist/drizzle/pg-database.d.mts +9 -0
- package/dist/drizzle/pg-database.mjs +8 -0
- package/dist/drizzle/pg-database.mjs.map +1 -0
- package/dist/drizzle/pg-emails.d.mts +8 -7
- package/dist/drizzle/pg-emails.mjs +12 -8
- package/dist/drizzle/pg-emails.mjs.map +1 -1
- package/dist/drizzle/pg-identity.mjs +92 -0
- package/dist/drizzle/pg-identity.mjs.map +1 -0
- package/dist/drizzle/pg-password-prepared.d.mts +4 -3
- package/dist/drizzle/pg-password-prepared.mjs +6 -2
- package/dist/drizzle/pg-password-prepared.mjs.map +1 -1
- package/dist/drizzle/pg-passwords.d.mts +7 -5
- package/dist/drizzle/pg-passwords.mjs +11 -7
- package/dist/drizzle/pg-passwords.mjs.map +1 -1
- package/dist/drizzle/pg-proofs.d.mts +4 -3
- package/dist/drizzle/pg-proofs.mjs +8 -4
- package/dist/drizzle/pg-proofs.mjs.map +1 -1
- package/dist/drizzle/pg-sessions.d.mts +12 -11
- package/dist/drizzle/pg-sessions.mjs +16 -12
- package/dist/drizzle/pg-sessions.mjs.map +1 -1
- package/dist/drizzle/phone-model.d.mts +1 -1
- package/dist/drizzle/phone-target.d.mts +5 -4
- package/dist/drizzle/phone-target.mjs +12 -11
- package/dist/drizzle/phone-target.mjs.map +1 -1
- package/dist/drizzle/proof-target.d.mts +4 -3
- package/dist/drizzle/proof-target.mjs +5 -5
- package/dist/drizzle/proof-target.mjs.map +1 -1
- package/dist/drizzle/session-sql.d.mts +1 -0
- package/dist/drizzle/session-target.d.mts +11 -9
- package/dist/drizzle/session-target.mjs +11 -11
- package/dist/drizzle/session-target.mjs.map +1 -1
- package/dist/drizzle/sqlite-emails.mjs +9 -5
- package/dist/drizzle/sqlite-emails.mjs.map +1 -1
- package/dist/drizzle/sqlite-identity.mjs +14 -11
- package/dist/drizzle/sqlite-identity.mjs.map +1 -1
- package/dist/drizzle/sqlite-password-prepared.mjs +7 -3
- package/dist/drizzle/sqlite-password-prepared.mjs.map +1 -1
- package/dist/drizzle/sqlite-passwords.mjs +10 -6
- package/dist/drizzle/sqlite-passwords.mjs.map +1 -1
- package/dist/drizzle/sqlite-proofs.mjs +7 -3
- package/dist/drizzle/sqlite-proofs.mjs.map +1 -1
- package/dist/drizzle/sqlite-sessions.mjs +16 -12
- package/dist/drizzle/sqlite-sessions.mjs.map +1 -1
- package/dist/drizzle/standalone-guard.d.mts +2 -0
- package/dist/drizzle/standalone-guard.mjs +8 -4
- package/dist/drizzle/standalone-guard.mjs.map +1 -1
- package/dist/drizzle/totp-model.d.mts +1 -1
- package/dist/drizzle/totp-target.d.mts +5 -4
- package/dist/drizzle/totp-target.mjs +31 -28
- package/dist/drizzle/totp-target.mjs.map +1 -1
- package/dist/drizzle/transaction-mysql.mjs +1 -1
- package/dist/drizzle/transaction-mysql.mjs.map +1 -1
- package/dist/index.d.mts +2 -4
- package/dist/index.mjs +2 -4
- package/dist/internal/drizzle-postgres.mjs.map +1 -1
- package/dist/internal/drizzle-sqlite.mjs.map +1 -1
- package/package.json +1 -1
- package/src/D1.ts +37 -26
- package/src/Libsql.ts +45 -61
- package/src/Mysql2.ts +39 -35
- package/src/Pglite.ts +48 -30
- package/src/Postgres.ts +48 -30
- package/src/SqliteBun.ts +59 -68
- package/src/SqliteDo.ts +61 -274
- package/src/SqliteNode.ts +56 -66
- package/src/SqliteWasm.ts +56 -66
- package/src/drizzle/D1BatchStatements.ts +1 -1
- package/src/drizzle/d1-database.ts +10 -0
- package/src/drizzle/d1-emails.ts +86 -88
- package/src/drizzle/d1-generated-statement.ts +1 -1
- package/src/drizzle/d1-identity.ts +17 -20
- package/src/drizzle/d1-oauth.ts +19 -8
- package/src/drizzle/d1-passkey.ts +5 -1
- package/src/drizzle/d1-password-prepared.ts +40 -42
- package/src/drizzle/d1-passwords.ts +76 -80
- package/src/drizzle/d1-phone.ts +5 -1
- package/src/drizzle/d1-proofs.ts +31 -34
- package/src/drizzle/d1-sessions.ts +53 -40
- package/src/drizzle/d1-totp.ts +5 -1
- package/src/drizzle/email-registration.ts +6 -2
- package/src/drizzle/email-target.ts +18 -20
- package/src/drizzle/model.ts +1 -208
- package/src/drizzle/mysql-database.ts +8 -0
- package/src/drizzle/mysql-emails.ts +29 -17
- package/src/drizzle/mysql-identity.ts +18 -21
- package/src/drizzle/mysql-password-prepared.ts +11 -9
- package/src/drizzle/mysql-passwords.ts +22 -10
- package/src/drizzle/mysql-proofs.ts +17 -6
- package/src/drizzle/mysql-sessions.ts +41 -18
- package/src/drizzle/native-database.ts +22 -0
- package/src/drizzle/oauth-connected-access.ts +8 -1
- package/src/drizzle/oauth-connected-drivers.ts +21 -6
- package/src/drizzle/oauth-connected-input.ts +13 -0
- package/src/drizzle/oauth-connected-model.ts +17 -0
- package/src/drizzle/oauth-connected-settlement.ts +65 -42
- package/src/drizzle/oauth-connected-sign-in.ts +438 -0
- package/src/drizzle/oauth-connected-state.ts +19 -7
- package/src/drizzle/oauth-connected-target.ts +26 -18
- package/src/drizzle/oauth-drivers.ts +26 -10
- package/src/drizzle/oauth-state.ts +5 -4
- package/src/drizzle/oauth-target.ts +31 -43
- package/src/drizzle/passkey-drivers.ts +21 -13
- package/src/drizzle/passkey-write-drivers.ts +11 -6
- package/src/drizzle/password-prepared-sql.ts +2 -4
- package/src/drizzle/password-prepared-target.ts +10 -7
- package/src/drizzle/password-registration.ts +7 -8
- package/src/drizzle/password-target.ts +20 -19
- package/src/drizzle/pg-database.ts +10 -0
- package/src/drizzle/pg-emails.ts +29 -17
- package/src/drizzle/pg-identity.ts +297 -0
- package/src/drizzle/pg-password-prepared.ts +11 -9
- package/src/drizzle/pg-passwords.ts +22 -10
- package/src/drizzle/pg-proofs.ts +17 -6
- package/src/drizzle/pg-sessions.ts +41 -18
- package/src/drizzle/phone-target.ts +23 -18
- package/src/drizzle/proof-target.ts +10 -13
- package/src/drizzle/session-target.ts +33 -51
- package/src/drizzle/sqlite-emails.ts +31 -14
- package/src/drizzle/sqlite-identity.ts +22 -42
- package/src/drizzle/sqlite-password-prepared.ts +24 -10
- package/src/drizzle/sqlite-passwords.ts +30 -16
- package/src/drizzle/sqlite-proofs.ts +29 -6
- package/src/drizzle/sqlite-sessions.ts +50 -24
- package/src/drizzle/standalone-guard.ts +19 -7
- package/src/drizzle/totp-target.ts +62 -61
- package/src/drizzle/transaction-mysql.ts +1 -1
- package/src/index.ts +0 -24
- package/src/internal/drizzle-postgres.ts +1 -1
- package/src/internal/drizzle-sqlite.ts +1 -1
- package/dist/drizzle/d1-identity.d.mts +0 -30
- package/dist/drizzle/mysql-identity.d.mts +0 -21
- package/dist/drizzle/mysql.d.mts +0 -69
- package/dist/drizzle/mysql.mjs +0 -218
- package/dist/drizzle/mysql.mjs.map +0 -1
- package/dist/drizzle/pg.d.mts +0 -80
- package/dist/drizzle/pg.mjs +0 -289
- package/dist/drizzle/pg.mjs.map +0 -1
- package/dist/drizzle/sqlite.d.mts +0 -77
- package/dist/drizzle/sqlite.mjs +0 -217
- package/dist/drizzle/sqlite.mjs.map +0 -1
- package/src/drizzle/mysql.ts +0 -687
- package/src/drizzle/pg.ts +0 -984
- package/src/drizzle/sqlite.ts +0 -705
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@yielded/auth-persistence-drizzle","version":"0.1.0-beta.
|
|
1
|
+
{"name":"@yielded/auth-persistence-drizzle","version":"0.1.0-beta.12","dependencies":{"@noble/hashes":"2.3.0","@yielded/auth":"0.1.0-beta.12","@yielded/auth-crypto":"0.1.0-beta.12","@yielded/auth-persistence":"0.1.0-beta.12"},"devDependencies":{"@effect/platform-bun":"4.0.0","@effect/platform-node":"4.0.0","@effect/sql-d1":"4.0.0","@effect/sql-libsql":"4.0.0","@effect/sql-mysql2":"4.0.0","@effect/sql-pg":"4.0.0","@effect/sql-pglite":"4.0.0","@effect/sql-sqlite-bun":"4.0.0","@effect/sql-sqlite-do":"4.0.0","@effect/sql-sqlite-node":"4.0.0","@effect/sql-sqlite-wasm":"4.0.0","@effect/vitest":"4.0.0","drizzle-orm":"1.0.0-rc.4","effect":"4.0.0","typescript":"7.0.2","vite-plus":"0.3.3"},"peerDependencies":{"@effect/sql-d1":">=4.0.0","@effect/sql-libsql":">=4.0.0","@effect/sql-mysql2":">=4.0.0","@effect/sql-pg":">=4.0.0","@effect/sql-pglite":">=4.0.0","@effect/sql-sqlite-bun":">=4.0.0","@effect/sql-sqlite-do":">=4.0.0","@effect/sql-sqlite-node":">=4.0.0","@effect/sql-sqlite-wasm":">=4.0.0","drizzle-orm":">=1.0.0-rc.4","effect":"^4.0.0"},"exports":{".":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"./D1":{"types":"./dist/D1.d.mts","default":"./dist/D1.mjs"},"./Libsql":{"types":"./dist/Libsql.d.mts","default":"./dist/Libsql.mjs"},"./Mysql2":{"types":"./dist/Mysql2.d.mts","default":"./dist/Mysql2.mjs"},"./Pglite":{"types":"./dist/Pglite.d.mts","default":"./dist/Pglite.mjs"},"./Postgres":{"types":"./dist/Postgres.d.mts","default":"./dist/Postgres.mjs"},"./SqliteBun":{"types":"./dist/SqliteBun.d.mts","default":"./dist/SqliteBun.mjs"},"./SqliteDo":{"types":"./dist/SqliteDo.d.mts","default":"./dist/SqliteDo.mjs"},"./SqliteNode":{"types":"./dist/SqliteNode.d.mts","default":"./dist/SqliteNode.mjs"},"./SqliteWasm":{"types":"./dist/SqliteWasm.d.mts","default":"./dist/SqliteWasm.mjs"}},"description":"Drizzle persistence, table mappings, and migration adapters for Yielded Auth.","homepage":"https://yielded.dev/auth/","bugs":{"url":"https://github.com/yielded-dev/auth/issues"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/yielded-dev/auth.git","directory":"packages/auth-persistence-drizzle"},"files":["dist","src"],"type":"module","sideEffects":[],"publishConfig":{"access":"public"},"scripts":{"build":"vp pack","check":"tsc --noEmit -p tsconfig.json","test":"vp test --passWithNoTests","example:totp":"bun test/fixtures/totp-sqlite-bun.ts"},"peerDependenciesMeta":{"@effect/sql-d1":{"optional":true},"@effect/sql-libsql":{"optional":true},"@effect/sql-mysql2":{"optional":true},"@effect/sql-pg":{"optional":true},"@effect/sql-pglite":{"optional":true},"@effect/sql-sqlite-bun":{"optional":true},"@effect/sql-sqlite-do":{"optional":true},"@effect/sql-sqlite-node":{"optional":true},"@effect/sql-sqlite-wasm":{"optional":true}}}
|
package/src/D1.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { D1Client } from "@effect/sql-d1/D1Client";
|
|
2
2
|
export { makeTotpPersistenceServices, coordinateTotpPersistence } from "./drizzle/d1-totp";
|
|
3
3
|
import type { AnyRelations } from "drizzle-orm";
|
|
4
|
-
import type
|
|
4
|
+
import { type EffectSQLiteD1Database, makeWithDefaults } from "drizzle-orm/effect-d1";
|
|
5
5
|
import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
6
6
|
|
|
7
|
+
import { Database } from "./drizzle/d1-database";
|
|
8
|
+
export { Database } from "./drizzle/d1-database";
|
|
9
|
+
|
|
7
10
|
export {
|
|
8
11
|
makeD1OAuthAccountsServices as makeOAuthAccountsServices,
|
|
9
12
|
makeD1OAuthSignInServices as makeOAuthSignInServices,
|
|
@@ -52,30 +55,30 @@ export {
|
|
|
52
55
|
makeD1EmailSignInServices as makeEmailSignInServices,
|
|
53
56
|
} from "./drizzle/d1-emails";
|
|
54
57
|
|
|
55
|
-
import
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
} from "./drizzle/sqlite";
|
|
61
|
-
|
|
62
|
-
export {
|
|
63
|
-
makeD1ExternalIdentityServices as makeExternalIdentityServices,
|
|
64
|
-
makeD1SubjectProvisioningServices as makeSubjectProvisioningServices,
|
|
65
|
-
makeSqliteAuthStoreServices as makeAuthStoreServices,
|
|
66
|
-
makeSqliteOAuthStateServices as makeOAuthStateServices,
|
|
67
|
-
};
|
|
58
|
+
import type {
|
|
59
|
+
D1GeneratedIdentityMapping,
|
|
60
|
+
D1SubjectProvisioningMapping,
|
|
61
|
+
D1ExternalIdentityMapping,
|
|
62
|
+
} from "./drizzle/model";
|
|
68
63
|
|
|
69
|
-
export const
|
|
64
|
+
export const makeSubjectProvisioningServices = <
|
|
65
|
+
Subject extends AnySQLiteTable,
|
|
66
|
+
Identifier extends AnySQLiteTable,
|
|
67
|
+
Request extends AnySQLiteTable,
|
|
68
|
+
NativeId,
|
|
69
|
+
>(
|
|
70
|
+
mapping: D1SubjectProvisioningMapping<Subject, Identifier, Request, NativeId>,
|
|
71
|
+
) => makeD1SubjectProvisioningServices(mapping);
|
|
70
72
|
|
|
71
|
-
export const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
export const makeExternalIdentityServices = <
|
|
74
|
+
Subject extends AnySQLiteTable,
|
|
75
|
+
External extends AnySQLiteTable,
|
|
76
|
+
NativeId,
|
|
75
77
|
>(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
mapping: D1ExternalIdentityMapping<Subject, External, NativeId>,
|
|
79
|
+
) => makeD1ExternalIdentityServices(mapping);
|
|
80
|
+
|
|
81
|
+
export const commitMode = "batch" as const;
|
|
79
82
|
|
|
80
83
|
export const makeIdentityServices = <
|
|
81
84
|
Subject extends AnySQLiteTable,
|
|
@@ -84,9 +87,8 @@ export const makeIdentityServices = <
|
|
|
84
87
|
Request extends AnySQLiteTable,
|
|
85
88
|
NativeId,
|
|
86
89
|
>(
|
|
87
|
-
database: EffectSQLiteD1Database<AnyRelations> & { readonly $client: D1Client },
|
|
88
90
|
mapping: D1GeneratedIdentityMapping<Subject, Identifier, External, Request, NativeId>,
|
|
89
|
-
) => makeD1IdentityServices(
|
|
91
|
+
) => makeD1IdentityServices(mapping);
|
|
90
92
|
|
|
91
93
|
export {
|
|
92
94
|
makeD1SessionStepUpServices as makeSessionStepUpServices,
|
|
@@ -100,16 +102,22 @@ export {
|
|
|
100
102
|
|
|
101
103
|
export { passwordPreparedPersistenceLayer } from "./drizzle/password-prepared-target";
|
|
102
104
|
|
|
103
|
-
import { Effect } from "effect";
|
|
105
|
+
import { Effect, Layer } from "effect";
|
|
104
106
|
|
|
105
107
|
import { makeD1OAuthConnectedTarget } from "./drizzle/oauth-connected-drivers";
|
|
106
108
|
import type { OAuthD1Mapping } from "./drizzle/oauth-model";
|
|
107
109
|
|
|
108
110
|
const connectedTarget = makeD1OAuthConnectedTarget<
|
|
111
|
+
Database,
|
|
109
112
|
EffectSQLiteD1Database<AnyRelations> & { readonly $client: D1Client },
|
|
110
113
|
AnySQLiteTable<{ dialect: "sqlite" }>,
|
|
111
114
|
OAuthD1Mapping
|
|
112
|
-
>(
|
|
115
|
+
>(Database, {
|
|
116
|
+
mode: "batch",
|
|
117
|
+
dialect: "sqlite",
|
|
118
|
+
locking: false,
|
|
119
|
+
standaloneGuard: () => Effect.void,
|
|
120
|
+
});
|
|
113
121
|
|
|
114
122
|
export const {
|
|
115
123
|
makeOAuthConnectedServices,
|
|
@@ -134,3 +142,6 @@ export {
|
|
|
134
142
|
export { D1BatchStatements } from "./drizzle/D1BatchStatements";
|
|
135
143
|
|
|
136
144
|
export { makePhonePersistenceServices, coordinatePhonePersistence } from "./drizzle/d1-phone";
|
|
145
|
+
|
|
146
|
+
/** Construct Drizzle from the driver's SQL-client Layer. */
|
|
147
|
+
export const databaseLayer = Layer.effect(Database, makeWithDefaults({}));
|
package/src/Libsql.ts
CHANGED
|
@@ -1,37 +1,28 @@
|
|
|
1
|
-
import { requireStandalone as standalone } from "@yielded/auth-persistence/Adapter";
|
|
1
|
+
import { NativeDatabase, requireStandalone as standalone } from "@yielded/auth-persistence/Adapter";
|
|
2
2
|
import { EmailUnavailable } from "@yielded/auth/Email";
|
|
3
|
-
import { AuthStoreError } from "@yielded/auth/Errors";
|
|
4
3
|
import { PasswordUnavailable } from "@yielded/auth/Password";
|
|
5
4
|
import { ProofUnavailable } from "@yielded/auth/Proofs";
|
|
6
5
|
import { SessionUnavailable } from "@yielded/auth/Sessions";
|
|
7
6
|
import type { AnyRelations } from "drizzle-orm";
|
|
8
7
|
import { type EffectLibsqlDatabase, makeWithDefaults } from "drizzle-orm/effect-libsql";
|
|
9
8
|
import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
10
|
-
import { Effect } from "effect";
|
|
9
|
+
import { Context, Effect, Layer } from "effect";
|
|
10
|
+
|
|
11
|
+
import { nativeDatabase } from "./drizzle/native-database";
|
|
12
|
+
|
|
13
|
+
/** The application-owned Drizzle database used to construct persistence services. */
|
|
14
|
+
export class Database extends Context.Service<Database, EffectLibsqlDatabase<AnyRelations>>()(
|
|
15
|
+
"effect-auth/persistence-drizzle/Libsql/Database",
|
|
16
|
+
) {}
|
|
17
|
+
|
|
18
|
+
/** Construct Drizzle from the driver's SQL-client Layer. */
|
|
19
|
+
export const databaseLayer = Layer.effect(Database, makeWithDefaults({}));
|
|
11
20
|
|
|
12
21
|
import type {
|
|
13
|
-
AuthStoreTables,
|
|
14
|
-
AuthTables,
|
|
15
22
|
ExternalIdentityTables,
|
|
16
23
|
IdentityTables,
|
|
17
|
-
OAuthStateTables,
|
|
18
24
|
SubjectProvisioningTables,
|
|
19
25
|
} from "./drizzle/model";
|
|
20
|
-
import {
|
|
21
|
-
coordinateSqliteAuthStoreTransaction,
|
|
22
|
-
coordinateSqliteAuthTransaction,
|
|
23
|
-
coordinateSqliteOAuthStateTransaction,
|
|
24
|
-
makeSqliteAuthServices,
|
|
25
|
-
makeSqliteAuthStoreServices,
|
|
26
|
-
makeSqliteOAuthStateServices,
|
|
27
|
-
} from "./drizzle/sqlite";
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
coordinateSqliteAuthStoreTransaction as coordinateAuthStoreTransaction,
|
|
31
|
-
coordinateSqliteAuthTransaction as coordinateAuthTransaction,
|
|
32
|
-
coordinateSqliteOAuthStateTransaction as coordinateOAuthStateTransaction,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
26
|
import { makeSqliteEmailTarget, sqliteEmailConfiguration } from "./drizzle/sqlite-emails";
|
|
36
27
|
import {
|
|
37
28
|
makeSqliteExternalIdentityServices,
|
|
@@ -42,30 +33,28 @@ import { makeSqlitePasswordTarget, sqlitePasswordConfiguration } from "./drizzle
|
|
|
42
33
|
import { makeSqliteProofTarget, sqliteProofConfiguration } from "./drizzle/sqlite-proofs";
|
|
43
34
|
import { makeSqliteSessionTarget, sqliteSessionConfiguration } from "./drizzle/sqlite-sessions";
|
|
44
35
|
|
|
45
|
-
const requireStandalone = standalone(() =>
|
|
46
|
-
AuthStoreError.make({
|
|
47
|
-
message: "Use the decision consume API inside an outer database transaction",
|
|
48
|
-
}),
|
|
49
|
-
);
|
|
50
|
-
|
|
51
36
|
const requireStandaloneSession = standalone(() => SessionUnavailable.make({}));
|
|
52
37
|
const requireStandaloneProof = standalone(() => ProofUnavailable.make({}));
|
|
53
38
|
const requireStandalonePassword = standalone(() => PasswordUnavailable.make({}));
|
|
54
39
|
const requireStandaloneEmail = standalone(() => EmailUnavailable.make({}));
|
|
55
40
|
|
|
56
|
-
const sessionTarget = makeSqliteSessionTarget<EffectLibsqlDatabase<AnyRelations>>(
|
|
41
|
+
const sessionTarget = makeSqliteSessionTarget<Database, EffectLibsqlDatabase<AnyRelations>>(
|
|
42
|
+
Database,
|
|
57
43
|
sqliteSessionConfiguration("interactive", requireStandaloneSession),
|
|
58
44
|
);
|
|
59
45
|
|
|
60
|
-
const proofTarget = makeSqliteProofTarget<EffectLibsqlDatabase<AnyRelations>>(
|
|
46
|
+
const proofTarget = makeSqliteProofTarget<Database, EffectLibsqlDatabase<AnyRelations>>(
|
|
47
|
+
Database,
|
|
61
48
|
sqliteProofConfiguration("interactive", requireStandaloneProof),
|
|
62
49
|
);
|
|
63
50
|
|
|
64
|
-
const passwordTarget = makeSqlitePasswordTarget<EffectLibsqlDatabase<AnyRelations>>(
|
|
51
|
+
const passwordTarget = makeSqlitePasswordTarget<Database, EffectLibsqlDatabase<AnyRelations>>(
|
|
52
|
+
Database,
|
|
65
53
|
sqlitePasswordConfiguration("interactive", requireStandalonePassword, requireStandaloneProof),
|
|
66
54
|
);
|
|
67
55
|
|
|
68
|
-
const emailTarget = makeSqliteEmailTarget<EffectLibsqlDatabase<AnyRelations>>(
|
|
56
|
+
const emailTarget = makeSqliteEmailTarget<Database, EffectLibsqlDatabase<AnyRelations>>(
|
|
57
|
+
Database,
|
|
69
58
|
sqliteEmailConfiguration("interactive", requireStandaloneEmail, requireStandaloneProof),
|
|
70
59
|
);
|
|
71
60
|
|
|
@@ -101,25 +90,6 @@ export const {
|
|
|
101
90
|
|
|
102
91
|
export const commitMode = "interactive" as const;
|
|
103
92
|
|
|
104
|
-
export const makeAuthStoreServices = <C extends AnySQLiteTable, R extends AnySQLiteTable>(
|
|
105
|
-
database: EffectLibsqlDatabase<AnyRelations>,
|
|
106
|
-
mapping: AuthStoreTables<C, R>,
|
|
107
|
-
) => makeSqliteAuthStoreServices(database, mapping, requireStandalone);
|
|
108
|
-
|
|
109
|
-
export const makeOAuthStateServices = <S extends AnySQLiteTable>(
|
|
110
|
-
database: EffectLibsqlDatabase<AnyRelations>,
|
|
111
|
-
mapping: OAuthStateTables<S>,
|
|
112
|
-
) => makeSqliteOAuthStateServices(database, mapping, requireStandalone);
|
|
113
|
-
|
|
114
|
-
export const makeAuthServices = <
|
|
115
|
-
C extends AnySQLiteTable,
|
|
116
|
-
R extends AnySQLiteTable,
|
|
117
|
-
S extends AnySQLiteTable,
|
|
118
|
-
>(
|
|
119
|
-
database: EffectLibsqlDatabase<AnyRelations>,
|
|
120
|
-
mapping: AuthTables<C, R, S>,
|
|
121
|
-
) => makeSqliteAuthServices(database, mapping, requireStandalone);
|
|
122
|
-
|
|
123
93
|
export const makeIdentityServices = <
|
|
124
94
|
Subject extends AnySQLiteTable,
|
|
125
95
|
Identifier extends AnySQLiteTable,
|
|
@@ -127,9 +97,11 @@ export const makeIdentityServices = <
|
|
|
127
97
|
Request extends AnySQLiteTable,
|
|
128
98
|
NativeId,
|
|
129
99
|
>(
|
|
130
|
-
database: EffectLibsqlDatabase<AnyRelations>,
|
|
131
100
|
mapping: IdentityTables<Subject, Identifier, External, Request, NativeId>,
|
|
132
|
-
) =>
|
|
101
|
+
) =>
|
|
102
|
+
makeSqliteIdentityServices(mapping, "interactive").pipe(
|
|
103
|
+
Effect.provideServiceEffect(NativeDatabase, nativeDatabase(Database)),
|
|
104
|
+
);
|
|
133
105
|
|
|
134
106
|
export const makeSubjectProvisioningServices = <
|
|
135
107
|
Subject extends AnySQLiteTable,
|
|
@@ -137,22 +109,30 @@ export const makeSubjectProvisioningServices = <
|
|
|
137
109
|
Request extends AnySQLiteTable,
|
|
138
110
|
NativeId,
|
|
139
111
|
>(
|
|
140
|
-
database: EffectLibsqlDatabase<AnyRelations>,
|
|
141
112
|
mapping: SubjectProvisioningTables<Subject, Identifier, Request, NativeId>,
|
|
142
|
-
) =>
|
|
113
|
+
) =>
|
|
114
|
+
makeSqliteSubjectProvisioningServices(mapping, "interactive").pipe(
|
|
115
|
+
Effect.provideServiceEffect(NativeDatabase, nativeDatabase(Database)),
|
|
116
|
+
);
|
|
143
117
|
|
|
144
118
|
export const makeExternalIdentityServices = <
|
|
145
119
|
Subject extends AnySQLiteTable,
|
|
146
120
|
External extends AnySQLiteTable,
|
|
147
121
|
NativeId,
|
|
148
122
|
>(
|
|
149
|
-
database: EffectLibsqlDatabase<AnyRelations>,
|
|
150
123
|
mapping: ExternalIdentityTables<Subject, External, NativeId>,
|
|
151
|
-
) =>
|
|
124
|
+
) =>
|
|
125
|
+
makeSqliteExternalIdentityServices(mapping).pipe(
|
|
126
|
+
Effect.provideServiceEffect(NativeDatabase, nativeDatabase(Database)),
|
|
127
|
+
);
|
|
152
128
|
|
|
153
129
|
import { makeSqlitePasswordPreparedTarget } from "./drizzle/sqlite-password-prepared";
|
|
154
130
|
|
|
155
|
-
const passwordPreparedTarget = makeSqlitePasswordPreparedTarget<
|
|
131
|
+
const passwordPreparedTarget = makeSqlitePasswordPreparedTarget<
|
|
132
|
+
Database,
|
|
133
|
+
EffectLibsqlDatabase<AnyRelations>
|
|
134
|
+
>(
|
|
135
|
+
Database,
|
|
156
136
|
sqlitePasswordConfiguration("interactive", requireStandalonePassword, requireStandaloneProof),
|
|
157
137
|
);
|
|
158
138
|
|
|
@@ -165,9 +145,10 @@ import { makeOAuthTarget } from "./drizzle/oauth-drivers";
|
|
|
165
145
|
import { sqlClientOAuthStandaloneGuard } from "./drizzle/oauth-target";
|
|
166
146
|
|
|
167
147
|
const oauthTarget = makeOAuthTarget<
|
|
148
|
+
Database,
|
|
168
149
|
EffectLibsqlDatabase<AnyRelations>,
|
|
169
150
|
AnySQLiteTable<{ dialect: "sqlite" }>
|
|
170
|
-
>({
|
|
151
|
+
>(Database, {
|
|
171
152
|
mode: "interactive",
|
|
172
153
|
dialect: "sqlite",
|
|
173
154
|
locking: false,
|
|
@@ -193,9 +174,10 @@ import { makePasskeyTarget } from "./drizzle/passkey-drivers";
|
|
|
193
174
|
import { sqlClientPasskeyStandaloneGuard } from "./drizzle/passkey-target";
|
|
194
175
|
|
|
195
176
|
const passkeyTarget = makePasskeyTarget<
|
|
177
|
+
Database,
|
|
196
178
|
EffectLibsqlDatabase<AnyRelations>,
|
|
197
179
|
AnySQLiteTable<{ dialect: "sqlite" }>
|
|
198
|
-
>({
|
|
180
|
+
>(Database, {
|
|
199
181
|
mode: "interactive",
|
|
200
182
|
dialect: "sqlite",
|
|
201
183
|
locking: false,
|
|
@@ -218,9 +200,10 @@ export const {
|
|
|
218
200
|
import { makeTotpTarget, sqlClientTotpStandaloneGuard } from "./drizzle/totp-target";
|
|
219
201
|
|
|
220
202
|
const totpTarget = makeTotpTarget<
|
|
203
|
+
Database,
|
|
221
204
|
EffectLibsqlDatabase<AnyRelations>,
|
|
222
205
|
AnySQLiteTable<{ dialect: "sqlite" }>
|
|
223
|
-
>({
|
|
206
|
+
>(Database, {
|
|
224
207
|
mode: "interactive",
|
|
225
208
|
dialect: "sqlite",
|
|
226
209
|
locking: false,
|
|
@@ -232,9 +215,10 @@ export const { makeTotpPersistenceServices, coordinateTotpPersistence } = totpTa
|
|
|
232
215
|
import { makePhoneTarget, sqlClientPhoneStandaloneGuard } from "./drizzle/phone-target";
|
|
233
216
|
|
|
234
217
|
const phoneTarget = makePhoneTarget<
|
|
218
|
+
Database,
|
|
235
219
|
EffectLibsqlDatabase<AnyRelations>,
|
|
236
220
|
AnySQLiteTable<{ dialect: "sqlite" }>
|
|
237
|
-
>({
|
|
221
|
+
>(Database, {
|
|
238
222
|
mode: "interactive",
|
|
239
223
|
dialect: "sqlite",
|
|
240
224
|
locking: false,
|
package/src/Mysql2.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { AnyRelations } from "drizzle-orm";
|
|
2
|
-
import type
|
|
2
|
+
import { type EffectMysql2Database, makeWithDefaults } from "drizzle-orm/effect-mysql2";
|
|
3
3
|
import type { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
makeMysqlOAuthStateServices,
|
|
13
|
-
} from "./drizzle/mysql";
|
|
4
|
+
import { Layer } from "effect";
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
IdentityTables,
|
|
8
|
+
SubjectProvisioningTables,
|
|
9
|
+
ExternalIdentityTables,
|
|
10
|
+
} from "./drizzle/model";
|
|
11
|
+
import { Database } from "./drizzle/mysql-database";
|
|
14
12
|
import {
|
|
15
13
|
makeMysqlExternalIdentityServices,
|
|
16
14
|
makeMysqlIdentityServices,
|
|
17
15
|
makeMysqlSubjectProvisioningServices,
|
|
18
16
|
} from "./drizzle/mysql-identity";
|
|
19
17
|
|
|
18
|
+
export { Database } from "./drizzle/mysql-database";
|
|
19
|
+
|
|
20
20
|
export {
|
|
21
21
|
coordinateMysqlAuthenticationAuthority as coordinateAuthenticationAuthority,
|
|
22
22
|
coordinateMysqlPendingAuthentication as coordinatePendingAuthentication,
|
|
@@ -48,26 +48,24 @@ export {
|
|
|
48
48
|
makeMysqlEmailSignInServices as makeEmailSignInServices,
|
|
49
49
|
} from "./drizzle/mysql-emails";
|
|
50
50
|
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const commitMode = "interactive" as const;
|
|
51
|
+
export const makeSubjectProvisioningServices = <
|
|
52
|
+
Subject extends AnyMySqlTable,
|
|
53
|
+
Identifier extends AnyMySqlTable,
|
|
54
|
+
Request extends AnyMySqlTable,
|
|
55
|
+
NativeId,
|
|
56
|
+
>(
|
|
57
|
+
mapping: SubjectProvisioningTables<Subject, Identifier, Request, NativeId>,
|
|
58
|
+
) => makeMysqlSubjectProvisioningServices(mapping);
|
|
62
59
|
|
|
63
|
-
export const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
export const makeExternalIdentityServices = <
|
|
61
|
+
Subject extends AnyMySqlTable,
|
|
62
|
+
External extends AnyMySqlTable,
|
|
63
|
+
NativeId,
|
|
67
64
|
>(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
mapping: ExternalIdentityTables<Subject, External, NativeId>,
|
|
66
|
+
) => makeMysqlExternalIdentityServices(mapping);
|
|
67
|
+
|
|
68
|
+
export const commitMode = "interactive" as const;
|
|
71
69
|
|
|
72
70
|
export const makeIdentityServices = <
|
|
73
71
|
Subject extends AnyMySqlTable,
|
|
@@ -76,9 +74,8 @@ export const makeIdentityServices = <
|
|
|
76
74
|
Request extends AnyMySqlTable,
|
|
77
75
|
NativeId,
|
|
78
76
|
>(
|
|
79
|
-
database: EffectMysql2Database<AnyRelations>,
|
|
80
77
|
mapping: IdentityTables<Subject, Identifier, External, Request, NativeId>,
|
|
81
|
-
) => makeMysqlIdentityServices(
|
|
78
|
+
) => makeMysqlIdentityServices(mapping);
|
|
82
79
|
|
|
83
80
|
export {
|
|
84
81
|
makeMysqlSessionStepUpServices as makeSessionStepUpServices,
|
|
@@ -97,9 +94,10 @@ import { mysqlOAuthTransaction } from "./drizzle/oauth-mysql";
|
|
|
97
94
|
import { sqlClientOAuthStandaloneGuard } from "./drizzle/oauth-target";
|
|
98
95
|
|
|
99
96
|
const oauthTarget = makeOAuthTarget<
|
|
97
|
+
Database,
|
|
100
98
|
EffectMysql2Database<AnyRelations>,
|
|
101
99
|
AnyMySqlTable<{ dialect: "mysql" }>
|
|
102
|
-
>({
|
|
100
|
+
>(Database, {
|
|
103
101
|
mode: "interactive",
|
|
104
102
|
dialect: "mysql",
|
|
105
103
|
locking: true,
|
|
@@ -128,9 +126,10 @@ import { sqlClientPasskeyStandaloneGuard } from "./drizzle/passkey-target";
|
|
|
128
126
|
import { mysqlTransaction } from "./drizzle/transaction-mysql";
|
|
129
127
|
|
|
130
128
|
const passkeyTarget = makePasskeyTarget<
|
|
129
|
+
Database,
|
|
131
130
|
EffectMysql2Database<AnyRelations>,
|
|
132
131
|
AnyMySqlTable<{ dialect: "mysql" }>
|
|
133
|
-
>({
|
|
132
|
+
>(Database, {
|
|
134
133
|
mode: "interactive",
|
|
135
134
|
dialect: "mysql",
|
|
136
135
|
locking: true,
|
|
@@ -155,9 +154,10 @@ import { unavailable as totpUnavailable } from "./drizzle/totp-state";
|
|
|
155
154
|
import { makeTotpTarget, sqlClientTotpStandaloneGuard } from "./drizzle/totp-target";
|
|
156
155
|
|
|
157
156
|
const totpTarget = makeTotpTarget<
|
|
157
|
+
Database,
|
|
158
158
|
EffectMysql2Database<AnyRelations>,
|
|
159
159
|
AnyMySqlTable<{ dialect: "mysql" }>
|
|
160
|
-
>({
|
|
160
|
+
>(Database, {
|
|
161
161
|
mode: "interactive",
|
|
162
162
|
dialect: "mysql",
|
|
163
163
|
locking: true,
|
|
@@ -171,9 +171,10 @@ import { unavailable as phoneUnavailable } from "./drizzle/phone-state";
|
|
|
171
171
|
import { makePhoneTarget, sqlClientPhoneStandaloneGuard } from "./drizzle/phone-target";
|
|
172
172
|
|
|
173
173
|
const phoneTarget = makePhoneTarget<
|
|
174
|
+
Database,
|
|
174
175
|
EffectMysql2Database<AnyRelations>,
|
|
175
176
|
AnyMySqlTable<{ dialect: "mysql" }>
|
|
176
|
-
>({
|
|
177
|
+
>(Database, {
|
|
177
178
|
mode: "interactive",
|
|
178
179
|
dialect: "mysql",
|
|
179
180
|
locking: true,
|
|
@@ -182,3 +183,6 @@ const phoneTarget = makePhoneTarget<
|
|
|
182
183
|
});
|
|
183
184
|
|
|
184
185
|
export const { makePhonePersistenceServices, coordinatePhonePersistence } = phoneTarget;
|
|
186
|
+
|
|
187
|
+
/** Construct Drizzle from the driver's SQL-client Layer. */
|
|
188
|
+
export const databaseLayer = Layer.effect(Database, makeWithDefaults({}));
|
package/src/Pglite.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import type { AnyRelations } from "drizzle-orm";
|
|
2
2
|
import { type EffectPgDatabase, makeWithDefaults } from "drizzle-orm/effect-pglite";
|
|
3
3
|
import type { AnyPgTable } from "drizzle-orm/pg-core";
|
|
4
|
-
import { Effect } from "effect";
|
|
5
|
-
|
|
6
|
-
import type {
|
|
4
|
+
import { Effect, Layer } from "effect";
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
IdentityTables,
|
|
8
|
+
SubjectProvisioningTables,
|
|
9
|
+
ExternalIdentityTables,
|
|
10
|
+
} from "./drizzle/model";
|
|
11
|
+
import { Database } from "./drizzle/pg-database";
|
|
7
12
|
import {
|
|
8
|
-
coordinatePgAuthStoreTransaction,
|
|
9
|
-
coordinatePgAuthTransaction,
|
|
10
|
-
coordinatePgOAuthStateTransaction,
|
|
11
|
-
makePgAuthServices,
|
|
12
|
-
makePgAuthStoreServices,
|
|
13
13
|
makePgExternalIdentityServices,
|
|
14
14
|
makePgIdentityServices,
|
|
15
|
-
makePgOAuthStateServices,
|
|
16
15
|
makePgSubjectProvisioningServices,
|
|
17
|
-
} from "./drizzle/pg";
|
|
16
|
+
} from "./drizzle/pg-identity";
|
|
17
|
+
|
|
18
|
+
export { Database } from "./drizzle/pg-database";
|
|
18
19
|
|
|
19
20
|
export {
|
|
20
21
|
coordinatePgAuthenticationAuthority as coordinateAuthenticationAuthority,
|
|
@@ -47,22 +48,24 @@ export {
|
|
|
47
48
|
makePgEmailSignInServices as makeEmailSignInServices,
|
|
48
49
|
} from "./drizzle/pg-emails";
|
|
49
50
|
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
51
|
+
export const makeSubjectProvisioningServices = <
|
|
52
|
+
Subject extends AnyPgTable,
|
|
53
|
+
Identifier extends AnyPgTable,
|
|
54
|
+
Request extends AnyPgTable,
|
|
55
|
+
NativeId,
|
|
56
|
+
>(
|
|
57
|
+
mapping: SubjectProvisioningTables<Subject, Identifier, Request, NativeId>,
|
|
58
|
+
) => makePgSubjectProvisioningServices(mapping);
|
|
59
59
|
|
|
60
|
-
export const
|
|
60
|
+
export const makeExternalIdentityServices = <
|
|
61
|
+
Subject extends AnyPgTable,
|
|
62
|
+
External extends AnyPgTable,
|
|
63
|
+
NativeId,
|
|
64
|
+
>(
|
|
65
|
+
mapping: ExternalIdentityTables<Subject, External, NativeId>,
|
|
66
|
+
) => makePgExternalIdentityServices(mapping);
|
|
61
67
|
|
|
62
|
-
export const
|
|
63
|
-
database: EffectPgDatabase<AnyRelations>,
|
|
64
|
-
mapping: AuthTables<C, R, S>,
|
|
65
|
-
) => makePgAuthServices(database, mapping);
|
|
68
|
+
export const commitMode = "interactive" as const;
|
|
66
69
|
|
|
67
70
|
export const makeIdentityServices = <
|
|
68
71
|
Subject extends AnyPgTable,
|
|
@@ -71,9 +74,8 @@ export const makeIdentityServices = <
|
|
|
71
74
|
Request extends AnyPgTable,
|
|
72
75
|
NativeId,
|
|
73
76
|
>(
|
|
74
|
-
database: EffectPgDatabase<AnyRelations>,
|
|
75
77
|
mapping: IdentityTables<Subject, Identifier, External, Request, NativeId>,
|
|
76
|
-
) => makePgIdentityServices(
|
|
78
|
+
) => makePgIdentityServices(mapping);
|
|
77
79
|
|
|
78
80
|
export {
|
|
79
81
|
makePgSessionStepUpServices as makeSessionStepUpServices,
|
|
@@ -90,7 +92,11 @@ export { passwordPreparedPersistenceLayer } from "./drizzle/password-prepared-ta
|
|
|
90
92
|
import { makeOAuthTarget } from "./drizzle/oauth-drivers";
|
|
91
93
|
import { sqlClientOAuthStandaloneGuard } from "./drizzle/oauth-target";
|
|
92
94
|
|
|
93
|
-
const oauthTarget = makeOAuthTarget<
|
|
95
|
+
const oauthTarget = makeOAuthTarget<
|
|
96
|
+
Database,
|
|
97
|
+
EffectPgDatabase<AnyRelations>,
|
|
98
|
+
AnyPgTable<{ dialect: "pg" }>
|
|
99
|
+
>(Database, {
|
|
94
100
|
mode: "interactive",
|
|
95
101
|
dialect: "pg",
|
|
96
102
|
locking: true,
|
|
@@ -116,9 +122,10 @@ import { makePasskeyTarget } from "./drizzle/passkey-drivers";
|
|
|
116
122
|
import { sqlClientPasskeyStandaloneGuard } from "./drizzle/passkey-target";
|
|
117
123
|
|
|
118
124
|
const passkeyTarget = makePasskeyTarget<
|
|
125
|
+
Database,
|
|
119
126
|
EffectPgDatabase<AnyRelations>,
|
|
120
127
|
AnyPgTable<{ dialect: "pg" }>
|
|
121
|
-
>({
|
|
128
|
+
>(Database, {
|
|
122
129
|
mode: "interactive",
|
|
123
130
|
dialect: "pg",
|
|
124
131
|
locking: true,
|
|
@@ -140,7 +147,11 @@ export const {
|
|
|
140
147
|
|
|
141
148
|
import { makeTotpTarget, sqlClientTotpStandaloneGuard } from "./drizzle/totp-target";
|
|
142
149
|
|
|
143
|
-
const totpTarget = makeTotpTarget<
|
|
150
|
+
const totpTarget = makeTotpTarget<
|
|
151
|
+
Database,
|
|
152
|
+
EffectPgDatabase<AnyRelations>,
|
|
153
|
+
AnyPgTable<{ dialect: "pg" }>
|
|
154
|
+
>(Database, {
|
|
144
155
|
mode: "interactive",
|
|
145
156
|
dialect: "pg",
|
|
146
157
|
locking: true,
|
|
@@ -151,7 +162,11 @@ export const { makeTotpPersistenceServices, coordinateTotpPersistence } = totpTa
|
|
|
151
162
|
|
|
152
163
|
import { makePhoneTarget, sqlClientPhoneStandaloneGuard } from "./drizzle/phone-target";
|
|
153
164
|
|
|
154
|
-
const phoneTarget = makePhoneTarget<
|
|
165
|
+
const phoneTarget = makePhoneTarget<
|
|
166
|
+
Database,
|
|
167
|
+
EffectPgDatabase<AnyRelations>,
|
|
168
|
+
AnyPgTable<{ dialect: "pg" }>
|
|
169
|
+
>(Database, {
|
|
155
170
|
mode: "interactive",
|
|
156
171
|
dialect: "pg",
|
|
157
172
|
locking: true,
|
|
@@ -172,3 +187,6 @@ export const AuthPersistence = {
|
|
|
172
187
|
),
|
|
173
188
|
),
|
|
174
189
|
};
|
|
190
|
+
|
|
191
|
+
/** Construct Drizzle from the driver's SQL-client Layer. */
|
|
192
|
+
export const databaseLayer = Layer.effect(Database, makeWithDefaults({}));
|