@yielded/auth-persistence-drizzle 0.1.0-beta.24 → 0.1.0-beta.26
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 +4 -2
- package/dist/D1.d.mts +495 -1151
- package/dist/D1.mjs +41 -19
- package/dist/D1.mjs.map +1 -1
- package/dist/Libsql.d.mts +385 -1996
- package/dist/Libsql.mjs +43 -47
- package/dist/Libsql.mjs.map +1 -1
- package/dist/Mysql2.d.mts +397 -1743
- package/dist/Mysql2.mjs +35 -41
- package/dist/Mysql2.mjs.map +1 -1
- package/dist/Pglite.d.mts +397 -1743
- package/dist/Pglite.mjs +42 -31
- package/dist/Pglite.mjs.map +1 -1
- package/dist/Postgres.d.mts +397 -1743
- package/dist/Postgres.mjs +42 -31
- package/dist/Postgres.mjs.map +1 -1
- package/dist/SqliteBun.d.mts +385 -1992
- package/dist/SqliteBun.mjs +43 -43
- package/dist/SqliteBun.mjs.map +1 -1
- package/dist/SqliteDo.d.mts +385 -1991
- package/dist/SqliteDo.mjs +42 -41
- package/dist/SqliteDo.mjs.map +1 -1
- package/dist/SqliteNode.d.mts +385 -1992
- package/dist/SqliteNode.mjs +43 -43
- package/dist/SqliteNode.mjs.map +1 -1
- package/dist/SqliteWasm.d.mts +385 -1992
- package/dist/SqliteWasm.mjs +43 -43
- package/dist/SqliteWasm.mjs.map +1 -1
- package/dist/drizzle/d1-identity.mjs +2 -2
- package/dist/drizzle/d1-identity.mjs.map +1 -1
- package/dist/drizzle/driver-types.d.mts +15 -0
- package/dist/drizzle/email-drivers.mjs +32 -0
- package/dist/drizzle/email-drivers.mjs.map +1 -0
- package/dist/drizzle/email-model.d.mts +9 -13
- package/dist/drizzle/email-target.d.mts +10 -11
- package/dist/drizzle/email-target.mjs +33 -70
- package/dist/drizzle/email-target.mjs.map +1 -1
- package/dist/drizzle/model.d.mts +1 -10
- package/dist/drizzle/model.mjs +1 -2
- package/dist/drizzle/model.mjs.map +1 -1
- package/dist/drizzle/mysql-identity.mjs +3 -6
- package/dist/drizzle/mysql-identity.mjs.map +1 -1
- package/dist/drizzle/native-clock.d.mts +9 -0
- package/dist/drizzle/native-clock.mjs +18 -0
- package/dist/drizzle/native-clock.mjs.map +1 -0
- package/dist/drizzle/native-database.d.mts +46 -0
- package/dist/drizzle/native-database.mjs +6 -5
- package/dist/drizzle/native-database.mjs.map +1 -1
- package/dist/drizzle/native-sql-table.mjs +13 -5
- package/dist/drizzle/native-sql-table.mjs.map +1 -1
- package/dist/drizzle/native-target.d.mts +6 -0
- package/dist/drizzle/native-target.mjs +44 -0
- package/dist/drizzle/native-target.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-drivers.mjs +4 -56
- package/dist/drizzle/oauth-connected-drivers.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-model.d.mts +5 -22
- package/dist/drizzle/oauth-connected-model.mjs +1 -7
- package/dist/drizzle/oauth-connected-reference.d.mts +5 -7
- package/dist/drizzle/oauth-connected-reference.mjs +11 -3
- package/dist/drizzle/oauth-connected-reference.mjs.map +1 -1
- package/dist/drizzle/oauth-drivers.mjs +1 -2
- package/dist/drizzle/oauth-drivers.mjs.map +1 -1
- package/dist/drizzle/oauth-model.d.mts +11 -37
- package/dist/drizzle/oauth-model.mjs +3 -4
- package/dist/drizzle/oauth-model.mjs.map +1 -1
- package/dist/drizzle/oauth-proxy.d.mts +1 -1
- package/dist/drizzle/oauth-proxy.mjs +1 -1
- package/dist/drizzle/oauth-target.d.mts +9 -6
- package/dist/drizzle/oauth-target.mjs +47 -15
- package/dist/drizzle/oauth-target.mjs.map +1 -1
- package/dist/drizzle/passkey/target.d.mts +14 -0
- package/dist/drizzle/passkey/target.mjs +52 -0
- package/dist/drizzle/passkey/target.mjs.map +1 -0
- package/dist/drizzle/passkey/write-target.d.mts +11 -0
- package/dist/drizzle/passkey/write-target.mjs +28 -0
- package/dist/drizzle/passkey/write-target.mjs.map +1 -0
- package/dist/drizzle/passkey-drivers.mjs +2 -4
- package/dist/drizzle/passkey-drivers.mjs.map +1 -1
- package/dist/drizzle/passkey-model.d.mts +5 -26
- package/dist/drizzle/passkey-model.mjs +2 -8
- package/dist/drizzle/passkey-registration-ceremony-model.d.mts +3 -6
- package/dist/drizzle/passkey-write-drivers.mjs +2 -3
- package/dist/drizzle/passkey-write-drivers.mjs.map +1 -1
- package/dist/drizzle/passkey-write-model.d.mts +7 -9
- package/dist/drizzle/passkey-write-model.mjs +1 -3
- package/dist/drizzle/passkey-write-model.mjs.map +1 -1
- package/dist/drizzle/password-drivers.mjs +31 -0
- package/dist/drizzle/password-drivers.mjs.map +1 -0
- package/dist/drizzle/password-model.d.mts +7 -10
- package/dist/drizzle/password-target.d.mts +7 -8
- package/dist/drizzle/password-target.mjs +23 -68
- package/dist/drizzle/password-target.mjs.map +1 -1
- package/dist/drizzle/pg-identity.mjs +3 -6
- package/dist/drizzle/pg-identity.mjs.map +1 -1
- package/dist/drizzle/phone-drivers.mjs +24 -0
- package/dist/drizzle/phone-drivers.mjs.map +1 -0
- package/dist/drizzle/phone-model.d.mts +13 -104
- package/dist/drizzle/phone-model.mjs +5 -33
- package/dist/drizzle/phone-model.mjs.map +1 -1
- package/dist/drizzle/phone-target.mjs +22 -171
- package/dist/drizzle/phone-target.mjs.map +1 -1
- package/dist/drizzle/proof-drivers.mjs +24 -0
- package/dist/drizzle/proof-drivers.mjs.map +1 -0
- package/dist/drizzle/proof-model.d.mts +7 -15
- package/dist/drizzle/proof-target.d.mts +5 -5
- package/dist/drizzle/proof-target.mjs +14 -28
- package/dist/drizzle/proof-target.mjs.map +1 -1
- package/dist/drizzle/session-drivers.mjs +97 -0
- package/dist/drizzle/session-drivers.mjs.map +1 -0
- package/dist/drizzle/session-model.d.mts +11 -22
- package/dist/drizzle/sqlite-do-database.d.mts +3 -3
- package/dist/drizzle/sqlite-do-database.mjs +6 -1
- package/dist/drizzle/sqlite-do-database.mjs.map +1 -1
- package/dist/drizzle/sqlite-identity.mjs +3 -5
- package/dist/drizzle/sqlite-identity.mjs.map +1 -1
- package/dist/drizzle/step-up-model.d.mts +2 -5
- package/dist/drizzle/storage-validation.mjs +2 -1
- package/dist/drizzle/storage-validation.mjs.map +1 -1
- package/dist/drizzle/totp-model.d.mts +7 -74
- package/dist/drizzle/totp-model.mjs +1 -5
- package/dist/drizzle/totp-model.mjs.map +1 -1
- package/dist/drizzle/totp-target.mjs +39 -75
- package/dist/drizzle/totp-target.mjs.map +1 -1
- package/dist/drizzle/transaction-handle.mjs +13 -0
- package/dist/drizzle/transaction-handle.mjs.map +1 -0
- package/dist/drizzle/transaction-mysql.mjs +43 -12
- package/dist/drizzle/transaction-mysql.mjs.map +1 -1
- package/dist/index.d.mts +17 -22
- package/dist/index.mjs +10 -16
- package/dist/internal/drizzle-postgres.mjs +4 -6
- package/dist/internal/drizzle-postgres.mjs.map +1 -1
- package/dist/internal/drizzle-sqlite.mjs +4 -6
- package/dist/internal/drizzle-sqlite.mjs.map +1 -1
- package/package.json +1 -1
- package/src/D1.ts +77 -74
- package/src/Libsql.ts +65 -105
- package/src/Mysql2.ts +52 -87
- package/src/Pglite.ts +74 -81
- package/src/Postgres.ts +74 -81
- package/src/SqliteBun.ts +65 -113
- package/src/SqliteDo.ts +58 -106
- package/src/SqliteNode.ts +65 -113
- package/src/SqliteWasm.ts +65 -113
- package/src/drizzle/d1-identity.ts +2 -2
- package/src/drizzle/driver-types.ts +26 -0
- package/src/drizzle/email-drivers.ts +320 -0
- package/src/drizzle/email-model.ts +24 -78
- package/src/drizzle/email-target.ts +118 -211
- package/src/drizzle/model.ts +0 -2
- package/src/drizzle/mysql-identity.ts +4 -24
- package/src/drizzle/native-clock.ts +21 -0
- package/src/drizzle/native-database.ts +59 -18
- package/src/drizzle/native-sql-table.ts +104 -87
- package/src/drizzle/native-target.ts +120 -0
- package/src/drizzle/oauth-connected-drivers.ts +24 -233
- package/src/drizzle/oauth-connected-model.ts +3 -93
- package/src/drizzle/oauth-connected-reference.ts +16 -25
- package/src/drizzle/oauth-drivers.ts +58 -99
- package/src/drizzle/oauth-model.ts +27 -132
- package/src/drizzle/oauth-target.ts +250 -33
- package/src/drizzle/passkey/target.ts +205 -0
- package/src/drizzle/passkey/write-target.ts +91 -0
- package/src/drizzle/passkey-drivers.ts +35 -133
- package/src/drizzle/passkey-model.ts +3 -81
- package/src/drizzle/passkey-registration-ceremony-model.ts +5 -25
- package/src/drizzle/passkey-write-drivers.ts +32 -102
- package/src/drizzle/passkey-write-model.ts +10 -44
- package/src/drizzle/password-drivers.ts +286 -0
- package/src/drizzle/password-model.ts +10 -44
- package/src/drizzle/password-target.ts +85 -239
- package/src/drizzle/pg-identity.ts +4 -19
- package/src/drizzle/phone-drivers.ts +142 -0
- package/src/drizzle/phone-model.ts +22 -162
- package/src/drizzle/phone-target.ts +51 -493
- package/src/drizzle/proof-drivers.ts +123 -0
- package/src/drizzle/proof-model.ts +12 -123
- package/src/drizzle/proof-target.ts +38 -102
- package/src/drizzle/session-drivers.ts +696 -0
- package/src/drizzle/session-model.ts +54 -118
- package/src/drizzle/sqlite-do-database.ts +8 -0
- package/src/drizzle/sqlite-identity.ts +4 -22
- package/src/drizzle/step-up-model.ts +13 -37
- package/src/drizzle/storage-validation.ts +2 -1
- package/src/drizzle/totp-model.ts +20 -77
- package/src/drizzle/totp-target.ts +121 -261
- package/src/drizzle/transaction-handle.ts +41 -0
- package/src/drizzle/transaction-mysql.ts +90 -25
- package/src/index.ts +7 -122
- package/src/internal/drizzle-postgres.ts +4 -7
- package/src/internal/drizzle-sqlite.ts +4 -7
- package/dist/drizzle/crypto.mjs +0 -11
- package/dist/drizzle/crypto.mjs.map +0 -1
- package/dist/drizzle/d1-emails.d.mts +0 -62
- package/dist/drizzle/d1-emails.mjs +0 -626
- package/dist/drizzle/d1-emails.mjs.map +0 -1
- package/dist/drizzle/d1-generated-statement.mjs +0 -79
- package/dist/drizzle/d1-generated-statement.mjs.map +0 -1
- package/dist/drizzle/d1-oauth.d.mts +0 -331
- package/dist/drizzle/d1-oauth.mjs +0 -79
- package/dist/drizzle/d1-oauth.mjs.map +0 -1
- package/dist/drizzle/d1-passkey.d.mts +0 -37
- package/dist/drizzle/d1-passkey.mjs +0 -98
- package/dist/drizzle/d1-passkey.mjs.map +0 -1
- package/dist/drizzle/d1-password-prepared.d.mts +0 -25
- package/dist/drizzle/d1-password-prepared.mjs +0 -473
- package/dist/drizzle/d1-password-prepared.mjs.map +0 -1
- package/dist/drizzle/d1-passwords.d.mts +0 -70
- package/dist/drizzle/d1-passwords.mjs +0 -808
- package/dist/drizzle/d1-passwords.mjs.map +0 -1
- package/dist/drizzle/d1-phone.d.mts +0 -23
- package/dist/drizzle/d1-phone.mjs +0 -33
- package/dist/drizzle/d1-phone.mjs.map +0 -1
- package/dist/drizzle/d1-planning.d.mts +0 -11
- package/dist/drizzle/d1-planning.mjs +0 -43
- package/dist/drizzle/d1-planning.mjs.map +0 -1
- package/dist/drizzle/d1-proofs.d.mts +0 -80
- package/dist/drizzle/d1-proofs.mjs +0 -842
- package/dist/drizzle/d1-proofs.mjs.map +0 -1
- package/dist/drizzle/d1-sessions.d.mts +0 -68
- package/dist/drizzle/d1-sessions.mjs +0 -987
- package/dist/drizzle/d1-sessions.mjs.map +0 -1
- package/dist/drizzle/d1-totp.d.mts +0 -23
- package/dist/drizzle/d1-totp.mjs +0 -30
- package/dist/drizzle/d1-totp.mjs.map +0 -1
- package/dist/drizzle/email-registration.d.mts +0 -33
- package/dist/drizzle/email-registration.mjs +0 -281
- package/dist/drizzle/email-registration.mjs.map +0 -1
- package/dist/drizzle/email-sql.d.mts +0 -1
- package/dist/drizzle/email-sql.mjs +0 -9
- package/dist/drizzle/email-sql.mjs.map +0 -1
- package/dist/drizzle/mysql-emails.d.mts +0 -71
- package/dist/drizzle/mysql-emails.mjs +0 -43
- package/dist/drizzle/mysql-emails.mjs.map +0 -1
- package/dist/drizzle/mysql-password-prepared.d.mts +0 -30
- package/dist/drizzle/mysql-password-prepared.mjs +0 -21
- package/dist/drizzle/mysql-password-prepared.mjs.map +0 -1
- package/dist/drizzle/mysql-passwords.d.mts +0 -71
- package/dist/drizzle/mysql-passwords.mjs +0 -43
- package/dist/drizzle/mysql-passwords.mjs.map +0 -1
- package/dist/drizzle/mysql-proofs.d.mts +0 -75
- package/dist/drizzle/mysql-proofs.mjs +0 -28
- package/dist/drizzle/mysql-proofs.mjs.map +0 -1
- package/dist/drizzle/mysql-sessions.d.mts +0 -92
- package/dist/drizzle/mysql-sessions.mjs +0 -58
- package/dist/drizzle/mysql-sessions.mjs.map +0 -1
- package/dist/drizzle/oauth-connected-model.mjs.map +0 -1
- package/dist/drizzle/oauth-connected-target.d.mts +0 -6
- package/dist/drizzle/oauth-connected-target.mjs +0 -12
- package/dist/drizzle/oauth-connected-target.mjs.map +0 -1
- package/dist/drizzle/oauth-kernel.mjs +0 -11
- package/dist/drizzle/oauth-kernel.mjs.map +0 -1
- package/dist/drizzle/oauth-mysql.mjs +0 -8
- package/dist/drizzle/oauth-mysql.mjs.map +0 -1
- package/dist/drizzle/passkey-kernel.mjs +0 -8
- package/dist/drizzle/passkey-kernel.mjs.map +0 -1
- package/dist/drizzle/passkey-model.mjs.map +0 -1
- package/dist/drizzle/passkey-registration-ceremony-model.mjs +0 -2
- package/dist/drizzle/passkey-state.mjs +0 -7
- package/dist/drizzle/passkey-state.mjs.map +0 -1
- package/dist/drizzle/passkey-target.d.mts +0 -2
- package/dist/drizzle/passkey-target.mjs +0 -7
- package/dist/drizzle/passkey-target.mjs.map +0 -1
- package/dist/drizzle/passkey-write-target.d.mts +0 -5
- package/dist/drizzle/passkey-write-target.mjs +0 -7
- package/dist/drizzle/passkey-write-target.mjs.map +0 -1
- package/dist/drizzle/password-prepared-model.d.mts +0 -92
- package/dist/drizzle/password-prepared-model.mjs +0 -11
- package/dist/drizzle/password-prepared-model.mjs.map +0 -1
- package/dist/drizzle/password-prepared-sql.mjs +0 -395
- package/dist/drizzle/password-prepared-sql.mjs.map +0 -1
- package/dist/drizzle/password-prepared-state.mjs +0 -104
- package/dist/drizzle/password-prepared-state.mjs.map +0 -1
- package/dist/drizzle/password-prepared-target.d.mts +0 -13
- package/dist/drizzle/password-prepared-target.mjs +0 -62
- package/dist/drizzle/password-prepared-target.mjs.map +0 -1
- package/dist/drizzle/password-registration.d.mts +0 -7
- package/dist/drizzle/password-registration.mjs +0 -137
- package/dist/drizzle/password-registration.mjs.map +0 -1
- package/dist/drizzle/password-sql.d.mts +0 -1
- package/dist/drizzle/password-sql.mjs +0 -10
- package/dist/drizzle/password-sql.mjs.map +0 -1
- package/dist/drizzle/pg-emails.d.mts +0 -72
- package/dist/drizzle/pg-emails.mjs +0 -43
- package/dist/drizzle/pg-emails.mjs.map +0 -1
- package/dist/drizzle/pg-password-prepared.d.mts +0 -31
- package/dist/drizzle/pg-password-prepared.mjs +0 -21
- package/dist/drizzle/pg-password-prepared.mjs.map +0 -1
- package/dist/drizzle/pg-passwords.d.mts +0 -72
- package/dist/drizzle/pg-passwords.mjs +0 -43
- package/dist/drizzle/pg-passwords.mjs.map +0 -1
- package/dist/drizzle/pg-proofs.d.mts +0 -76
- package/dist/drizzle/pg-proofs.mjs +0 -27
- package/dist/drizzle/pg-proofs.mjs.map +0 -1
- package/dist/drizzle/pg-sessions.d.mts +0 -93
- package/dist/drizzle/pg-sessions.mjs +0 -58
- package/dist/drizzle/pg-sessions.mjs.map +0 -1
- package/dist/drizzle/phone-state.mjs +0 -14
- package/dist/drizzle/phone-state.mjs.map +0 -1
- package/dist/drizzle/phone-target.d.mts +0 -15
- package/dist/drizzle/proof-sql.d.mts +0 -1
- package/dist/drizzle/proof-sql.mjs +0 -8
- package/dist/drizzle/proof-sql.mjs.map +0 -1
- package/dist/drizzle/query-operations.mjs +0 -31
- package/dist/drizzle/query-operations.mjs.map +0 -1
- package/dist/drizzle/session-sql.d.mts +0 -1
- package/dist/drizzle/session-sql.mjs +0 -9
- package/dist/drizzle/session-sql.mjs.map +0 -1
- package/dist/drizzle/session-target.d.mts +0 -30
- package/dist/drizzle/session-target.mjs +0 -49
- package/dist/drizzle/session-target.mjs.map +0 -1
- package/dist/drizzle/sqlite-emails.mjs +0 -50
- package/dist/drizzle/sqlite-emails.mjs.map +0 -1
- package/dist/drizzle/sqlite-password-prepared.mjs +0 -26
- package/dist/drizzle/sqlite-password-prepared.mjs.map +0 -1
- package/dist/drizzle/sqlite-passwords.mjs +0 -54
- package/dist/drizzle/sqlite-passwords.mjs.map +0 -1
- package/dist/drizzle/sqlite-proofs.mjs +0 -34
- package/dist/drizzle/sqlite-proofs.mjs.map +0 -1
- package/dist/drizzle/sqlite-sessions.mjs +0 -79
- package/dist/drizzle/sqlite-sessions.mjs.map +0 -1
- package/dist/drizzle/standalone-guard.d.mts +0 -2
- package/dist/drizzle/standalone-guard.mjs +0 -21
- package/dist/drizzle/standalone-guard.mjs.map +0 -1
- package/dist/drizzle/totp-state.d.mts +0 -37
- package/dist/drizzle/totp-state.mjs +0 -287
- package/dist/drizzle/totp-state.mjs.map +0 -1
- package/dist/drizzle/totp-target.d.mts +0 -15
- package/dist/drizzle/transaction-execution.d.mts +0 -2
- package/dist/drizzle/transaction-execution.mjs +0 -11
- package/dist/drizzle/transaction-execution.mjs.map +0 -1
- package/dist/drizzle/transaction-owner.d.mts +0 -1
- package/dist/drizzle/transaction-owner.mjs +0 -8
- package/dist/drizzle/transaction-owner.mjs.map +0 -1
- package/src/drizzle/crypto.ts +0 -14
- package/src/drizzle/d1-emails.ts +0 -1945
- package/src/drizzle/d1-generated-statement.ts +0 -129
- package/src/drizzle/d1-oauth.ts +0 -360
- package/src/drizzle/d1-passkey.ts +0 -383
- package/src/drizzle/d1-password-prepared.ts +0 -1265
- package/src/drizzle/d1-passwords.ts +0 -2060
- package/src/drizzle/d1-phone.ts +0 -103
- package/src/drizzle/d1-planning.ts +0 -104
- package/src/drizzle/d1-proofs.ts +0 -2354
- package/src/drizzle/d1-sessions.ts +0 -2940
- package/src/drizzle/d1-totp.ts +0 -88
- package/src/drizzle/email-registration.ts +0 -850
- package/src/drizzle/email-sql.ts +0 -25
- package/src/drizzle/mysql-emails.ts +0 -343
- package/src/drizzle/mysql-password-prepared.ts +0 -198
- package/src/drizzle/mysql-passwords.ts +0 -343
- package/src/drizzle/mysql-proofs.ts +0 -196
- package/src/drizzle/mysql-sessions.ts +0 -780
- package/src/drizzle/oauth-connected-target.ts +0 -21
- package/src/drizzle/oauth-kernel.ts +0 -10
- package/src/drizzle/oauth-mysql.ts +0 -10
- package/src/drizzle/passkey-kernel.ts +0 -4
- package/src/drizzle/passkey-state.ts +0 -3
- package/src/drizzle/passkey-target.ts +0 -23
- package/src/drizzle/passkey-write-target.ts +0 -9
- package/src/drizzle/password-prepared-model.ts +0 -241
- package/src/drizzle/password-prepared-sql.ts +0 -1201
- package/src/drizzle/password-prepared-state.ts +0 -231
- package/src/drizzle/password-prepared-target.ts +0 -169
- package/src/drizzle/password-registration.ts +0 -369
- package/src/drizzle/password-sql.ts +0 -16
- package/src/drizzle/pg-emails.ts +0 -343
- package/src/drizzle/pg-password-prepared.ts +0 -199
- package/src/drizzle/pg-passwords.ts +0 -342
- package/src/drizzle/pg-proofs.ts +0 -206
- package/src/drizzle/pg-sessions.ts +0 -789
- package/src/drizzle/phone-state.ts +0 -21
- package/src/drizzle/proof-sql.ts +0 -10
- package/src/drizzle/query-operations.ts +0 -49
- package/src/drizzle/session-sql.ts +0 -15
- package/src/drizzle/session-target.ts +0 -337
- package/src/drizzle/sqlite-emails.ts +0 -393
- package/src/drizzle/sqlite-password-prepared.ts +0 -230
- package/src/drizzle/sqlite-passwords.ts +0 -497
- package/src/drizzle/sqlite-proofs.ts +0 -229
- package/src/drizzle/sqlite-sessions.ts +0 -1013
- package/src/drizzle/totp-state.ts +0 -525
- package/src/drizzle/transaction-execution.ts +0 -13
- package/src/drizzle/transaction-owner.ts +0 -11
package/src/SqliteWasm.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { NativeDatabase } from "@yielded/auth-persistence/Adapter";
|
|
2
|
-
export { OAuthProxyPersistence } from "./internal/drizzle-sqlite-oauth-proxy";
|
|
3
|
-
|
|
4
1
|
import type { AnyRelations } from "drizzle-orm";
|
|
5
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
EffectSQLiteWasmTransaction as PasskeyTransaction,
|
|
4
|
+
type EffectSQLiteWasmDatabase,
|
|
5
|
+
makeWithDefaults,
|
|
6
|
+
} from "drizzle-orm/effect-sqlite-wasm";
|
|
6
7
|
import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
7
8
|
import { Context, Effect, Layer } from "effect";
|
|
8
9
|
|
|
9
|
-
import { nativeDatabase } from "./drizzle/native-database";
|
|
10
|
+
import { NativeDatabase, nativeDatabase } from "./drizzle/native-database";
|
|
10
11
|
|
|
11
12
|
/** The application-owned Drizzle database used to construct persistence services. */
|
|
12
13
|
export class Database extends Context.Service<Database, EffectSQLiteWasmDatabase<AnyRelations>>()(
|
|
@@ -16,62 +17,44 @@ export class Database extends Context.Service<Database, EffectSQLiteWasmDatabase
|
|
|
16
17
|
/** Construct Drizzle from the driver's SQL-client Layer. */
|
|
17
18
|
export const databaseLayer = Layer.effect(Database, makeWithDefaults({}));
|
|
18
19
|
|
|
19
|
-
import { sqlClientEmailStandaloneGuard } from "./drizzle/email-target";
|
|
20
20
|
import type {
|
|
21
21
|
ExternalIdentityTables,
|
|
22
22
|
IdentityTables,
|
|
23
23
|
SubjectProvisioningTables,
|
|
24
24
|
} from "./drizzle/model";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import { sqlClientSessionStandaloneGuard } from "./drizzle/session-target";
|
|
28
|
-
import { makeSqliteEmailTarget, sqliteEmailConfiguration } from "./drizzle/sqlite-emails";
|
|
25
|
+
import { makePasswordTarget } from "./drizzle/password-drivers";
|
|
26
|
+
import { makeProofTarget } from "./drizzle/proof-drivers";
|
|
29
27
|
import {
|
|
30
28
|
makeSqliteExternalIdentityServices,
|
|
31
29
|
makeSqliteIdentityServices,
|
|
32
30
|
makeSqliteSubjectProvisioningServices,
|
|
33
31
|
} from "./drizzle/sqlite-identity";
|
|
34
|
-
import { makeSqlitePasswordTarget, sqlitePasswordConfiguration } from "./drizzle/sqlite-passwords";
|
|
35
|
-
import { makeSqliteProofTarget, sqliteProofConfiguration } from "./drizzle/sqlite-proofs";
|
|
36
|
-
import { makeSqliteSessionTarget, sqliteSessionConfiguration } from "./drizzle/sqlite-sessions";
|
|
37
|
-
|
|
38
|
-
const sessionTarget = makeSqliteSessionTarget<Database, EffectSQLiteWasmDatabase<AnyRelations>>(
|
|
39
|
-
Database,
|
|
40
|
-
(service) => sqliteSessionConfiguration("interactive", sqlClientSessionStandaloneGuard(service)),
|
|
41
|
-
);
|
|
42
32
|
|
|
43
|
-
const proofTarget =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
const proofTarget = makeProofTarget(Database, {
|
|
34
|
+
mode: "native",
|
|
35
|
+
dialect: "sqlite",
|
|
36
|
+
transactionConstructor: PasskeyTransaction,
|
|
37
|
+
});
|
|
47
38
|
|
|
48
|
-
const passwordTarget =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
sqlClientPasswordStandaloneGuard(service),
|
|
54
|
-
sqlClientProofStandaloneGuard(service),
|
|
55
|
-
),
|
|
56
|
-
);
|
|
39
|
+
const passwordTarget = makePasswordTarget(Database, {
|
|
40
|
+
mode: "native",
|
|
41
|
+
dialect: "sqlite",
|
|
42
|
+
transactionConstructor: PasskeyTransaction,
|
|
43
|
+
});
|
|
57
44
|
|
|
58
|
-
|
|
59
|
-
Database,
|
|
60
|
-
(service) =>
|
|
61
|
-
sqliteEmailConfiguration(
|
|
62
|
-
"interactive",
|
|
63
|
-
sqlClientEmailStandaloneGuard(service),
|
|
64
|
-
sqlClientProofStandaloneGuard(service),
|
|
65
|
-
),
|
|
66
|
-
);
|
|
45
|
+
import { makeEmailTarget } from "./drizzle/email-drivers";
|
|
67
46
|
|
|
68
47
|
export const {
|
|
69
|
-
|
|
70
|
-
coordinateEmailRegistration,
|
|
48
|
+
makeEmailSignInServices,
|
|
71
49
|
makeEmailAddressServices,
|
|
72
50
|
makeEmailRegistrationServices,
|
|
73
|
-
|
|
74
|
-
|
|
51
|
+
coordinateEmailAddress,
|
|
52
|
+
coordinateEmailRegistration,
|
|
53
|
+
} = makeEmailTarget(Database, {
|
|
54
|
+
mode: "native",
|
|
55
|
+
dialect: "sqlite",
|
|
56
|
+
transactionConstructor: PasskeyTransaction,
|
|
57
|
+
});
|
|
75
58
|
|
|
76
59
|
export const {
|
|
77
60
|
coordinatePasswordPersistence,
|
|
@@ -82,21 +65,6 @@ export const {
|
|
|
82
65
|
|
|
83
66
|
export const { coordinateProofPersistence, makeProofPersistenceServices } = proofTarget;
|
|
84
67
|
|
|
85
|
-
export const {
|
|
86
|
-
coordinateAuthenticationAuthority,
|
|
87
|
-
coordinatePendingAuthentication,
|
|
88
|
-
coordinateSignedSessionValidity,
|
|
89
|
-
coordinateStatefulSessions,
|
|
90
|
-
makeAuthenticationAuthorityServices,
|
|
91
|
-
makePendingAuthenticationServices,
|
|
92
|
-
makeSessionStepUpServices,
|
|
93
|
-
coordinateSessionStepUp,
|
|
94
|
-
makeSignedSessionValidityServices,
|
|
95
|
-
makeStatefulSessionServices,
|
|
96
|
-
} = sessionTarget;
|
|
97
|
-
|
|
98
|
-
export const commitMode = "interactive" as const;
|
|
99
|
-
|
|
100
68
|
export const makeIdentityServices = <
|
|
101
69
|
Subject extends AnySQLiteTable,
|
|
102
70
|
Identifier extends AnySQLiteTable,
|
|
@@ -133,36 +101,16 @@ export const makeExternalIdentityServices = <
|
|
|
133
101
|
Effect.provideServiceEffect(NativeDatabase, nativeDatabase(Database)),
|
|
134
102
|
);
|
|
135
103
|
|
|
136
|
-
import { makeSqlitePasswordPreparedTarget } from "./drizzle/sqlite-password-prepared";
|
|
137
|
-
|
|
138
|
-
const passwordPreparedTarget = makeSqlitePasswordPreparedTarget<
|
|
139
|
-
Database,
|
|
140
|
-
EffectSQLiteWasmDatabase<AnyRelations>
|
|
141
|
-
>(Database, (service) =>
|
|
142
|
-
sqlitePasswordConfiguration(
|
|
143
|
-
"interactive",
|
|
144
|
-
sqlClientPasswordStandaloneGuard(service),
|
|
145
|
-
sqlClientProofStandaloneGuard(service),
|
|
146
|
-
),
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
export const { makePasswordPreparedPersistenceServices, coordinatePasswordPreparedPersistence } =
|
|
150
|
-
passwordPreparedTarget;
|
|
151
|
-
|
|
152
|
-
export { passwordPreparedPersistenceLayer } from "./drizzle/password-prepared-target";
|
|
153
|
-
|
|
154
104
|
import { makeOAuthTarget } from "./drizzle/oauth-drivers";
|
|
155
|
-
import { sqlClientOAuthStandaloneGuard } from "./drizzle/oauth-target";
|
|
156
105
|
|
|
157
106
|
const oauthTarget = makeOAuthTarget<
|
|
158
107
|
Database,
|
|
159
108
|
EffectSQLiteWasmDatabase<AnyRelations>,
|
|
160
109
|
AnySQLiteTable<{ dialect: "sqlite" }>
|
|
161
110
|
>(Database, {
|
|
162
|
-
mode: "
|
|
111
|
+
mode: "native",
|
|
163
112
|
dialect: "sqlite",
|
|
164
|
-
|
|
165
|
-
standaloneGuard: sqlClientOAuthStandaloneGuard,
|
|
113
|
+
transactionConstructor: PasskeyTransaction,
|
|
166
114
|
});
|
|
167
115
|
|
|
168
116
|
export const {
|
|
@@ -181,23 +129,20 @@ export const {
|
|
|
181
129
|
} = oauthTarget;
|
|
182
130
|
|
|
183
131
|
import { makePasskeyTarget } from "./drizzle/passkey-drivers";
|
|
184
|
-
import { sqlClientPasskeyStandaloneGuard } from "./drizzle/passkey-target";
|
|
185
132
|
|
|
186
133
|
const passkeyTarget = makePasskeyTarget<
|
|
187
134
|
Database,
|
|
188
135
|
EffectSQLiteWasmDatabase<AnyRelations>,
|
|
189
136
|
AnySQLiteTable<{ dialect: "sqlite" }>
|
|
190
137
|
>(Database, {
|
|
191
|
-
|
|
138
|
+
transactionConstructor: PasskeyTransaction,
|
|
139
|
+
mode: "native",
|
|
192
140
|
dialect: "sqlite",
|
|
193
|
-
locking: false,
|
|
194
|
-
standaloneGuard: sqlClientPasskeyStandaloneGuard,
|
|
195
141
|
});
|
|
196
142
|
|
|
197
143
|
export const {
|
|
198
144
|
makePasskeyCredentialServices,
|
|
199
145
|
makePasskeyPersistenceServices,
|
|
200
|
-
makePasskeyEnrollmentContextServices,
|
|
201
146
|
makePasskeyRegistrationCeremonyServices,
|
|
202
147
|
coordinatePasskeyPersistence,
|
|
203
148
|
coordinatePasskeyRegistrationCeremony,
|
|
@@ -207,35 +152,12 @@ export const {
|
|
|
207
152
|
coordinatePasskeyRegistration,
|
|
208
153
|
} = passkeyTarget;
|
|
209
154
|
|
|
210
|
-
import {
|
|
211
|
-
|
|
212
|
-
const totpTarget = makeTotpTarget<
|
|
213
|
-
Database,
|
|
214
|
-
EffectSQLiteWasmDatabase<AnyRelations>,
|
|
215
|
-
AnySQLiteTable<{ dialect: "sqlite" }>
|
|
216
|
-
>(Database, {
|
|
217
|
-
mode: "interactive",
|
|
218
|
-
dialect: "sqlite",
|
|
219
|
-
locking: false,
|
|
220
|
-
standaloneGuard: sqlClientTotpStandaloneGuard,
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
export const { makeTotpPersistenceServices, coordinateTotpPersistence } = totpTarget;
|
|
224
|
-
|
|
225
|
-
import { makePhoneTarget, sqlClientPhoneStandaloneGuard } from "./drizzle/phone-target";
|
|
155
|
+
import { makePhoneTarget } from "./drizzle/phone-drivers";
|
|
226
156
|
|
|
227
|
-
const
|
|
157
|
+
export const { makePhonePersistenceServices, coordinatePhonePersistence } = makePhoneTarget(
|
|
228
158
|
Database,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
>(Database, {
|
|
232
|
-
mode: "interactive",
|
|
233
|
-
dialect: "sqlite",
|
|
234
|
-
locking: false,
|
|
235
|
-
standaloneGuard: sqlClientPhoneStandaloneGuard,
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
export const { makePhonePersistenceServices, coordinatePhonePersistence } = phoneTarget;
|
|
159
|
+
{ mode: "native", dialect: "sqlite", transactionConstructor: PasskeyTransaction },
|
|
160
|
+
);
|
|
239
161
|
|
|
240
162
|
import { drizzleMigrationsLayer } from "./internal/drizzle-migrations";
|
|
241
163
|
import { sqlitePersistence } from "./internal/drizzle-sqlite";
|
|
@@ -253,3 +175,33 @@ export const AuthPersistence = {
|
|
|
253
175
|
),
|
|
254
176
|
)(options),
|
|
255
177
|
};
|
|
178
|
+
|
|
179
|
+
export { OAuthProxyPersistence } from "./internal/drizzle-sqlite-oauth-proxy";
|
|
180
|
+
|
|
181
|
+
import { makeSessionTarget } from "./drizzle/session-drivers";
|
|
182
|
+
|
|
183
|
+
export const {
|
|
184
|
+
coordinateAuthenticationAuthority,
|
|
185
|
+
coordinatePendingAuthentication,
|
|
186
|
+
coordinateSignedSessionValidity,
|
|
187
|
+
coordinateStatefulSessions,
|
|
188
|
+
makeAuthenticationAuthorityServices,
|
|
189
|
+
makePendingAuthenticationServices,
|
|
190
|
+
makeSignedSessionValidityServices,
|
|
191
|
+
makeStatefulSessionServices,
|
|
192
|
+
makeSessionStepUpServices,
|
|
193
|
+
coordinateSessionStepUp,
|
|
194
|
+
makeSessionCleanupServices,
|
|
195
|
+
} = makeSessionTarget(Database, {
|
|
196
|
+
mode: "native",
|
|
197
|
+
dialect: "sqlite",
|
|
198
|
+
transactionConstructor: PasskeyTransaction,
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
import { makeTotpTarget } from "./drizzle/totp-target";
|
|
202
|
+
|
|
203
|
+
export const { makeTotpPersistenceServices, coordinateTotpPersistence } = makeTotpTarget(Database, {
|
|
204
|
+
mode: "native",
|
|
205
|
+
dialect: "sqlite",
|
|
206
|
+
transactionConstructor: PasskeyTransaction,
|
|
207
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { D1Client } from "@effect/sql-d1/D1Client";
|
|
2
|
-
import { withStorageValidation
|
|
2
|
+
import { withStorageValidation } from "@yielded/auth-persistence/Adapter";
|
|
3
3
|
import {
|
|
4
4
|
ExternalIdentityMutation,
|
|
5
5
|
type ExternalIdentity,
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
type D1GeneratedIdentityMapping,
|
|
36
36
|
type D1SubjectProvisioningMapping,
|
|
37
37
|
} from "./model";
|
|
38
|
-
import { nativeDatabase } from "./native-database";
|
|
38
|
+
import { NativeDatabase, nativeDatabase } from "./native-database";
|
|
39
39
|
import { validateDrizzleStorage } from "./storage-validation";
|
|
40
40
|
|
|
41
41
|
type RuntimeDatabase = EffectSQLiteD1Database<any> & { readonly $client: D1Client };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AnyRelations } from "drizzle-orm";
|
|
2
|
+
import type { EffectSQLiteD1Database } from "drizzle-orm/effect-d1";
|
|
3
|
+
import type { EffectLibsqlDatabase } from "drizzle-orm/effect-libsql";
|
|
4
|
+
import type { EffectMysql2Database } from "drizzle-orm/effect-mysql2";
|
|
5
|
+
import type { EffectPgDatabase as PgliteDatabase } from "drizzle-orm/effect-pglite";
|
|
6
|
+
import type { EffectPgDatabase as PostgresDatabase } from "drizzle-orm/effect-postgres";
|
|
7
|
+
import type { EffectSQLiteBunDatabase } from "drizzle-orm/effect-sqlite-bun";
|
|
8
|
+
import type { EffectSQLiteNodeDatabase } from "drizzle-orm/effect-sqlite-node";
|
|
9
|
+
import type { EffectSQLiteWasmDatabase } from "drizzle-orm/effect-sqlite-wasm";
|
|
10
|
+
|
|
11
|
+
import type { DatabaseValue } from "./sqlite-do-database";
|
|
12
|
+
|
|
13
|
+
export type NativeDriverDatabase =
|
|
14
|
+
| EffectSQLiteD1Database<AnyRelations>
|
|
15
|
+
| EffectLibsqlDatabase<AnyRelations>
|
|
16
|
+
| EffectMysql2Database<AnyRelations>
|
|
17
|
+
| PgliteDatabase<AnyRelations>
|
|
18
|
+
| PostgresDatabase<AnyRelations>
|
|
19
|
+
| EffectSQLiteBunDatabase<AnyRelations>
|
|
20
|
+
| EffectSQLiteNodeDatabase<AnyRelations>
|
|
21
|
+
| EffectSQLiteWasmDatabase<AnyRelations>
|
|
22
|
+
| DatabaseValue<AnyRelations>;
|
|
23
|
+
|
|
24
|
+
export type NativeDriverTransaction<D extends NativeDriverDatabase> = Parameters<
|
|
25
|
+
Parameters<D["transaction"]>[0]
|
|
26
|
+
>[0];
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import type { EmailRegistrationAuthority } from "@yielded/auth-persistence/Adapter";
|
|
2
|
+
import { EmailAddressPersistence, type EmailUnavailable } from "@yielded/auth/Email";
|
|
3
|
+
import type { LifecycleHooks } from "@yielded/auth/Hooks";
|
|
4
|
+
import type { Table } from "drizzle-orm";
|
|
5
|
+
import { type Context, Effect, type Crypto } from "effect";
|
|
6
|
+
|
|
7
|
+
import type { NativeDriverDatabase, NativeDriverTransaction } from "./driver-types";
|
|
8
|
+
import type {
|
|
9
|
+
AnyEmailAddressMapping,
|
|
10
|
+
EmailSignInMapping,
|
|
11
|
+
AnyEmailSignInMapping,
|
|
12
|
+
AnyEmailRegistrationMapping,
|
|
13
|
+
EmailAddressMapping,
|
|
14
|
+
EmailRegistrationMapping,
|
|
15
|
+
} from "./email-model";
|
|
16
|
+
import {
|
|
17
|
+
coordinateTargetEmailAddress,
|
|
18
|
+
coordinateTargetEmailRegistration,
|
|
19
|
+
makeTargetEmailAddressServices,
|
|
20
|
+
makeTargetEmailSignInServices,
|
|
21
|
+
makeTargetEmailRegistrationServices,
|
|
22
|
+
} from "./email-target";
|
|
23
|
+
import { NativeDatabase, nativeDatabase } from "./native-database";
|
|
24
|
+
import type { NativeTargetConfiguration } from "./native-target";
|
|
25
|
+
import type { AnyProofPersistenceMapping, ProofPersistenceMapping } from "./proof-model";
|
|
26
|
+
import type { SuppliedService } from "./SuppliedService";
|
|
27
|
+
|
|
28
|
+
type ProofOption<Proof extends Table, Subject extends Table, NativeId> = {
|
|
29
|
+
readonly proofMapping?: ProofPersistenceMapping<Proof, Subject, NativeId>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** Foreign table callback variance is erased only after these public signatures;
|
|
33
|
+
* the target validates physical metadata and the workflow invokes row codecs. */
|
|
34
|
+
export const makeEmailTarget = <DatabaseId, D extends NativeDriverDatabase>(
|
|
35
|
+
databaseService: Context.Service<DatabaseId, D>,
|
|
36
|
+
configuration: NativeTargetConfiguration,
|
|
37
|
+
) => {
|
|
38
|
+
function coordinateEmailAddress<
|
|
39
|
+
Database extends D,
|
|
40
|
+
S extends Table,
|
|
41
|
+
I extends Table,
|
|
42
|
+
C extends Table,
|
|
43
|
+
AC extends Table,
|
|
44
|
+
N,
|
|
45
|
+
Proof extends Table,
|
|
46
|
+
PS extends Table,
|
|
47
|
+
PN,
|
|
48
|
+
A,
|
|
49
|
+
E,
|
|
50
|
+
R,
|
|
51
|
+
DE,
|
|
52
|
+
DR,
|
|
53
|
+
>(
|
|
54
|
+
acquire: Effect.Effect<Database, DE, DR>,
|
|
55
|
+
options: {
|
|
56
|
+
readonly mapping: EmailAddressMapping<S, I, C, AC, N>;
|
|
57
|
+
readonly transaction?: never;
|
|
58
|
+
} & ProofOption<Proof, PS, PN>,
|
|
59
|
+
body: Effect.Effect<A, E, R>,
|
|
60
|
+
): Effect.Effect<
|
|
61
|
+
A,
|
|
62
|
+
E | DE | EmailUnavailable,
|
|
63
|
+
Exclude<R, EmailAddressPersistence> | DR | LifecycleHooks | Crypto.Crypto
|
|
64
|
+
>;
|
|
65
|
+
function coordinateEmailAddress<
|
|
66
|
+
Database extends D,
|
|
67
|
+
S extends Table,
|
|
68
|
+
I extends Table,
|
|
69
|
+
C extends Table,
|
|
70
|
+
AC extends Table,
|
|
71
|
+
N,
|
|
72
|
+
Proof extends Table,
|
|
73
|
+
PS extends Table,
|
|
74
|
+
PN,
|
|
75
|
+
A,
|
|
76
|
+
E,
|
|
77
|
+
R,
|
|
78
|
+
DE,
|
|
79
|
+
DR,
|
|
80
|
+
TxId,
|
|
81
|
+
TxShape,
|
|
82
|
+
>(
|
|
83
|
+
acquire: Effect.Effect<Database, DE, DR>,
|
|
84
|
+
options: {
|
|
85
|
+
readonly mapping: EmailAddressMapping<S, I, C, AC, N>;
|
|
86
|
+
readonly transaction: SuppliedService<
|
|
87
|
+
TxId,
|
|
88
|
+
NoInfer<NativeDriverTransaction<Database>>,
|
|
89
|
+
TxShape
|
|
90
|
+
>;
|
|
91
|
+
} & ProofOption<Proof, PS, PN>,
|
|
92
|
+
body: Effect.Effect<A, E, R>,
|
|
93
|
+
): Effect.Effect<
|
|
94
|
+
A,
|
|
95
|
+
E | DE | EmailUnavailable,
|
|
96
|
+
Exclude<R, EmailAddressPersistence | TxId> | DR | LifecycleHooks | Crypto.Crypto
|
|
97
|
+
>;
|
|
98
|
+
function coordinateEmailAddress<
|
|
99
|
+
Database extends D,
|
|
100
|
+
S extends Table,
|
|
101
|
+
I extends Table,
|
|
102
|
+
C extends Table,
|
|
103
|
+
AC extends Table,
|
|
104
|
+
N,
|
|
105
|
+
Proof extends Table,
|
|
106
|
+
PS extends Table,
|
|
107
|
+
PN,
|
|
108
|
+
A,
|
|
109
|
+
E,
|
|
110
|
+
R,
|
|
111
|
+
DE,
|
|
112
|
+
DR,
|
|
113
|
+
TxId,
|
|
114
|
+
TxShape,
|
|
115
|
+
>(
|
|
116
|
+
acquire: Effect.Effect<Database, DE, DR>,
|
|
117
|
+
options: {
|
|
118
|
+
readonly mapping: EmailAddressMapping<S, I, C, AC, N>;
|
|
119
|
+
readonly transaction?: SuppliedService<
|
|
120
|
+
TxId,
|
|
121
|
+
NoInfer<NativeDriverTransaction<Database>>,
|
|
122
|
+
TxShape
|
|
123
|
+
>;
|
|
124
|
+
} & ProofOption<Proof, PS, PN>,
|
|
125
|
+
body: Effect.Effect<A, E, R>,
|
|
126
|
+
) {
|
|
127
|
+
return Effect.flatMap(nativeDatabase(acquire), (database) =>
|
|
128
|
+
coordinateTargetEmailAddress(
|
|
129
|
+
database,
|
|
130
|
+
options.mapping as unknown as AnyEmailAddressMapping,
|
|
131
|
+
configuration,
|
|
132
|
+
(transaction: NativeDriverTransaction<Database>, services) => {
|
|
133
|
+
const work = Effect.provideService(
|
|
134
|
+
body,
|
|
135
|
+
EmailAddressPersistence,
|
|
136
|
+
services.emailAddressPersistence,
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
return options.transaction === undefined
|
|
140
|
+
? work
|
|
141
|
+
: Effect.provideService(work, options.transaction, options.transaction.of(transaction));
|
|
142
|
+
},
|
|
143
|
+
options.proofMapping as unknown as AnyProofPersistenceMapping | undefined,
|
|
144
|
+
),
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function coordinateEmailRegistration<
|
|
149
|
+
TargetId,
|
|
150
|
+
Registration,
|
|
151
|
+
Proof extends Table,
|
|
152
|
+
PS extends Table,
|
|
153
|
+
PN,
|
|
154
|
+
Database extends D,
|
|
155
|
+
S extends Table,
|
|
156
|
+
I extends Table,
|
|
157
|
+
C extends Table,
|
|
158
|
+
AC extends Table,
|
|
159
|
+
N,
|
|
160
|
+
A,
|
|
161
|
+
E,
|
|
162
|
+
R,
|
|
163
|
+
DE,
|
|
164
|
+
DR,
|
|
165
|
+
>(
|
|
166
|
+
acquire: Effect.Effect<Database, DE, DR>,
|
|
167
|
+
options: {
|
|
168
|
+
readonly mapping: EmailRegistrationMapping<NoInfer<Registration>, S, I, C, AC, N>;
|
|
169
|
+
readonly proofMapping: ProofPersistenceMapping<Proof, PS, PN>;
|
|
170
|
+
readonly target: SuppliedService<TargetId, EmailRegistrationAuthority<Registration>>;
|
|
171
|
+
readonly transaction?: never;
|
|
172
|
+
},
|
|
173
|
+
body: Effect.Effect<A, E, R>,
|
|
174
|
+
): Effect.Effect<
|
|
175
|
+
A,
|
|
176
|
+
E | DE | EmailUnavailable,
|
|
177
|
+
Exclude<R, TargetId> | DR | LifecycleHooks | Crypto.Crypto
|
|
178
|
+
>;
|
|
179
|
+
function coordinateEmailRegistration<
|
|
180
|
+
TargetId,
|
|
181
|
+
Registration,
|
|
182
|
+
Proof extends Table,
|
|
183
|
+
PS extends Table,
|
|
184
|
+
PN,
|
|
185
|
+
Database extends D,
|
|
186
|
+
S extends Table,
|
|
187
|
+
I extends Table,
|
|
188
|
+
C extends Table,
|
|
189
|
+
AC extends Table,
|
|
190
|
+
N,
|
|
191
|
+
A,
|
|
192
|
+
E,
|
|
193
|
+
R,
|
|
194
|
+
DE,
|
|
195
|
+
DR,
|
|
196
|
+
TxId,
|
|
197
|
+
TxShape,
|
|
198
|
+
>(
|
|
199
|
+
acquire: Effect.Effect<Database, DE, DR>,
|
|
200
|
+
options: {
|
|
201
|
+
readonly mapping: EmailRegistrationMapping<NoInfer<Registration>, S, I, C, AC, N>;
|
|
202
|
+
readonly proofMapping: ProofPersistenceMapping<Proof, PS, PN>;
|
|
203
|
+
readonly target: SuppliedService<TargetId, EmailRegistrationAuthority<Registration>>;
|
|
204
|
+
readonly transaction: SuppliedService<
|
|
205
|
+
TxId,
|
|
206
|
+
NoInfer<NativeDriverTransaction<Database>>,
|
|
207
|
+
TxShape
|
|
208
|
+
>;
|
|
209
|
+
},
|
|
210
|
+
body: Effect.Effect<A, E, R>,
|
|
211
|
+
): Effect.Effect<
|
|
212
|
+
A,
|
|
213
|
+
E | DE | EmailUnavailable,
|
|
214
|
+
Exclude<R, TargetId | TxId> | DR | LifecycleHooks | Crypto.Crypto
|
|
215
|
+
>;
|
|
216
|
+
function coordinateEmailRegistration<
|
|
217
|
+
TargetId,
|
|
218
|
+
Registration,
|
|
219
|
+
Proof extends Table,
|
|
220
|
+
PS extends Table,
|
|
221
|
+
PN,
|
|
222
|
+
Database extends D,
|
|
223
|
+
S extends Table,
|
|
224
|
+
I extends Table,
|
|
225
|
+
C extends Table,
|
|
226
|
+
AC extends Table,
|
|
227
|
+
N,
|
|
228
|
+
A,
|
|
229
|
+
E,
|
|
230
|
+
R,
|
|
231
|
+
DE,
|
|
232
|
+
DR,
|
|
233
|
+
TxId,
|
|
234
|
+
TxShape,
|
|
235
|
+
>(
|
|
236
|
+
acquire: Effect.Effect<Database, DE, DR>,
|
|
237
|
+
options: {
|
|
238
|
+
readonly mapping: EmailRegistrationMapping<NoInfer<Registration>, S, I, C, AC, N>;
|
|
239
|
+
readonly proofMapping: ProofPersistenceMapping<Proof, PS, PN>;
|
|
240
|
+
readonly target: SuppliedService<TargetId, EmailRegistrationAuthority<Registration>>;
|
|
241
|
+
readonly transaction?: SuppliedService<
|
|
242
|
+
TxId,
|
|
243
|
+
NoInfer<NativeDriverTransaction<Database>>,
|
|
244
|
+
TxShape
|
|
245
|
+
>;
|
|
246
|
+
},
|
|
247
|
+
body: Effect.Effect<A, E, R>,
|
|
248
|
+
) {
|
|
249
|
+
return Effect.flatMap(nativeDatabase(acquire), (database) =>
|
|
250
|
+
coordinateTargetEmailRegistration(
|
|
251
|
+
database,
|
|
252
|
+
options.mapping as unknown as AnyEmailRegistrationMapping<Registration>,
|
|
253
|
+
configuration,
|
|
254
|
+
options.proofMapping as unknown as AnyProofPersistenceMapping,
|
|
255
|
+
(transaction: NativeDriverTransaction<Database>, services) => {
|
|
256
|
+
const work = Effect.provideService(body, options.target, services.registrationAuthority);
|
|
257
|
+
|
|
258
|
+
return options.transaction === undefined
|
|
259
|
+
? work
|
|
260
|
+
: Effect.provideService(work, options.transaction, options.transaction.of(transaction));
|
|
261
|
+
},
|
|
262
|
+
),
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return {
|
|
267
|
+
makeEmailSignInServices: <
|
|
268
|
+
S extends Table,
|
|
269
|
+
I extends Table,
|
|
270
|
+
C extends Table,
|
|
271
|
+
AC extends Table,
|
|
272
|
+
N,
|
|
273
|
+
>(
|
|
274
|
+
mapping: EmailSignInMapping<S, I, C, AC, N>,
|
|
275
|
+
) =>
|
|
276
|
+
makeTargetEmailSignInServices(
|
|
277
|
+
mapping as unknown as AnyEmailSignInMapping,
|
|
278
|
+
configuration,
|
|
279
|
+
).pipe(Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService))),
|
|
280
|
+
makeEmailAddressServices: <
|
|
281
|
+
S extends Table,
|
|
282
|
+
I extends Table,
|
|
283
|
+
C extends Table,
|
|
284
|
+
AC extends Table,
|
|
285
|
+
N,
|
|
286
|
+
Proof extends Table,
|
|
287
|
+
PS extends Table,
|
|
288
|
+
PN,
|
|
289
|
+
>(
|
|
290
|
+
mapping: EmailAddressMapping<S, I, C, AC, N>,
|
|
291
|
+
proofMapping?: ProofPersistenceMapping<Proof, PS, PN>,
|
|
292
|
+
) =>
|
|
293
|
+
makeTargetEmailAddressServices(
|
|
294
|
+
mapping as unknown as AnyEmailAddressMapping,
|
|
295
|
+
configuration,
|
|
296
|
+
proofMapping as unknown as AnyProofPersistenceMapping | undefined,
|
|
297
|
+
).pipe(Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService))),
|
|
298
|
+
makeEmailRegistrationServices: <
|
|
299
|
+
Registration,
|
|
300
|
+
Proof extends Table,
|
|
301
|
+
PS extends Table,
|
|
302
|
+
PN,
|
|
303
|
+
S extends Table,
|
|
304
|
+
I extends Table,
|
|
305
|
+
C extends Table,
|
|
306
|
+
AC extends Table,
|
|
307
|
+
N,
|
|
308
|
+
>(
|
|
309
|
+
mapping: EmailRegistrationMapping<Registration, S, I, C, AC, N>,
|
|
310
|
+
proofs: ProofPersistenceMapping<Proof, PS, PN>,
|
|
311
|
+
) =>
|
|
312
|
+
makeTargetEmailRegistrationServices(
|
|
313
|
+
mapping as unknown as AnyEmailRegistrationMapping<Registration>,
|
|
314
|
+
configuration,
|
|
315
|
+
proofs as unknown as AnyProofPersistenceMapping,
|
|
316
|
+
).pipe(Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService))),
|
|
317
|
+
coordinateEmailAddress,
|
|
318
|
+
coordinateEmailRegistration,
|
|
319
|
+
};
|
|
320
|
+
};
|