@yielded/auth-persistence-drizzle 0.1.0-beta.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.
- package/README.md +17 -0
- package/dist/D1.d.mts +963 -0
- package/dist/D1.mjs +29 -0
- package/dist/D1.mjs.map +1 -0
- package/dist/Libsql.d.mts +2134 -0
- package/dist/Libsql.mjs +77 -0
- package/dist/Libsql.mjs.map +1 -0
- package/dist/Mysql2.d.mts +1817 -0
- package/dist/Mysql2.mjs +55 -0
- package/dist/Mysql2.mjs.map +1 -0
- package/dist/Pglite.d.mts +1821 -0
- package/dist/Pglite.mjs +53 -0
- package/dist/Pglite.mjs.map +1 -0
- package/dist/Postgres.d.mts +1821 -0
- package/dist/Postgres.mjs +53 -0
- package/dist/Postgres.mjs.map +1 -0
- package/dist/SqliteBun.d.mts +2129 -0
- package/dist/SqliteBun.mjs +70 -0
- package/dist/SqliteBun.mjs.map +1 -0
- package/dist/SqliteDo.d.mts +2181 -0
- package/dist/SqliteDo.mjs +105 -0
- package/dist/SqliteDo.mjs.map +1 -0
- package/dist/SqliteNode.d.mts +2129 -0
- package/dist/SqliteNode.mjs +70 -0
- package/dist/SqliteNode.mjs.map +1 -0
- package/dist/SqliteWasm.d.mts +2132 -0
- package/dist/SqliteWasm.mjs +70 -0
- package/dist/SqliteWasm.mjs.map +1 -0
- package/dist/_virtual/_rolldown/runtime.mjs +13 -0
- package/dist/drizzle/D1BatchStatements.d.mts +10 -0
- package/dist/drizzle/D1BatchStatements.mjs +8 -0
- package/dist/drizzle/D1BatchStatements.mjs.map +1 -0
- package/dist/drizzle/SuppliedService.d.mts +9 -0
- package/dist/drizzle/d1-emails.d.mts +61 -0
- package/dist/drizzle/d1-emails.mjs +578 -0
- package/dist/drizzle/d1-emails.mjs.map +1 -0
- package/dist/drizzle/d1-generated-statement.mjs +79 -0
- package/dist/drizzle/d1-generated-statement.mjs.map +1 -0
- package/dist/drizzle/d1-identity.d.mts +30 -0
- package/dist/drizzle/d1-identity.mjs +118 -0
- package/dist/drizzle/d1-identity.mjs.map +1 -0
- package/dist/drizzle/d1-oauth.d.mts +300 -0
- package/dist/drizzle/d1-oauth.mjs +76 -0
- package/dist/drizzle/d1-oauth.mjs.map +1 -0
- package/dist/drizzle/d1-passkey.d.mts +47 -0
- package/dist/drizzle/d1-passkey.mjs +95 -0
- package/dist/drizzle/d1-passkey.mjs.map +1 -0
- package/dist/drizzle/d1-password-prepared.d.mts +24 -0
- package/dist/drizzle/d1-password-prepared.mjs +460 -0
- package/dist/drizzle/d1-password-prepared.mjs.map +1 -0
- package/dist/drizzle/d1-passwords.d.mts +86 -0
- package/dist/drizzle/d1-passwords.mjs +1003 -0
- package/dist/drizzle/d1-passwords.mjs.map +1 -0
- package/dist/drizzle/d1-phone.d.mts +23 -0
- package/dist/drizzle/d1-phone.mjs +30 -0
- package/dist/drizzle/d1-phone.mjs.map +1 -0
- package/dist/drizzle/d1-planning.d.mts +11 -0
- package/dist/drizzle/d1-planning.mjs +43 -0
- package/dist/drizzle/d1-planning.mjs.map +1 -0
- package/dist/drizzle/d1-proofs.d.mts +79 -0
- package/dist/drizzle/d1-proofs.mjs +829 -0
- package/dist/drizzle/d1-proofs.mjs.map +1 -0
- package/dist/drizzle/d1-sessions.d.mts +66 -0
- package/dist/drizzle/d1-sessions.mjs +965 -0
- package/dist/drizzle/d1-sessions.mjs.map +1 -0
- package/dist/drizzle/d1-totp.d.mts +23 -0
- package/dist/drizzle/d1-totp.mjs +27 -0
- package/dist/drizzle/d1-totp.mjs.map +1 -0
- package/dist/drizzle/email-model.d.mts +30 -0
- package/dist/drizzle/email-model.mjs +2 -0
- package/dist/drizzle/email-registration.d.mts +29 -0
- package/dist/drizzle/email-registration.mjs +236 -0
- package/dist/drizzle/email-registration.mjs.map +1 -0
- package/dist/drizzle/email-sql.d.mts +1 -0
- package/dist/drizzle/email-sql.mjs +9 -0
- package/dist/drizzle/email-sql.mjs.map +1 -0
- package/dist/drizzle/email-target.d.mts +19 -0
- package/dist/drizzle/email-target.mjs +72 -0
- package/dist/drizzle/email-target.mjs.map +1 -0
- package/dist/drizzle/model.d.mts +245 -0
- package/dist/drizzle/model.mjs +55 -0
- package/dist/drizzle/model.mjs.map +1 -0
- package/dist/drizzle/mysql-emails.d.mts +70 -0
- package/dist/drizzle/mysql-emails.mjs +38 -0
- package/dist/drizzle/mysql-emails.mjs.map +1 -0
- package/dist/drizzle/mysql-identity.d.mts +21 -0
- package/dist/drizzle/mysql-identity.mjs +93 -0
- package/dist/drizzle/mysql-identity.mjs.map +1 -0
- package/dist/drizzle/mysql-password-prepared.d.mts +29 -0
- package/dist/drizzle/mysql-password-prepared.mjs +16 -0
- package/dist/drizzle/mysql-password-prepared.mjs.map +1 -0
- package/dist/drizzle/mysql-passwords.d.mts +85 -0
- package/dist/drizzle/mysql-passwords.mjs +38 -0
- package/dist/drizzle/mysql-passwords.mjs.map +1 -0
- package/dist/drizzle/mysql-proofs.d.mts +74 -0
- package/dist/drizzle/mysql-proofs.mjs +23 -0
- package/dist/drizzle/mysql-proofs.mjs.map +1 -0
- package/dist/drizzle/mysql-sessions.d.mts +91 -0
- package/dist/drizzle/mysql-sessions.mjs +53 -0
- package/dist/drizzle/mysql-sessions.mjs.map +1 -0
- package/dist/drizzle/mysql.d.mts +69 -0
- package/dist/drizzle/mysql.mjs +218 -0
- package/dist/drizzle/mysql.mjs.map +1 -0
- package/dist/drizzle/oauth-accounts.mjs +358 -0
- package/dist/drizzle/oauth-accounts.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-access.mjs +210 -0
- package/dist/drizzle/oauth-connected-access.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-collection.mjs +202 -0
- package/dist/drizzle/oauth-connected-collection.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-custody.mjs +146 -0
- package/dist/drizzle/oauth-connected-custody.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-drivers.mjs +76 -0
- package/dist/drizzle/oauth-connected-drivers.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-flow.mjs +247 -0
- package/dist/drizzle/oauth-connected-flow.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-input.mjs +103 -0
- package/dist/drizzle/oauth-connected-input.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-maintenance.mjs +214 -0
- package/dist/drizzle/oauth-connected-maintenance.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-management.mjs +228 -0
- package/dist/drizzle/oauth-connected-management.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-model.d.mts +277 -0
- package/dist/drizzle/oauth-connected-model.mjs +22 -0
- package/dist/drizzle/oauth-connected-model.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-reference.d.mts +16 -0
- package/dist/drizzle/oauth-connected-reference.mjs +53 -0
- package/dist/drizzle/oauth-connected-reference.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-settlement.mjs +117 -0
- package/dist/drizzle/oauth-connected-settlement.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-state.d.mts +1954 -0
- package/dist/drizzle/oauth-connected-state.mjs +422 -0
- package/dist/drizzle/oauth-connected-state.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-target.d.mts +752 -0
- package/dist/drizzle/oauth-connected-target.mjs +91 -0
- package/dist/drizzle/oauth-connected-target.mjs.map +1 -0
- package/dist/drizzle/oauth-drivers.mjs +51 -0
- package/dist/drizzle/oauth-drivers.mjs.map +1 -0
- package/dist/drizzle/oauth-flow.d.mts +22 -0
- package/dist/drizzle/oauth-flow.mjs +253 -0
- package/dist/drizzle/oauth-flow.mjs.map +1 -0
- package/dist/drizzle/oauth-input.mjs +127 -0
- package/dist/drizzle/oauth-input.mjs.map +1 -0
- package/dist/drizzle/oauth-model.d.mts +461 -0
- package/dist/drizzle/oauth-model.mjs +49 -0
- package/dist/drizzle/oauth-model.mjs.map +1 -0
- package/dist/drizzle/oauth-mysql.mjs +8 -0
- package/dist/drizzle/oauth-mysql.mjs.map +1 -0
- package/dist/drizzle/oauth-owner.d.mts +10 -0
- package/dist/drizzle/oauth-owner.mjs +10 -0
- package/dist/drizzle/oauth-owner.mjs.map +1 -0
- package/dist/drizzle/oauth-registration.d.mts +5 -0
- package/dist/drizzle/oauth-registration.mjs +374 -0
- package/dist/drizzle/oauth-registration.mjs.map +1 -0
- package/dist/drizzle/oauth-state.mjs +107 -0
- package/dist/drizzle/oauth-state.mjs.map +1 -0
- package/dist/drizzle/oauth-target.d.mts +109 -0
- package/dist/drizzle/oauth-target.mjs +246 -0
- package/dist/drizzle/oauth-target.mjs.map +1 -0
- package/dist/drizzle/passkey-drivers.mjs +34 -0
- package/dist/drizzle/passkey-drivers.mjs.map +1 -0
- package/dist/drizzle/passkey-kernel.mjs +8 -0
- package/dist/drizzle/passkey-kernel.mjs.map +1 -0
- package/dist/drizzle/passkey-model.d.mts +43 -0
- package/dist/drizzle/passkey-model.mjs +8 -0
- package/dist/drizzle/passkey-model.mjs.map +1 -0
- package/dist/drizzle/passkey-registration-ceremony-model.d.mts +12 -0
- package/dist/drizzle/passkey-registration-ceremony-model.mjs +2 -0
- package/dist/drizzle/passkey-state.mjs +7 -0
- package/dist/drizzle/passkey-state.mjs.map +1 -0
- package/dist/drizzle/passkey-target.d.mts +2 -0
- package/dist/drizzle/passkey-target.mjs +7 -0
- package/dist/drizzle/passkey-target.mjs.map +1 -0
- package/dist/drizzle/passkey-write-drivers.mjs +32 -0
- package/dist/drizzle/passkey-write-drivers.mjs.map +1 -0
- package/dist/drizzle/passkey-write-model.d.mts +20 -0
- package/dist/drizzle/passkey-write-model.mjs +9 -0
- package/dist/drizzle/passkey-write-model.mjs.map +1 -0
- package/dist/drizzle/passkey-write-target.d.mts +5 -0
- package/dist/drizzle/passkey-write-target.mjs +7 -0
- package/dist/drizzle/passkey-write-target.mjs.map +1 -0
- package/dist/drizzle/password-model.d.mts +24 -0
- package/dist/drizzle/password-model.mjs +2 -0
- package/dist/drizzle/password-prepared-model.d.mts +92 -0
- package/dist/drizzle/password-prepared-model.mjs +11 -0
- package/dist/drizzle/password-prepared-model.mjs.map +1 -0
- package/dist/drizzle/password-prepared-sql.mjs +389 -0
- package/dist/drizzle/password-prepared-sql.mjs.map +1 -0
- package/dist/drizzle/password-prepared-state.mjs +104 -0
- package/dist/drizzle/password-prepared-state.mjs.map +1 -0
- package/dist/drizzle/password-prepared-target.d.mts +11 -0
- package/dist/drizzle/password-prepared-target.mjs +56 -0
- package/dist/drizzle/password-prepared-target.mjs.map +1 -0
- package/dist/drizzle/password-registration.d.mts +7 -0
- package/dist/drizzle/password-registration.mjs +134 -0
- package/dist/drizzle/password-registration.mjs.map +1 -0
- package/dist/drizzle/password-sql.d.mts +1 -0
- package/dist/drizzle/password-sql.mjs +9 -0
- package/dist/drizzle/password-sql.mjs.map +1 -0
- package/dist/drizzle/password-target.d.mts +16 -0
- package/dist/drizzle/password-target.mjs +61 -0
- package/dist/drizzle/password-target.mjs.map +1 -0
- package/dist/drizzle/pg-emails.d.mts +71 -0
- package/dist/drizzle/pg-emails.mjs +38 -0
- package/dist/drizzle/pg-emails.mjs.map +1 -0
- package/dist/drizzle/pg-password-prepared.d.mts +30 -0
- package/dist/drizzle/pg-password-prepared.mjs +16 -0
- package/dist/drizzle/pg-password-prepared.mjs.map +1 -0
- package/dist/drizzle/pg-passwords.d.mts +86 -0
- package/dist/drizzle/pg-passwords.mjs +38 -0
- package/dist/drizzle/pg-passwords.mjs.map +1 -0
- package/dist/drizzle/pg-proofs.d.mts +75 -0
- package/dist/drizzle/pg-proofs.mjs +22 -0
- package/dist/drizzle/pg-proofs.mjs.map +1 -0
- package/dist/drizzle/pg-sessions.d.mts +92 -0
- package/dist/drizzle/pg-sessions.mjs +53 -0
- package/dist/drizzle/pg-sessions.mjs.map +1 -0
- package/dist/drizzle/pg.d.mts +80 -0
- package/dist/drizzle/pg.mjs +289 -0
- package/dist/drizzle/pg.mjs.map +1 -0
- package/dist/drizzle/phone-model.d.mts +113 -0
- package/dist/drizzle/phone-model.mjs +39 -0
- package/dist/drizzle/phone-model.mjs.map +1 -0
- package/dist/drizzle/phone-state.mjs +14 -0
- package/dist/drizzle/phone-state.mjs.map +1 -0
- package/dist/drizzle/phone-target.d.mts +14 -0
- package/dist/drizzle/phone-target.mjs +168 -0
- package/dist/drizzle/phone-target.mjs.map +1 -0
- package/dist/drizzle/proof-model.d.mts +21 -0
- package/dist/drizzle/proof-model.mjs +2 -0
- package/dist/drizzle/proof-sql.d.mts +1 -0
- package/dist/drizzle/proof-sql.mjs +8 -0
- package/dist/drizzle/proof-sql.mjs.map +1 -0
- package/dist/drizzle/proof-target.d.mts +11 -0
- package/dist/drizzle/proof-target.mjs +36 -0
- package/dist/drizzle/proof-target.mjs.map +1 -0
- package/dist/drizzle/query-operations.mjs +27 -0
- package/dist/drizzle/query-operations.mjs.map +1 -0
- package/dist/drizzle/session-model.d.mts +31 -0
- package/dist/drizzle/session-model.mjs +2 -0
- package/dist/drizzle/session-sql.mjs +8 -0
- package/dist/drizzle/session-sql.mjs.map +1 -0
- package/dist/drizzle/session-target.d.mts +27 -0
- package/dist/drizzle/session-target.mjs +46 -0
- package/dist/drizzle/session-target.mjs.map +1 -0
- package/dist/drizzle/sqlite-emails.mjs +45 -0
- package/dist/drizzle/sqlite-emails.mjs.map +1 -0
- package/dist/drizzle/sqlite-identity.mjs +90 -0
- package/dist/drizzle/sqlite-identity.mjs.map +1 -0
- package/dist/drizzle/sqlite-password-prepared.mjs +21 -0
- package/dist/drizzle/sqlite-password-prepared.mjs.map +1 -0
- package/dist/drizzle/sqlite-passwords.mjs +49 -0
- package/dist/drizzle/sqlite-passwords.mjs.map +1 -0
- package/dist/drizzle/sqlite-proofs.mjs +29 -0
- package/dist/drizzle/sqlite-proofs.mjs.map +1 -0
- package/dist/drizzle/sqlite-sessions.mjs +74 -0
- package/dist/drizzle/sqlite-sessions.mjs.map +1 -0
- package/dist/drizzle/sqlite.d.mts +77 -0
- package/dist/drizzle/sqlite.mjs +217 -0
- package/dist/drizzle/sqlite.mjs.map +1 -0
- package/dist/drizzle/standalone-guard.mjs +17 -0
- package/dist/drizzle/standalone-guard.mjs.map +1 -0
- package/dist/drizzle/step-up-model.d.mts +16 -0
- package/dist/drizzle/step-up-model.mjs +2 -0
- package/dist/drizzle/table-model.d.mts +11 -0
- package/dist/drizzle/totp-model.d.mts +82 -0
- package/dist/drizzle/totp-model.mjs +13 -0
- package/dist/drizzle/totp-model.mjs.map +1 -0
- package/dist/drizzle/totp-state.d.mts +37 -0
- package/dist/drizzle/totp-state.mjs +287 -0
- package/dist/drizzle/totp-state.mjs.map +1 -0
- package/dist/drizzle/totp-target.d.mts +14 -0
- package/dist/drizzle/totp-target.mjs +81 -0
- package/dist/drizzle/totp-target.mjs.map +1 -0
- package/dist/drizzle/transaction-execution.d.mts +2 -0
- package/dist/drizzle/transaction-execution.mjs +11 -0
- package/dist/drizzle/transaction-execution.mjs.map +1 -0
- package/dist/drizzle/transaction-mysql.mjs +47 -0
- package/dist/drizzle/transaction-mysql.mjs.map +1 -0
- package/dist/drizzle/transaction-owner.d.mts +2 -0
- package/dist/drizzle/transaction-owner.mjs +8 -0
- package/dist/drizzle/transaction-owner.mjs.map +1 -0
- package/dist/index.d.mts +27 -0
- package/dist/index.mjs +27 -0
- package/dist/internal/drizzle-migrations.mjs +19 -0
- package/dist/internal/drizzle-migrations.mjs.map +1 -0
- package/dist/internal/drizzle-postgres.mjs +37 -0
- package/dist/internal/drizzle-postgres.mjs.map +1 -0
- package/dist/internal/drizzle-sqlite.mjs +35 -0
- package/dist/internal/drizzle-sqlite.mjs.map +1 -0
- package/package.json +1 -0
- package/src/D1.ts +136 -0
- package/src/Libsql.ts +257 -0
- package/src/Mysql2.ts +184 -0
- package/src/Pglite.ts +174 -0
- package/src/Postgres.ts +174 -0
- package/src/SqliteBun.ts +258 -0
- package/src/SqliteDo.ts +473 -0
- package/src/SqliteNode.ts +259 -0
- package/src/SqliteWasm.ts +263 -0
- package/src/drizzle/D1BatchStatements.ts +10 -0
- package/src/drizzle/SuppliedService.ts +10 -0
- package/src/drizzle/d1-emails.ts +1829 -0
- package/src/drizzle/d1-generated-statement.ts +129 -0
- package/src/drizzle/d1-identity.ts +375 -0
- package/src/drizzle/d1-oauth.ts +340 -0
- package/src/drizzle/d1-passkey.ts +373 -0
- package/src/drizzle/d1-password-prepared.ts +1270 -0
- package/src/drizzle/d1-passwords.ts +2656 -0
- package/src/drizzle/d1-phone.ts +96 -0
- package/src/drizzle/d1-planning.ts +104 -0
- package/src/drizzle/d1-proofs.ts +2305 -0
- package/src/drizzle/d1-sessions.ts +2857 -0
- package/src/drizzle/d1-totp.ts +78 -0
- package/src/drizzle/email-model.ts +202 -0
- package/src/drizzle/email-registration.ts +698 -0
- package/src/drizzle/email-sql.ts +25 -0
- package/src/drizzle/email-target.ts +243 -0
- package/src/drizzle/model.ts +459 -0
- package/src/drizzle/mysql-emails.ts +321 -0
- package/src/drizzle/mysql-identity.ts +324 -0
- package/src/drizzle/mysql-password-prepared.ts +204 -0
- package/src/drizzle/mysql-passwords.ts +339 -0
- package/src/drizzle/mysql-proofs.ts +181 -0
- package/src/drizzle/mysql-sessions.ts +741 -0
- package/src/drizzle/mysql.ts +687 -0
- package/src/drizzle/oauth-accounts.ts +804 -0
- package/src/drizzle/oauth-connected-access.ts +354 -0
- package/src/drizzle/oauth-connected-collection.ts +324 -0
- package/src/drizzle/oauth-connected-custody.ts +277 -0
- package/src/drizzle/oauth-connected-drivers.ts +465 -0
- package/src/drizzle/oauth-connected-flow.ts +441 -0
- package/src/drizzle/oauth-connected-input.ts +127 -0
- package/src/drizzle/oauth-connected-maintenance.ts +345 -0
- package/src/drizzle/oauth-connected-management.ts +365 -0
- package/src/drizzle/oauth-connected-model.ts +347 -0
- package/src/drizzle/oauth-connected-reference.ts +112 -0
- package/src/drizzle/oauth-connected-settlement.ts +226 -0
- package/src/drizzle/oauth-connected-state.ts +845 -0
- package/src/drizzle/oauth-connected-target.ts +264 -0
- package/src/drizzle/oauth-drivers.ts +569 -0
- package/src/drizzle/oauth-flow.ts +462 -0
- package/src/drizzle/oauth-input.ts +201 -0
- package/src/drizzle/oauth-model.ts +617 -0
- package/src/drizzle/oauth-mysql.ts +10 -0
- package/src/drizzle/oauth-owner.ts +29 -0
- package/src/drizzle/oauth-registration.ts +640 -0
- package/src/drizzle/oauth-state.ts +215 -0
- package/src/drizzle/oauth-target.ts +750 -0
- package/src/drizzle/passkey-drivers.ts +385 -0
- package/src/drizzle/passkey-kernel.ts +4 -0
- package/src/drizzle/passkey-model.ts +153 -0
- package/src/drizzle/passkey-registration-ceremony-model.ts +32 -0
- package/src/drizzle/passkey-state.ts +3 -0
- package/src/drizzle/passkey-target.ts +23 -0
- package/src/drizzle/passkey-write-drivers.ts +395 -0
- package/src/drizzle/passkey-write-model.ts +103 -0
- package/src/drizzle/passkey-write-target.ts +9 -0
- package/src/drizzle/password-model.ts +169 -0
- package/src/drizzle/password-prepared-model.ts +259 -0
- package/src/drizzle/password-prepared-sql.ts +1191 -0
- package/src/drizzle/password-prepared-state.ts +231 -0
- package/src/drizzle/password-prepared-target.ts +160 -0
- package/src/drizzle/password-registration.ts +363 -0
- package/src/drizzle/password-sql.ts +13 -0
- package/src/drizzle/password-target.ts +224 -0
- package/src/drizzle/pg-emails.ts +321 -0
- package/src/drizzle/pg-password-prepared.ts +205 -0
- package/src/drizzle/pg-passwords.ts +338 -0
- package/src/drizzle/pg-proofs.ts +191 -0
- package/src/drizzle/pg-sessions.ts +750 -0
- package/src/drizzle/pg.ts +984 -0
- package/src/drizzle/phone-model.ts +190 -0
- package/src/drizzle/phone-state.ts +21 -0
- package/src/drizzle/phone-target.ts +472 -0
- package/src/drizzle/proof-model.ts +139 -0
- package/src/drizzle/proof-sql.ts +10 -0
- package/src/drizzle/proof-target.ts +122 -0
- package/src/drizzle/query-operations.ts +43 -0
- package/src/drizzle/session-model.ts +215 -0
- package/src/drizzle/session-sql.ts +14 -0
- package/src/drizzle/session-target.ts +338 -0
- package/src/drizzle/sqlite-emails.ts +366 -0
- package/src/drizzle/sqlite-identity.ts +344 -0
- package/src/drizzle/sqlite-password-prepared.ts +260 -0
- package/src/drizzle/sqlite-passwords.ts +497 -0
- package/src/drizzle/sqlite-proofs.ts +202 -0
- package/src/drizzle/sqlite-sessions.ts +971 -0
- package/src/drizzle/sqlite.ts +705 -0
- package/src/drizzle/standalone-guard.ts +32 -0
- package/src/drizzle/step-up-model.ts +73 -0
- package/src/drizzle/table-model.ts +9 -0
- package/src/drizzle/totp-model.ts +92 -0
- package/src/drizzle/totp-state.ts +525 -0
- package/src/drizzle/totp-target.ts +308 -0
- package/src/drizzle/transaction-execution.ts +13 -0
- package/src/drizzle/transaction-mysql.ts +106 -0
- package/src/drizzle/transaction-owner.ts +11 -0
- package/src/index.ts +378 -0
- package/src/internal/drizzle-migrations.ts +29 -0
- package/src/internal/drizzle-postgres.ts +83 -0
- package/src/internal/drizzle-sqlite.ts +81 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
export {
|
|
2
|
+
type AnyEmailAddressMapping,
|
|
3
|
+
type AnyEmailRegistrationMapping,
|
|
4
|
+
type AnyEmailSignInMapping,
|
|
5
|
+
type D1EmailAddressMapping,
|
|
6
|
+
type D1EmailRegistrationMapping,
|
|
7
|
+
type EmailAddressMapping,
|
|
8
|
+
type EmailAuthorityCredentialTable,
|
|
9
|
+
type EmailCommandTable,
|
|
10
|
+
type EmailCredentialReadTable,
|
|
11
|
+
type EmailCredentialTable,
|
|
12
|
+
type EmailD1Clock,
|
|
13
|
+
type EmailIdentifierReadTable,
|
|
14
|
+
type EmailIdentifierTable,
|
|
15
|
+
type EmailRegistrationAuthorityCredentialTable,
|
|
16
|
+
type EmailRegistrationCredentialTable,
|
|
17
|
+
type EmailRegistrationIdentifierTable,
|
|
18
|
+
type EmailRegistrationIntent,
|
|
19
|
+
type EmailRegistrationMapping,
|
|
20
|
+
type EmailRegistrationProvisioning,
|
|
21
|
+
type EmailRegistrationState,
|
|
22
|
+
type EmailRegistrationTable,
|
|
23
|
+
type EmailSignInMapping,
|
|
24
|
+
type EmailSubjectReadTable,
|
|
25
|
+
type EmailSubjectTable,
|
|
26
|
+
type RequiredEmailAddressConstraints,
|
|
27
|
+
type RequiredEmailRegistrationConstraints,
|
|
28
|
+
type RequiredEmailSignInConstraints,
|
|
29
|
+
requiredEmailAddressConstraints,
|
|
30
|
+
requiredEmailRegistrationConstraints,
|
|
31
|
+
requiredEmailSignInConstraints,
|
|
32
|
+
} from "./drizzle/email-model";
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
type AnyPasswordPersistenceMapping,
|
|
36
|
+
type AnyPasswordRegistrationMapping,
|
|
37
|
+
type D1PasswordPersistenceMapping,
|
|
38
|
+
type PasswordAttemptAction,
|
|
39
|
+
type PasswordAttemptRecord,
|
|
40
|
+
type PasswordAttemptState,
|
|
41
|
+
type PasswordAttemptTable,
|
|
42
|
+
type PasswordAuthorityCredentialTable,
|
|
43
|
+
type PasswordChargeTable,
|
|
44
|
+
type PasswordCommandTable,
|
|
45
|
+
type PasswordConstraintClassifier,
|
|
46
|
+
type PasswordCredentialTable,
|
|
47
|
+
type PasswordD1Clock,
|
|
48
|
+
type PasswordIdentifierTable,
|
|
49
|
+
type PasswordPersistenceMapping,
|
|
50
|
+
type PasswordRateScopeKind,
|
|
51
|
+
type PasswordRateScopeTable,
|
|
52
|
+
type PasswordRegistrationConstraintClassifier,
|
|
53
|
+
type PasswordRegistrationIntent,
|
|
54
|
+
type PasswordRegistrationMapping,
|
|
55
|
+
type PasswordRegistrationProvisioning,
|
|
56
|
+
type PasswordRegistrationState,
|
|
57
|
+
type PasswordRegistrationTable,
|
|
58
|
+
type PasswordScopeKeys,
|
|
59
|
+
type PasswordSubjectTable,
|
|
60
|
+
type RequiredPasswordConstraints,
|
|
61
|
+
type RequiredPasswordRegistrationConstraints,
|
|
62
|
+
requiredPasswordConstraints,
|
|
63
|
+
requiredPasswordRegistrationConstraints,
|
|
64
|
+
} from "./drizzle/password-model";
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
type AnyPasswordPreparedPersistenceMapping,
|
|
68
|
+
type D1PasswordPreparedPersistenceMapping,
|
|
69
|
+
type D1PasswordPreparedProofMapping,
|
|
70
|
+
type PasswordPreparedAdmissionTable,
|
|
71
|
+
type PasswordPreparedIntentTable,
|
|
72
|
+
type PasswordPreparedPersistenceMapping,
|
|
73
|
+
type PasswordPreparedProofMapping,
|
|
74
|
+
type PasswordPreparedState,
|
|
75
|
+
type RequiredPasswordPreparedConstraints,
|
|
76
|
+
requiredPasswordPreparedConstraints,
|
|
77
|
+
} from "./drizzle/password-prepared-model";
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
type AnyProofPersistenceMapping,
|
|
81
|
+
type D1ProofPersistenceMapping,
|
|
82
|
+
type ProofAbuseEventTable,
|
|
83
|
+
type ProofAction,
|
|
84
|
+
type ProofAuthorityInput,
|
|
85
|
+
type ProofAuthorityTables,
|
|
86
|
+
type ProofCommandDecision,
|
|
87
|
+
type ProofCommandKind,
|
|
88
|
+
type ProofCommandTable,
|
|
89
|
+
type ProofConstraintClassifier,
|
|
90
|
+
type ProofContinuationRecord,
|
|
91
|
+
type ProofContinuationTable,
|
|
92
|
+
type ProofD1Clock,
|
|
93
|
+
type ProofDeliveryState,
|
|
94
|
+
type ProofFailureEventTable,
|
|
95
|
+
type ProofGenerationState,
|
|
96
|
+
type ProofGenerationTable,
|
|
97
|
+
type ProofPersistenceMapping,
|
|
98
|
+
type ProofRateScopeTable,
|
|
99
|
+
type ProofRequestTable,
|
|
100
|
+
type ProofScopeKeys,
|
|
101
|
+
type ProofScopeKind,
|
|
102
|
+
type ProofSeriesTable,
|
|
103
|
+
type RequiredProofConstraints,
|
|
104
|
+
requiredProofConstraints,
|
|
105
|
+
} from "./drizzle/proof-model";
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
type AuthStoreTables,
|
|
109
|
+
type AuthTables,
|
|
110
|
+
type ChallengeColumns,
|
|
111
|
+
type ChallengeConsumeDecision,
|
|
112
|
+
type ChallengeInput,
|
|
113
|
+
type ChallengeRecord,
|
|
114
|
+
type ChallengeTableMapping,
|
|
115
|
+
type CommitMode,
|
|
116
|
+
type ConsumeDecision,
|
|
117
|
+
type D1ExternalIdentityMapping,
|
|
118
|
+
type D1GeneratedIdentityMapping,
|
|
119
|
+
type D1SubjectProvisioningMapping,
|
|
120
|
+
PersistenceMappingError,
|
|
121
|
+
type ExternalIdentityTables,
|
|
122
|
+
type IdentityTables,
|
|
123
|
+
type InstantCodec,
|
|
124
|
+
type OAuthStateColumns,
|
|
125
|
+
type OAuthStateTableMapping,
|
|
126
|
+
type OAuthStateTables,
|
|
127
|
+
type RegistrationColumns,
|
|
128
|
+
type RegistrationRecord,
|
|
129
|
+
type RegistrationTableMapping,
|
|
130
|
+
type RequiredAuthConstraints,
|
|
131
|
+
type RequiredAuthStoreConstraints,
|
|
132
|
+
type RequiredExternalIdentityConstraints,
|
|
133
|
+
type RequiredIdentityConstraints,
|
|
134
|
+
type RequiredOAuthStateConstraints,
|
|
135
|
+
type RequiredSubjectProvisioningConstraints,
|
|
136
|
+
type SubjectIdCodec,
|
|
137
|
+
type SubjectProvisioningTables,
|
|
138
|
+
authServicesLayer,
|
|
139
|
+
column,
|
|
140
|
+
identityServicesLayer,
|
|
141
|
+
isMappedConstraintConflict,
|
|
142
|
+
provisioningFingerprint,
|
|
143
|
+
requireStandaloneConsume,
|
|
144
|
+
requiredAuthConstraints,
|
|
145
|
+
requiredAuthStoreConstraints,
|
|
146
|
+
requiredExternalIdentityConstraints,
|
|
147
|
+
requiredIdentityConstraints,
|
|
148
|
+
requiredOAuthStateConstraints,
|
|
149
|
+
requiredSubjectProvisioningConstraints,
|
|
150
|
+
updateValues,
|
|
151
|
+
} from "./drizzle/model";
|
|
152
|
+
|
|
153
|
+
export {
|
|
154
|
+
type AuthenticationAuthorityMapping,
|
|
155
|
+
type D1AuthenticationAuthorityMapping,
|
|
156
|
+
type D1PendingAuthenticationMapping,
|
|
157
|
+
type D1SessionClockMapping,
|
|
158
|
+
type D1SignedSessionValidityMapping,
|
|
159
|
+
type D1StatefulSessionMapping,
|
|
160
|
+
type PendingAuthenticationMapping,
|
|
161
|
+
type PendingAuthenticationTables,
|
|
162
|
+
type RequiredPendingAuthenticationConstraints,
|
|
163
|
+
type RequiredSessionConstraints,
|
|
164
|
+
type RequiredSignedValidityConstraints,
|
|
165
|
+
type RequiredStatefulPendingConstraints,
|
|
166
|
+
type SessionAuthorityTables,
|
|
167
|
+
type SessionConstraintClassifier,
|
|
168
|
+
type SessionFlowTables,
|
|
169
|
+
type SessionIdCodec,
|
|
170
|
+
type SessionSubjectTables,
|
|
171
|
+
type SignedSessionValidityMapping,
|
|
172
|
+
type SignedSessionValidityTables,
|
|
173
|
+
type StatefulSessionMapping,
|
|
174
|
+
type StatefulSessionTables,
|
|
175
|
+
requiredPendingAuthenticationConstraints,
|
|
176
|
+
requiredSessionConstraints,
|
|
177
|
+
requiredSignedValidityConstraints,
|
|
178
|
+
requiredStatefulPendingConstraints,
|
|
179
|
+
} from "./drizzle/session-model";
|
|
180
|
+
|
|
181
|
+
export {
|
|
182
|
+
type D1PasskeyMapping,
|
|
183
|
+
type PasskeyAdmissionTable,
|
|
184
|
+
type PasskeyCeremonyMapping,
|
|
185
|
+
type PasskeyChargeInsert,
|
|
186
|
+
type PasskeyChargeKind,
|
|
187
|
+
type PasskeyChargeTable,
|
|
188
|
+
type PasskeyClock,
|
|
189
|
+
type PasskeyColumn,
|
|
190
|
+
type PasskeyCredentialMapping,
|
|
191
|
+
type PasskeyCredentialOwnershipTable,
|
|
192
|
+
type PasskeyCredentialReadTable,
|
|
193
|
+
type PasskeyCredentialServices,
|
|
194
|
+
type PasskeyEnrollmentContextMapping,
|
|
195
|
+
type PasskeyEnrollmentContextServices,
|
|
196
|
+
type PasskeyFactorReadTable,
|
|
197
|
+
type PasskeyFlowInsert,
|
|
198
|
+
type PasskeyFlowState,
|
|
199
|
+
type PasskeyFlowTable,
|
|
200
|
+
type PasskeyHandleOwnershipTable,
|
|
201
|
+
type PasskeyHandleReadTable,
|
|
202
|
+
type PasskeyHandleReservationTable,
|
|
203
|
+
type PasskeyMappingSource,
|
|
204
|
+
type PasskeyModuleTable,
|
|
205
|
+
type PasskeyPersistenceMapping,
|
|
206
|
+
type PasskeyPersistenceServices,
|
|
207
|
+
type PasskeyPolicyGuard,
|
|
208
|
+
type PasskeySubjectIdCodec,
|
|
209
|
+
type PasskeySubjectReadTable,
|
|
210
|
+
passkeyCredentialsLayer,
|
|
211
|
+
passkeyEnrollmentContextLayer,
|
|
212
|
+
passkeyPersistenceLayer,
|
|
213
|
+
passkeyPolicyGuard,
|
|
214
|
+
requiredPasskeyCredentialConstraints,
|
|
215
|
+
requiredPasskeyPersistenceConstraints,
|
|
216
|
+
} from "./drizzle/passkey-model";
|
|
217
|
+
|
|
218
|
+
export {
|
|
219
|
+
type D1SessionStepUpMapping,
|
|
220
|
+
type RequiredSessionStepUpConstraints,
|
|
221
|
+
type SessionStepUpIntentTables,
|
|
222
|
+
type SessionStepUpMapping,
|
|
223
|
+
type SessionStepUpSourceTables,
|
|
224
|
+
requiredSessionStepUpConstraints,
|
|
225
|
+
} from "./drizzle/step-up-model";
|
|
226
|
+
|
|
227
|
+
export {
|
|
228
|
+
type OAuthAccountsMapping,
|
|
229
|
+
type OAuthAction,
|
|
230
|
+
type OAuthAuthorityReadTable,
|
|
231
|
+
type OAuthAuthorityTable,
|
|
232
|
+
type OAuthCleanupDescriptor,
|
|
233
|
+
type OAuthCleanupTable,
|
|
234
|
+
type OAuthClock,
|
|
235
|
+
type OAuthCredentialReadTable,
|
|
236
|
+
type OAuthCredentialTable,
|
|
237
|
+
type OAuthD1Mapping,
|
|
238
|
+
type OAuthEligibilityDescriptor,
|
|
239
|
+
type OAuthEligibilityFact,
|
|
240
|
+
type OAuthEligibilityTable,
|
|
241
|
+
type OAuthFlowState,
|
|
242
|
+
type OAuthFlowTable,
|
|
243
|
+
type OAuthMetadataPolicy,
|
|
244
|
+
type OAuthOwnershipMutation,
|
|
245
|
+
type OAuthOwnershipReadTable,
|
|
246
|
+
type OAuthOwnershipTable,
|
|
247
|
+
type OAuthReferenceGuardDescriptor,
|
|
248
|
+
type OAuthReferenceGuardTable,
|
|
249
|
+
type OAuthRegistrationAuthority,
|
|
250
|
+
type OAuthRegistrationBase,
|
|
251
|
+
type OAuthRegistrationCommandTable,
|
|
252
|
+
type OAuthRegistrationEligibility,
|
|
253
|
+
type OAuthRegistrationGuardDescriptor,
|
|
254
|
+
type OAuthRegistrationGuardTable,
|
|
255
|
+
type OAuthRegistrationIntentMapping,
|
|
256
|
+
type OAuthRegistrationIntentTable,
|
|
257
|
+
type OAuthRegistrationMapping,
|
|
258
|
+
type OAuthRegistrationState,
|
|
259
|
+
type OAuthSignInMapping,
|
|
260
|
+
type OAuthSubjectReadTable,
|
|
261
|
+
type OAuthSubjectTable,
|
|
262
|
+
type OAuthTupleAuthorityTable,
|
|
263
|
+
type OAuthTupleState,
|
|
264
|
+
type OAuthUnlinkCommandTable,
|
|
265
|
+
oauthCleanupTable,
|
|
266
|
+
oauthEligibilityTable,
|
|
267
|
+
oauthReferenceGuardTable,
|
|
268
|
+
oauthRegistrationGuardTable,
|
|
269
|
+
requiredOAuthAccountsConstraints,
|
|
270
|
+
requiredOAuthRegistrationConstraints,
|
|
271
|
+
requiredOAuthSignInConstraints,
|
|
272
|
+
requiredOAuthTupleConstraints,
|
|
273
|
+
} from "./drizzle/oauth-model";
|
|
274
|
+
|
|
275
|
+
export {
|
|
276
|
+
type OAuthConnectedAction,
|
|
277
|
+
type OAuthConnectedAdmissionTable,
|
|
278
|
+
type OAuthConnectedAuthorityMapping,
|
|
279
|
+
type OAuthConnectedClientRegistrationTable,
|
|
280
|
+
type OAuthConnectedCohortTable,
|
|
281
|
+
type OAuthConnectedCommandTable,
|
|
282
|
+
type OAuthConnectedFlowTable,
|
|
283
|
+
type OAuthConnectedGrantTable,
|
|
284
|
+
type OAuthConnectedMapping,
|
|
285
|
+
type OAuthConnectedOrderCodec,
|
|
286
|
+
type OAuthConnectedOwnershipRead,
|
|
287
|
+
type OAuthConnectedPolicyGuard,
|
|
288
|
+
type OAuthConnectedPolicyGuardTable,
|
|
289
|
+
type OAuthConnectedPolicyInput,
|
|
290
|
+
type OAuthConnectedRevocationJobTable,
|
|
291
|
+
type OAuthConnectedRevocationMapping,
|
|
292
|
+
type OAuthConnectedSqlPolicy,
|
|
293
|
+
type OAuthConnectedSubjectTable,
|
|
294
|
+
oauthConnectedPolicyGuard,
|
|
295
|
+
requiredOAuthConnectedConstraints,
|
|
296
|
+
requiredOAuthConnectedRevocationConstraints,
|
|
297
|
+
} from "./drizzle/oauth-connected-model";
|
|
298
|
+
|
|
299
|
+
export {
|
|
300
|
+
type PasskeyRegistrationCeremonyCapabilities,
|
|
301
|
+
type PasskeyRegistrationCeremonyMapping,
|
|
302
|
+
type PasskeyRegistrationCeremonyServices,
|
|
303
|
+
type PasskeyRegistrationIntentReadTable,
|
|
304
|
+
requiredPasskeyRegistrationCeremonyConstraints,
|
|
305
|
+
} from "./drizzle/passkey-registration-ceremony-model";
|
|
306
|
+
|
|
307
|
+
export {
|
|
308
|
+
authenticationAuthorityLayer,
|
|
309
|
+
pendingAuthenticationLayer,
|
|
310
|
+
signedSessionValidityLayer,
|
|
311
|
+
statefulSessionLayers,
|
|
312
|
+
} from "./drizzle/session-target";
|
|
313
|
+
|
|
314
|
+
export {
|
|
315
|
+
emailAddressPersistenceLayer,
|
|
316
|
+
emailRegistrationLayer,
|
|
317
|
+
emailSignInTargetsLayer,
|
|
318
|
+
} from "./drizzle/email-target";
|
|
319
|
+
|
|
320
|
+
export {
|
|
321
|
+
oauthAccountsPersistenceLayer,
|
|
322
|
+
oauthRegistrationAuthorityLayer,
|
|
323
|
+
oauthRegistrationIntentsLayer,
|
|
324
|
+
oauthSignInPersistenceLayer,
|
|
325
|
+
} from "./drizzle/oauth-target";
|
|
326
|
+
|
|
327
|
+
export { oauthConnectedOwnershipReferences } from "./drizzle/oauth-connected-reference";
|
|
328
|
+
|
|
329
|
+
export {
|
|
330
|
+
oauthConnectedPersistenceLayer,
|
|
331
|
+
oauthConnectedRevocationsLayer,
|
|
332
|
+
} from "./drizzle/oauth-connected-target";
|
|
333
|
+
|
|
334
|
+
export { passwordPersistenceLayer, passwordRegistrationLayer } from "./drizzle/password-target";
|
|
335
|
+
export { passwordPreparedPersistenceLayer } from "./drizzle/password-prepared-target";
|
|
336
|
+
export { proofPersistenceLayer } from "./drizzle/proof-target";
|
|
337
|
+
export { AuthStoreDecisions } from "@yielded/auth/Persistence";
|
|
338
|
+
|
|
339
|
+
export {
|
|
340
|
+
type TotpMapping,
|
|
341
|
+
type TotpMappingSource,
|
|
342
|
+
type D1TotpMapping,
|
|
343
|
+
type TotpPersistenceServices,
|
|
344
|
+
requiredTotpConstraints,
|
|
345
|
+
totpPersistenceLayer,
|
|
346
|
+
} from "./drizzle/totp-model";
|
|
347
|
+
|
|
348
|
+
export { encodeTotpRecord, decodeTotpRecord } from "./drizzle/totp-state";
|
|
349
|
+
export { OAuthStateDecisions } from "@yielded/auth/OAuth";
|
|
350
|
+
|
|
351
|
+
export {
|
|
352
|
+
type PasskeyCredentialInsert,
|
|
353
|
+
type PasskeyWriteTables,
|
|
354
|
+
type PasskeyInvalidationInput,
|
|
355
|
+
type PasskeyInvalidationMutation,
|
|
356
|
+
passkeyInvalidationMutation,
|
|
357
|
+
type PasskeyCommandTable,
|
|
358
|
+
type PasskeyManagementMapping,
|
|
359
|
+
requiredPasskeyManagementConstraints,
|
|
360
|
+
type PasskeyManagementServices,
|
|
361
|
+
type PasskeyRegistrationWriter,
|
|
362
|
+
type PasskeyRegistrationServices,
|
|
363
|
+
type PasskeyRegistrationMapping,
|
|
364
|
+
requiredPasskeyRegistrationWriteConstraints,
|
|
365
|
+
} from "./drizzle/passkey-write-model";
|
|
366
|
+
|
|
367
|
+
export { passkeyManagementPersistenceLayer } from "./drizzle/passkey-write-target";
|
|
368
|
+
|
|
369
|
+
export {
|
|
370
|
+
type PhoneMapping,
|
|
371
|
+
type PhoneMappingSource,
|
|
372
|
+
type D1PhoneMapping,
|
|
373
|
+
type PhonePersistenceServices,
|
|
374
|
+
type PhoneProofCompletionMapping,
|
|
375
|
+
phoneProofCompletionMapping,
|
|
376
|
+
requiredPhoneConstraints,
|
|
377
|
+
phonePersistenceLayer,
|
|
378
|
+
} from "./drizzle/phone-model";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PersistenceConfigurationError } from "@yielded/auth-persistence/Adapter";
|
|
2
|
+
import { Effect, Layer } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Run Drizzle Kit output through the matching Drizzle driver. Loading files and
|
|
5
|
+
* acquiring the database are deferred until the Layer is built. Drizzle owns the
|
|
6
|
+
* migration journal and transaction; failed migrations prevent auth startup.
|
|
7
|
+
*/
|
|
8
|
+
export const drizzleMigrationsLayer =
|
|
9
|
+
<Database, Options, E, R>(
|
|
10
|
+
acquire: Effect.Effect<Database, never, R>,
|
|
11
|
+
migrator: Effect.Effect<(database: Database, options: Options) => Effect.Effect<void, E>>,
|
|
12
|
+
) =>
|
|
13
|
+
(options: Options) =>
|
|
14
|
+
Layer.effectDiscard(
|
|
15
|
+
Effect.gen(function* () {
|
|
16
|
+
const database = yield* acquire;
|
|
17
|
+
const migrate = yield* migrator;
|
|
18
|
+
|
|
19
|
+
const migration = yield* Effect.try({
|
|
20
|
+
try: () => migrate(database, options),
|
|
21
|
+
catch: () =>
|
|
22
|
+
PersistenceConfigurationError.make({
|
|
23
|
+
reason: "Could not read Drizzle migrations; check the migration source and format",
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
yield* migration;
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PersistenceConfigurationError,
|
|
3
|
+
makeComposedPasskeys,
|
|
4
|
+
createPersistence,
|
|
5
|
+
} from "@yielded/auth-persistence/Adapter";
|
|
6
|
+
import type { StorageTable } from "@yielded/auth-persistence/Adapter";
|
|
7
|
+
import { getTableColumns } from "drizzle-orm";
|
|
8
|
+
import {
|
|
9
|
+
getTableConfig,
|
|
10
|
+
bigint,
|
|
11
|
+
boolean,
|
|
12
|
+
pgTable,
|
|
13
|
+
text,
|
|
14
|
+
uniqueIndex,
|
|
15
|
+
type PgTable,
|
|
16
|
+
} from "drizzle-orm/pg-core";
|
|
17
|
+
import type { Effect } from "effect";
|
|
18
|
+
import type { SqlClient } from "effect/unstable/sql/SqlClient";
|
|
19
|
+
|
|
20
|
+
import { drizzleQueryOperations } from "../drizzle/query-operations";
|
|
21
|
+
|
|
22
|
+
const makeTable = (definition: StorageTable) =>
|
|
23
|
+
pgTable(
|
|
24
|
+
definition.name,
|
|
25
|
+
Object.fromEntries(
|
|
26
|
+
Object.entries(definition.columns).map(([key, column]) => {
|
|
27
|
+
const builder =
|
|
28
|
+
column.type === "text"
|
|
29
|
+
? text(column.name)
|
|
30
|
+
: column.type === "boolean"
|
|
31
|
+
? boolean(column.name)
|
|
32
|
+
: bigint(column.name, { mode: "number" });
|
|
33
|
+
|
|
34
|
+
return [key, column.nullable ? builder : builder.notNull()];
|
|
35
|
+
}),
|
|
36
|
+
),
|
|
37
|
+
(columns) =>
|
|
38
|
+
definition.unique.map((keys, i) => {
|
|
39
|
+
const [first, ...rest] = keys;
|
|
40
|
+
|
|
41
|
+
if (first === undefined)
|
|
42
|
+
throw PersistenceConfigurationError.make({ reason: "An empty unique key is invalid" });
|
|
43
|
+
|
|
44
|
+
return uniqueIndex(`${definition.name}_key_${i}`).on(
|
|
45
|
+
columns[first],
|
|
46
|
+
...rest.map((key) => columns[key]),
|
|
47
|
+
);
|
|
48
|
+
}),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const describe = (table: PgTable): StorageTable => {
|
|
52
|
+
const config = getTableConfig(table);
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
name: config.name,
|
|
56
|
+
...(config.schema === undefined ? {} : { schema: config.schema }),
|
|
57
|
+
columns: Object.fromEntries(
|
|
58
|
+
Object.entries(getTableColumns(table)).map(([key, column]) => [
|
|
59
|
+
key,
|
|
60
|
+
{
|
|
61
|
+
name: column.name,
|
|
62
|
+
type:
|
|
63
|
+
column.dataType === "boolean"
|
|
64
|
+
? "boolean"
|
|
65
|
+
: column.dataType === "number"
|
|
66
|
+
? "integer"
|
|
67
|
+
: "text",
|
|
68
|
+
nullable: !column.notNull,
|
|
69
|
+
},
|
|
70
|
+
]),
|
|
71
|
+
),
|
|
72
|
+
unique: [],
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const postgresPersistence = <R>(acquire: Effect.Effect<object, never, R | SqlClient>) =>
|
|
77
|
+
createPersistence<PgTable, R>({
|
|
78
|
+
makeTable,
|
|
79
|
+
describe,
|
|
80
|
+
operations: drizzleQueryOperations,
|
|
81
|
+
acquire,
|
|
82
|
+
passkeys: makeComposedPasskeys(drizzleQueryOperations),
|
|
83
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PersistenceConfigurationError,
|
|
3
|
+
makeComposedPasskeys,
|
|
4
|
+
createPersistence,
|
|
5
|
+
} from "@yielded/auth-persistence/Adapter";
|
|
6
|
+
import type { StorageTable } from "@yielded/auth-persistence/Adapter";
|
|
7
|
+
import { getTableColumns } from "drizzle-orm";
|
|
8
|
+
import {
|
|
9
|
+
getTableConfig,
|
|
10
|
+
integer,
|
|
11
|
+
sqliteTable,
|
|
12
|
+
text,
|
|
13
|
+
uniqueIndex,
|
|
14
|
+
type SQLiteTable,
|
|
15
|
+
} from "drizzle-orm/sqlite-core";
|
|
16
|
+
import type { Effect } from "effect";
|
|
17
|
+
import type { SqlClient } from "effect/unstable/sql/SqlClient";
|
|
18
|
+
|
|
19
|
+
import { drizzleQueryOperations } from "../drizzle/query-operations";
|
|
20
|
+
|
|
21
|
+
const makeTable = (definition: StorageTable) =>
|
|
22
|
+
sqliteTable(
|
|
23
|
+
definition.name,
|
|
24
|
+
Object.fromEntries(
|
|
25
|
+
Object.entries(definition.columns).map(([key, column]) => {
|
|
26
|
+
const builder =
|
|
27
|
+
column.type === "text"
|
|
28
|
+
? text(column.name)
|
|
29
|
+
: column.type === "boolean"
|
|
30
|
+
? integer(column.name, { mode: "boolean" })
|
|
31
|
+
: integer(column.name);
|
|
32
|
+
|
|
33
|
+
return [key, column.nullable ? builder : builder.notNull()];
|
|
34
|
+
}),
|
|
35
|
+
),
|
|
36
|
+
(columns) =>
|
|
37
|
+
definition.unique.map((keys, i) => {
|
|
38
|
+
const [first, ...rest] = keys;
|
|
39
|
+
|
|
40
|
+
if (first === undefined)
|
|
41
|
+
throw PersistenceConfigurationError.make({ reason: "An empty unique key is invalid" });
|
|
42
|
+
|
|
43
|
+
return uniqueIndex(`${definition.name}_key_${i}`).on(
|
|
44
|
+
columns[first],
|
|
45
|
+
...rest.map((key) => columns[key]),
|
|
46
|
+
);
|
|
47
|
+
}),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const describe = (table: SQLiteTable): StorageTable => {
|
|
51
|
+
const config = getTableConfig(table);
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
name: config.name,
|
|
55
|
+
columns: Object.fromEntries(
|
|
56
|
+
Object.entries(getTableColumns(table)).map(([key, column]) => [
|
|
57
|
+
key,
|
|
58
|
+
{
|
|
59
|
+
name: column.name,
|
|
60
|
+
type:
|
|
61
|
+
column.dataType === "boolean"
|
|
62
|
+
? "boolean"
|
|
63
|
+
: column.dataType === "number"
|
|
64
|
+
? "integer"
|
|
65
|
+
: "text",
|
|
66
|
+
nullable: !column.notNull,
|
|
67
|
+
},
|
|
68
|
+
]),
|
|
69
|
+
),
|
|
70
|
+
unique: [],
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const sqlitePersistence = <R>(acquire: Effect.Effect<object, never, R | SqlClient>) =>
|
|
75
|
+
createPersistence<SQLiteTable, R>({
|
|
76
|
+
makeTable,
|
|
77
|
+
describe,
|
|
78
|
+
operations: drizzleQueryOperations,
|
|
79
|
+
acquire,
|
|
80
|
+
passkeys: makeComposedPasskeys(drizzleQueryOperations),
|
|
81
|
+
});
|