@yielded/auth-persistence 0.1.0-beta.7
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 +21 -0
- package/dist/Drizzle.d.mts +28 -0
- package/dist/Drizzle.mjs +28 -0
- package/dist/DrizzleD1.d.mts +963 -0
- package/dist/DrizzleD1.mjs +29 -0
- package/dist/DrizzleD1.mjs.map +1 -0
- package/dist/DrizzleLibsql.d.mts +2284 -0
- package/dist/DrizzleLibsql.mjs +92 -0
- package/dist/DrizzleLibsql.mjs.map +1 -0
- package/dist/DrizzleMysql2.d.mts +1820 -0
- package/dist/DrizzleMysql2.mjs +55 -0
- package/dist/DrizzleMysql2.mjs.map +1 -0
- package/dist/DrizzlePglite.d.mts +1826 -0
- package/dist/DrizzlePglite.mjs +53 -0
- package/dist/DrizzlePglite.mjs.map +1 -0
- package/dist/DrizzlePostgres.d.mts +1826 -0
- package/dist/DrizzlePostgres.mjs +53 -0
- package/dist/DrizzlePostgres.mjs.map +1 -0
- package/dist/DrizzleSqliteBun.d.mts +2279 -0
- package/dist/DrizzleSqliteBun.mjs +70 -0
- package/dist/DrizzleSqliteBun.mjs.map +1 -0
- package/dist/DrizzleSqliteDo.d.mts +2329 -0
- package/dist/DrizzleSqliteDo.mjs +105 -0
- package/dist/DrizzleSqliteDo.mjs.map +1 -0
- package/dist/DrizzleSqliteNode.d.mts +2279 -0
- package/dist/DrizzleSqliteNode.mjs +70 -0
- package/dist/DrizzleSqliteNode.mjs.map +1 -0
- package/dist/DrizzleSqliteWasm.d.mts +2282 -0
- package/dist/DrizzleSqliteWasm.mjs +70 -0
- package/dist/DrizzleSqliteWasm.mjs.map +1 -0
- package/dist/drizzle/D1BatchStatements.d.mts +11 -0
- package/dist/drizzle/D1BatchStatements.mjs +8 -0
- package/dist/drizzle/D1BatchStatements.mjs.map +1 -0
- package/dist/drizzle/PasswordPreparedPostconditions.mjs +12 -0
- package/dist/drizzle/PasswordPreparedPostconditions.mjs.map +1 -0
- package/dist/drizzle/SuppliedService.d.mts +10 -0
- package/dist/drizzle/d1-emails.d.mts +62 -0
- package/dist/drizzle/d1-emails.mjs +580 -0
- package/dist/drizzle/d1-emails.mjs.map +1 -0
- package/dist/drizzle/d1-generated-statement.d.mts +2 -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 +31 -0
- package/dist/drizzle/d1-identity.mjs +119 -0
- package/dist/drizzle/d1-identity.mjs.map +1 -0
- package/dist/drizzle/d1-oauth.d.mts +301 -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 +51 -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 +25 -0
- package/dist/drizzle/d1-password-prepared.mjs +461 -0
- package/dist/drizzle/d1-password-prepared.mjs.map +1 -0
- package/dist/drizzle/d1-passwords.d.mts +87 -0
- package/dist/drizzle/d1-passwords.mjs +1004 -0
- package/dist/drizzle/d1-passwords.mjs.map +1 -0
- package/dist/drizzle/d1-phone.d.mts +26 -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 +12 -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 +80 -0
- package/dist/drizzle/d1-proofs.mjs +830 -0
- package/dist/drizzle/d1-proofs.mjs.map +1 -0
- package/dist/drizzle/d1-sessions.d.mts +67 -0
- package/dist/drizzle/d1-sessions.mjs +966 -0
- package/dist/drizzle/d1-sessions.mjs.map +1 -0
- package/dist/drizzle/d1-totp.d.mts +26 -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 +354 -0
- package/dist/drizzle/email-model.mjs +21 -0
- package/dist/drizzle/email-model.mjs.map +1 -0
- package/dist/drizzle/email-registration.d.mts +30 -0
- package/dist/drizzle/email-registration.mjs +238 -0
- package/dist/drizzle/email-registration.mjs.map +1 -0
- package/dist/drizzle/email-sql.d.mts +4 -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 +20 -0
- package/dist/drizzle/email-target.mjs +72 -0
- package/dist/drizzle/email-target.mjs.map +1 -0
- package/dist/drizzle/model.d.mts +250 -0
- package/dist/drizzle/model.mjs +58 -0
- package/dist/drizzle/model.mjs.map +1 -0
- package/dist/drizzle/mysql-emails.d.mts +71 -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 +22 -0
- package/dist/drizzle/mysql-identity.mjs +94 -0
- package/dist/drizzle/mysql-identity.mjs.map +1 -0
- package/dist/drizzle/mysql-password-prepared.d.mts +30 -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 +86 -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 +75 -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 +237 -0
- package/dist/drizzle/mysql-sessions.mjs +53 -0
- package/dist/drizzle/mysql-sessions.mjs.map +1 -0
- package/dist/drizzle/mysql.d.mts +70 -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 +278 -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 +17 -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 +14 -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 +753 -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 +5 -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 +463 -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 +4 -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 +6 -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 +111 -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 +272 -0
- package/dist/drizzle/passkey-model.mjs +34 -0
- package/dist/drizzle/passkey-model.mjs.map +1 -0
- package/dist/drizzle/passkey-registration-ceremony-model.d.mts +50 -0
- package/dist/drizzle/passkey-registration-ceremony-model.mjs +18 -0
- package/dist/drizzle/passkey-registration-ceremony-model.mjs.map +1 -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 +9 -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 +190 -0
- package/dist/drizzle/passkey-write-model.mjs +13 -0
- package/dist/drizzle/passkey-write-model.mjs.map +1 -0
- package/dist/drizzle/passkey-write-target.d.mts +11 -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 +329 -0
- package/dist/drizzle/password-model.mjs +23 -0
- package/dist/drizzle/password-model.mjs.map +1 -0
- package/dist/drizzle/password-prepared-model.d.mts +94 -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 +390 -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 +12 -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 +19 -0
- package/dist/drizzle/password-registration.mjs +135 -0
- package/dist/drizzle/password-registration.mjs.map +1 -0
- package/dist/drizzle/password-sql.d.mts +5 -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 +17 -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 +72 -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 +31 -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 +87 -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 +76 -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 +238 -0
- package/dist/drizzle/pg-sessions.mjs +53 -0
- package/dist/drizzle/pg-sessions.mjs.map +1 -0
- package/dist/drizzle/pg.d.mts +81 -0
- package/dist/drizzle/pg.mjs +290 -0
- package/dist/drizzle/pg.mjs.map +1 -0
- package/dist/drizzle/phone-model.d.mts +115 -0
- package/dist/drizzle/phone-model.mjs +39 -0
- package/dist/drizzle/phone-model.mjs.map +1 -0
- package/dist/drizzle/phone-state.mjs +16 -0
- package/dist/drizzle/phone-state.mjs.map +1 -0
- package/dist/drizzle/phone-target.d.mts +17 -0
- package/dist/drizzle/phone-target.mjs +170 -0
- package/dist/drizzle/phone-target.mjs.map +1 -0
- package/dist/drizzle/proof-model.d.mts +286 -0
- package/dist/drizzle/proof-model.mjs +17 -0
- package/dist/drizzle/proof-model.mjs.map +1 -0
- package/dist/drizzle/proof-sql.d.mts +4 -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 +12 -0
- package/dist/drizzle/proof-target.mjs +36 -0
- package/dist/drizzle/proof-target.mjs.map +1 -0
- package/dist/drizzle/query-operations.mjs +26 -0
- package/dist/drizzle/query-operations.mjs.map +1 -0
- package/dist/drizzle/session-model.d.mts +200 -0
- package/dist/drizzle/session-model.mjs +20 -0
- package/dist/drizzle/session-model.mjs.map +1 -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 +28 -0
- package/dist/drizzle/session-target.mjs +47 -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 +91 -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 +78 -0
- package/dist/drizzle/sqlite.mjs +217 -0
- package/dist/drizzle/sqlite.mjs.map +1 -0
- package/dist/drizzle/standalone-guard.mjs +19 -0
- package/dist/drizzle/standalone-guard.mjs.map +1 -0
- package/dist/drizzle/step-up-model.d.mts +65 -0
- package/dist/drizzle/step-up-model.mjs +9 -0
- package/dist/drizzle/step-up-model.mjs.map +1 -0
- package/dist/drizzle/step-up-state.mjs +32 -0
- package/dist/drizzle/step-up-state.mjs.map +1 -0
- package/dist/drizzle/totp-model.d.mts +84 -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 +38 -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 +17 -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 +4 -0
- package/dist/drizzle/transaction-execution.mjs +11 -0
- package/dist/drizzle/transaction-execution.mjs.map +1 -0
- package/dist/drizzle/transaction-mysql.mjs +46 -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 +5 -0
- package/dist/index.mjs +5 -0
- package/dist/internal/configuration.d.mts +174 -0
- package/dist/internal/configuration.mjs +7 -0
- package/dist/internal/configuration.mjs.map +1 -0
- package/dist/internal/drizzle-migrations.mjs +19 -0
- package/dist/internal/drizzle-migrations.mjs.map +1 -0
- package/dist/internal/drizzle-postgres.mjs +39 -0
- package/dist/internal/drizzle-postgres.mjs.map +1 -0
- package/dist/internal/drizzle-sqlite.mjs +37 -0
- package/dist/internal/drizzle-sqlite.mjs.map +1 -0
- package/dist/internal/email-kernel.d.mts +13 -0
- package/dist/internal/email-kernel.mjs +487 -0
- package/dist/internal/email-kernel.mjs.map +1 -0
- package/dist/internal/mapping-error.d.mts +11 -0
- package/dist/internal/mapping-error.mjs +30 -0
- package/dist/internal/mapping-error.mjs.map +1 -0
- package/dist/internal/passkey/admission.d.mts +7 -0
- package/dist/internal/passkey/admission.mjs +216 -0
- package/dist/internal/passkey/admission.mjs.map +1 -0
- package/dist/internal/passkey/credentials.d.mts +6 -0
- package/dist/internal/passkey/credentials.mjs +249 -0
- package/dist/internal/passkey/credentials.mjs.map +1 -0
- package/dist/internal/passkey/enrollment.mjs +138 -0
- package/dist/internal/passkey/enrollment.mjs.map +1 -0
- package/dist/internal/passkey/flow.d.mts +10 -0
- package/dist/internal/passkey/flow.mjs +452 -0
- package/dist/internal/passkey/flow.mjs.map +1 -0
- package/dist/internal/passkey/management.mjs +231 -0
- package/dist/internal/passkey/management.mjs.map +1 -0
- package/dist/internal/passkey/registration-ceremony.d.mts +9 -0
- package/dist/internal/passkey/registration-ceremony.mjs +129 -0
- package/dist/internal/passkey/registration-ceremony.mjs.map +1 -0
- package/dist/internal/passkey/registration-custody.d.mts +2 -0
- package/dist/internal/passkey/registration-custody.mjs +52 -0
- package/dist/internal/passkey/registration-custody.mjs.map +1 -0
- package/dist/internal/passkey/registration-write.mjs +211 -0
- package/dist/internal/passkey/registration-write.mjs.map +1 -0
- package/dist/internal/passkey/state.d.mts +5 -0
- package/dist/internal/passkey/state.mjs +234 -0
- package/dist/internal/passkey/state.mjs.map +1 -0
- package/dist/internal/passkey/target.d.mts +19 -0
- package/dist/internal/passkey/target.mjs +190 -0
- package/dist/internal/passkey/target.mjs.map +1 -0
- package/dist/internal/passkey/write-state.mjs +345 -0
- package/dist/internal/passkey/write-state.mjs.map +1 -0
- package/dist/internal/passkey/write-target.mjs +192 -0
- package/dist/internal/passkey/write-target.mjs.map +1 -0
- package/dist/internal/passkey-kernel.mjs +49 -0
- package/dist/internal/passkey-kernel.mjs.map +1 -0
- package/dist/internal/passkeys.mjs +367 -0
- package/dist/internal/passkeys.mjs.map +1 -0
- package/dist/internal/password-kernel.d.mts +13 -0
- package/dist/internal/password-kernel.mjs +704 -0
- package/dist/internal/password-kernel.mjs.map +1 -0
- package/dist/internal/persistence.mjs +289 -0
- package/dist/internal/persistence.mjs.map +1 -0
- package/dist/internal/phone-kernel.mjs +434 -0
- package/dist/internal/phone-kernel.mjs.map +1 -0
- package/dist/internal/proof-kernel.d.mts +9 -0
- package/dist/internal/proof-kernel.mjs +619 -0
- package/dist/internal/proof-kernel.mjs.map +1 -0
- package/dist/internal/query-operations.d.mts +3 -0
- package/dist/internal/registration.mjs +65 -0
- package/dist/internal/registration.mjs.map +1 -0
- package/dist/internal/session-kernel.mjs +737 -0
- package/dist/internal/session-kernel.mjs.map +1 -0
- package/dist/internal/sql-persistence.d.mts +11 -0
- package/dist/internal/sql-persistence.mjs +37 -0
- package/dist/internal/sql-persistence.mjs.map +1 -0
- package/dist/internal/sql-query.mjs +207 -0
- package/dist/internal/sql-query.mjs.map +1 -0
- package/dist/internal/sql-table.d.mts +37 -0
- package/dist/internal/sql-table.mjs +71 -0
- package/dist/internal/sql-table.mjs.map +1 -0
- package/dist/internal/storage-mapping.mjs +687 -0
- package/dist/internal/storage-mapping.mjs.map +1 -0
- package/dist/internal/storage-tables.d.mts +914 -0
- package/dist/internal/storage-tables.mjs +387 -0
- package/dist/internal/storage-tables.mjs.map +1 -0
- package/dist/internal/storage-validation.mjs +58 -0
- package/dist/internal/storage-validation.mjs.map +1 -0
- package/dist/internal/transaction-execution-kernel.d.mts +18 -0
- package/dist/internal/transaction-execution-kernel.mjs +118 -0
- package/dist/internal/transaction-execution-kernel.mjs.map +1 -0
- package/dist/internal/transaction-kernel.d.mts +7 -0
- package/dist/internal/transaction-kernel.mjs +260 -0
- package/dist/internal/transaction-kernel.mjs.map +1 -0
- package/package.json +1 -0
- package/src/Drizzle.ts +378 -0
- package/src/DrizzleD1.ts +136 -0
- package/src/DrizzleLibsql.ts +301 -0
- package/src/DrizzleMysql2.ts +184 -0
- package/src/DrizzlePglite.ts +174 -0
- package/src/DrizzlePostgres.ts +174 -0
- package/src/DrizzleSqliteBun.ts +258 -0
- package/src/DrizzleSqliteDo.ts +473 -0
- package/src/DrizzleSqliteNode.ts +259 -0
- package/src/DrizzleSqliteWasm.ts +263 -0
- package/src/drizzle/D1BatchStatements.ts +10 -0
- package/src/drizzle/PasswordPreparedPostconditions.ts +30 -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 +516 -0
- package/src/drizzle/email-registration.ts +698 -0
- package/src/drizzle/email-sql.ts +24 -0
- package/src/drizzle/email-target.ts +243 -0
- package/src/drizzle/model.ts +463 -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 +3 -0
- package/src/drizzle/passkey-model.ts +353 -0
- package/src/drizzle/passkey-registration-ceremony-model.ts +69 -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 +271 -0
- package/src/drizzle/passkey-write-target.ts +9 -0
- package/src/drizzle/password-model.ts +491 -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 +374 -0
- package/src/drizzle/password-sql.ts +12 -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 +398 -0
- package/src/drizzle/proof-sql.ts +9 -0
- package/src/drizzle/proof-target.ts +122 -0
- package/src/drizzle/query-operations.ts +37 -0
- package/src/drizzle/session-model.ts +370 -0
- package/src/drizzle/session-sql.ts +13 -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 +38 -0
- package/src/drizzle/step-up-model.ts +128 -0
- package/src/drizzle/step-up-state.ts +139 -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 +12 -0
- package/src/drizzle/transaction-mysql.ts +104 -0
- package/src/drizzle/transaction-owner.ts +10 -0
- package/src/index.ts +4 -0
- package/src/internal/configuration.ts +282 -0
- package/src/internal/drizzle-migrations.ts +30 -0
- package/src/internal/drizzle-postgres.ts +81 -0
- package/src/internal/drizzle-sqlite.ts +79 -0
- package/src/internal/email-kernel.ts +1532 -0
- package/src/internal/mapping-error.ts +36 -0
- package/src/internal/passkey/admission.ts +362 -0
- package/src/internal/passkey/credentials.ts +511 -0
- package/src/internal/passkey/enrollment.ts +326 -0
- package/src/internal/passkey/flow.ts +1062 -0
- package/src/internal/passkey/management.ts +422 -0
- package/src/internal/passkey/registration-ceremony.ts +283 -0
- package/src/internal/passkey/registration-custody.ts +91 -0
- package/src/internal/passkey/registration-write.ts +426 -0
- package/src/internal/passkey/state.ts +354 -0
- package/src/internal/passkey/target.ts +586 -0
- package/src/internal/passkey/write-state.ts +681 -0
- package/src/internal/passkey/write-target.ts +452 -0
- package/src/internal/passkey-kernel.ts +102 -0
- package/src/internal/passkeys.ts +597 -0
- package/src/internal/password-kernel.ts +2122 -0
- package/src/internal/persistence.ts +590 -0
- package/src/internal/phone-kernel.ts +843 -0
- package/src/internal/proof-kernel.ts +1949 -0
- package/src/internal/query-operations.ts +26 -0
- package/src/internal/registration.ts +160 -0
- package/src/internal/session-kernel.ts +2210 -0
- package/src/internal/sql-persistence.ts +45 -0
- package/src/internal/sql-query.ts +298 -0
- package/src/internal/sql-table.ts +89 -0
- package/src/internal/storage-mapping.ts +706 -0
- package/src/internal/storage-tables.ts +408 -0
- package/src/internal/storage-validation.ts +117 -0
- package/src/internal/transaction-execution-kernel.ts +317 -0
- package/src/internal/transaction-kernel.ts +582 -0
|
@@ -0,0 +1,705 @@
|
|
|
1
|
+
import { AuthStore, EmailOtpRejected } from "@yielded/auth/AuthStore";
|
|
2
|
+
import { AuthRateLimited, AuthStoreError, InvalidRegistration } from "@yielded/auth/Errors";
|
|
3
|
+
import {
|
|
4
|
+
InvalidOAuthState,
|
|
5
|
+
OAuthStateDecisions,
|
|
6
|
+
OAuthStateStore,
|
|
7
|
+
type OAuthState,
|
|
8
|
+
} from "@yielded/auth/OAuth";
|
|
9
|
+
import { AuthStoreDecisions, reportPersistenceFailure } from "@yielded/auth/Persistence";
|
|
10
|
+
import {
|
|
11
|
+
VerifiedEmail,
|
|
12
|
+
type ConsumeChallenge,
|
|
13
|
+
type ConsumeRegistration,
|
|
14
|
+
type NewChallenge,
|
|
15
|
+
type NewRegistration,
|
|
16
|
+
type TokenDigest,
|
|
17
|
+
} from "@yielded/auth/Schema";
|
|
18
|
+
/* oxlint-disable no-explicit-any -- Drizzle's generic query builders lose the concrete consumer table through a runtime column map. Assertions stay in this adapter. */
|
|
19
|
+
import {
|
|
20
|
+
and,
|
|
21
|
+
eq,
|
|
22
|
+
gt,
|
|
23
|
+
lt,
|
|
24
|
+
lte,
|
|
25
|
+
ne,
|
|
26
|
+
or,
|
|
27
|
+
sql,
|
|
28
|
+
type AnyRelations,
|
|
29
|
+
type InferSelectModel,
|
|
30
|
+
} from "drizzle-orm";
|
|
31
|
+
import type { QueryEffectHKTBase } from "drizzle-orm/effect-core";
|
|
32
|
+
import type { SQLiteColumn, AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
33
|
+
import type { SQLiteEffectDatabase } from "drizzle-orm/sqlite-core/effect/db";
|
|
34
|
+
import { Cause, Context, DateTime, Duration, Effect, Schema } from "effect";
|
|
35
|
+
import type { SqlError } from "effect/unstable/sql/SqlError";
|
|
36
|
+
|
|
37
|
+
import {
|
|
38
|
+
column,
|
|
39
|
+
requireStandaloneConsume,
|
|
40
|
+
updateValues,
|
|
41
|
+
type AuthTables,
|
|
42
|
+
type AuthStoreTables,
|
|
43
|
+
type ChallengeConsumeDecision,
|
|
44
|
+
type ConsumeDecision,
|
|
45
|
+
type OAuthStateTables,
|
|
46
|
+
} from "./model";
|
|
47
|
+
import type { SuppliedService } from "./SuppliedService";
|
|
48
|
+
|
|
49
|
+
type AnyDatabase = SQLiteEffectDatabase<any, any, AnyRelations>;
|
|
50
|
+
type ClosedQueryEffectHKT = QueryEffectHKTBase & { readonly context: never };
|
|
51
|
+
type RuntimeDatabase<HKT extends ClosedQueryEffectHKT, RunResult> = SQLiteEffectDatabase<
|
|
52
|
+
HKT,
|
|
53
|
+
RunResult,
|
|
54
|
+
AnyRelations
|
|
55
|
+
> &
|
|
56
|
+
Partial<Parameters<typeof requireStandaloneConsume>[0]>;
|
|
57
|
+
type TransactionOf<D extends AnyDatabase> = Parameters<Parameters<D["transaction"]>[0]>[0];
|
|
58
|
+
|
|
59
|
+
const storeReadError = () => AuthStoreError.make({ message: "Auth store read failed" });
|
|
60
|
+
const storeWriteError = () => AuthStoreError.make({ message: "Auth store write failed" });
|
|
61
|
+
const isStoreFailure = Schema.is(AuthStoreError);
|
|
62
|
+
|
|
63
|
+
const mapStoreFailure =
|
|
64
|
+
(failure: () => AuthStoreError) =>
|
|
65
|
+
<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, AuthStoreError, R> =>
|
|
66
|
+
reportPersistenceFailure(effect, isStoreFailure).pipe(
|
|
67
|
+
Effect.catchCause((cause) => Effect.failCause(Cause.map(cause, failure))),
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const mapStoreReadFailure = mapStoreFailure(storeReadError);
|
|
71
|
+
const mapStoreWriteFailure = mapStoreFailure(storeWriteError);
|
|
72
|
+
|
|
73
|
+
const selected = <T extends AnySQLiteTable>(row: unknown): InferSelectModel<T> =>
|
|
74
|
+
row as InferSelectModel<T>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Shared SQLite semantics for libSQL, Node, Bun, WASM, Durable Objects and D1.
|
|
78
|
+
* Every mutation here is one conditional statement, so D1 never reaches its
|
|
79
|
+
* unsupported interactive transaction and Durable Objects never suspend in a
|
|
80
|
+
* transactionSync callback.
|
|
81
|
+
*/
|
|
82
|
+
export const makeSqliteAuthStoreServices = <
|
|
83
|
+
C extends AnySQLiteTable,
|
|
84
|
+
R extends AnySQLiteTable,
|
|
85
|
+
HKT extends ClosedQueryEffectHKT = ClosedQueryEffectHKT,
|
|
86
|
+
RunResult = unknown,
|
|
87
|
+
>(
|
|
88
|
+
database: SQLiteEffectDatabase<HKT, RunResult, AnyRelations>,
|
|
89
|
+
mapping: AuthStoreTables<C, R>,
|
|
90
|
+
standaloneGuard?: Effect.Effect<void, AuthStoreError>,
|
|
91
|
+
) => {
|
|
92
|
+
const db = database as RuntimeDatabase<HKT, RunResult>;
|
|
93
|
+
|
|
94
|
+
const requireStandalone =
|
|
95
|
+
standaloneGuard ??
|
|
96
|
+
Effect.suspend(() =>
|
|
97
|
+
db.$client === undefined
|
|
98
|
+
? AuthStoreError.make({ message: "Use a root auth store or its decision transaction API" })
|
|
99
|
+
: requireStandaloneConsume({ $client: db.$client }),
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const challengeTable = mapping.challenge.table;
|
|
103
|
+
const challengeColumns = mapping.challenge.columns;
|
|
104
|
+
|
|
105
|
+
const challenge = {
|
|
106
|
+
challengeId: column(challengeTable, challengeColumns.challengeId),
|
|
107
|
+
tokenDigest: column(challengeTable, challengeColumns.tokenDigest),
|
|
108
|
+
namespace: column(challengeTable, challengeColumns.namespace),
|
|
109
|
+
value: column(challengeTable, challengeColumns.value),
|
|
110
|
+
purpose: column(challengeTable, challengeColumns.purpose),
|
|
111
|
+
otpKeyId: column(challengeTable, challengeColumns.otpKeyId),
|
|
112
|
+
otpDigest: column(challengeTable, challengeColumns.otpDigest),
|
|
113
|
+
issuedAt: column(challengeTable, challengeColumns.issuedAt),
|
|
114
|
+
expiresAt: column(challengeTable, challengeColumns.expiresAt),
|
|
115
|
+
attemptLimit: column(challengeTable, challengeColumns.attemptLimit),
|
|
116
|
+
failedAttempts: column(challengeTable, challengeColumns.failedAttempts),
|
|
117
|
+
consumed: column(challengeTable, challengeColumns.consumed),
|
|
118
|
+
} as Record<string, SQLiteColumn>;
|
|
119
|
+
|
|
120
|
+
const registrationTable = mapping.registration.table;
|
|
121
|
+
const registrationColumns = mapping.registration.columns;
|
|
122
|
+
|
|
123
|
+
const registration = {
|
|
124
|
+
tokenDigest: column(registrationTable, registrationColumns.tokenDigest),
|
|
125
|
+
expiresAt: column(registrationTable, registrationColumns.expiresAt),
|
|
126
|
+
consumed: column(registrationTable, registrationColumns.consumed),
|
|
127
|
+
} as Record<string, SQLiteColumn>;
|
|
128
|
+
|
|
129
|
+
const issueChallenge = Effect.fn("DrizzleSqliteAuthStore.issueChallenge")(function* (
|
|
130
|
+
input: NewChallenge,
|
|
131
|
+
) {
|
|
132
|
+
const now = yield* DateTime.now;
|
|
133
|
+
|
|
134
|
+
const cooldownCutoff = DateTime.mapEpochMillis(
|
|
135
|
+
now,
|
|
136
|
+
(millis) => millis - Duration.toMillis(input.resendCooldown),
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
const rows = (yield* Effect.suspend(() => {
|
|
140
|
+
const values = mapping.challenge.encodeInsert(input, {
|
|
141
|
+
namespace: mapping.challenge.identifierNamespace,
|
|
142
|
+
failedAttempts: 0,
|
|
143
|
+
consumed: false,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
const nativeNow = mapping.challenge.encodeInstant(now);
|
|
147
|
+
const nativeCutoff = mapping.challenge.encodeInstant(cooldownCutoff);
|
|
148
|
+
const nativeIssuedAt = mapping.challenge.encodeInstant(input.issuedAt);
|
|
149
|
+
const preservedAttempts = sql`case when ${gt(challenge.expiresAt, nativeNow)} then ${challenge.failedAttempts} else 0 end`;
|
|
150
|
+
|
|
151
|
+
const update = mapping.challenge.encodeUpdate(input, {
|
|
152
|
+
namespace: mapping.challenge.identifierNamespace,
|
|
153
|
+
failedAttempts: preservedAttempts as any,
|
|
154
|
+
consumed: false,
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
return db
|
|
158
|
+
.insert(challengeTable as any)
|
|
159
|
+
.values(values as any)
|
|
160
|
+
.onConflictDoUpdate({
|
|
161
|
+
target: [challenge.namespace, challenge.value, challenge.purpose],
|
|
162
|
+
set: update as any,
|
|
163
|
+
setWhere: and(
|
|
164
|
+
ne(challenge.challengeId, input.challengeId),
|
|
165
|
+
lt(challenge.issuedAt, nativeIssuedAt),
|
|
166
|
+
or(eq(challenge.consumed, true), lte(challenge.issuedAt, nativeCutoff)),
|
|
167
|
+
),
|
|
168
|
+
})
|
|
169
|
+
.returning();
|
|
170
|
+
}).pipe(mapStoreWriteFailure)) as ReadonlyArray<unknown>;
|
|
171
|
+
|
|
172
|
+
if (rows.length > 0) return;
|
|
173
|
+
|
|
174
|
+
const existing = (yield* Effect.suspend(() =>
|
|
175
|
+
db
|
|
176
|
+
.select()
|
|
177
|
+
.from(challengeTable as any)
|
|
178
|
+
.where(
|
|
179
|
+
and(
|
|
180
|
+
eq(challenge.namespace, mapping.challenge.identifierNamespace),
|
|
181
|
+
eq(challenge.value, input.email),
|
|
182
|
+
eq(challenge.purpose, input.purpose),
|
|
183
|
+
),
|
|
184
|
+
)
|
|
185
|
+
.limit(1),
|
|
186
|
+
).pipe(mapStoreReadFailure)) as ReadonlyArray<unknown>;
|
|
187
|
+
|
|
188
|
+
const decoded =
|
|
189
|
+
existing[0] === undefined
|
|
190
|
+
? undefined
|
|
191
|
+
: yield* Effect.suspend(() => mapping.challenge.decode(selected<C>(existing[0]))).pipe(
|
|
192
|
+
mapStoreReadFailure,
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const retryAfterSeconds =
|
|
196
|
+
decoded === undefined
|
|
197
|
+
? Math.max(1, Math.ceil(Duration.toMillis(input.resendCooldown) / 1000))
|
|
198
|
+
: Math.max(
|
|
199
|
+
1,
|
|
200
|
+
Math.ceil(
|
|
201
|
+
(DateTime.toEpochMillis(decoded.challenge.issuedAt) +
|
|
202
|
+
Duration.toMillis(input.resendCooldown) -
|
|
203
|
+
DateTime.toEpochMillis(now)) /
|
|
204
|
+
1000,
|
|
205
|
+
),
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
return yield* AuthRateLimited.make({ retryAfterSeconds });
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
const consumeChallengeDecision = Effect.fn("DrizzleSqliteAuthStore.consumeChallengeDecision")(
|
|
212
|
+
function* (
|
|
213
|
+
input: ConsumeChallenge,
|
|
214
|
+
): Effect.fn.Return<ChallengeConsumeDecision, AuthStoreError> {
|
|
215
|
+
const now = yield* DateTime.now;
|
|
216
|
+
|
|
217
|
+
const alternatives = Object.entries(input.otpDigests).map(([keyId, digest]) =>
|
|
218
|
+
and(eq(challenge.otpKeyId, keyId), eq(challenge.otpDigest, digest)),
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
const matches = alternatives.length === 0 ? sql<boolean>`false` : or(...alternatives)!;
|
|
222
|
+
|
|
223
|
+
const rows = (yield* Effect.suspend(() =>
|
|
224
|
+
db
|
|
225
|
+
.update(challengeTable as any)
|
|
226
|
+
.set(
|
|
227
|
+
updateValues<C>([
|
|
228
|
+
[
|
|
229
|
+
challengeColumns.consumed,
|
|
230
|
+
sql`case when ${matches} then true else ${challenge.consumed} end`,
|
|
231
|
+
],
|
|
232
|
+
[
|
|
233
|
+
challengeColumns.failedAttempts,
|
|
234
|
+
sql`${challenge.failedAttempts} + case when ${matches} then 0 else 1 end`,
|
|
235
|
+
],
|
|
236
|
+
]) as any,
|
|
237
|
+
)
|
|
238
|
+
.where(
|
|
239
|
+
and(
|
|
240
|
+
eq(challenge.tokenDigest, input.tokenDigest),
|
|
241
|
+
eq(challenge.consumed, false),
|
|
242
|
+
gt(challenge.expiresAt, mapping.challenge.encodeInstant(now)),
|
|
243
|
+
sql`${challenge.failedAttempts} < ${challenge.attemptLimit}`,
|
|
244
|
+
),
|
|
245
|
+
)
|
|
246
|
+
.returning(),
|
|
247
|
+
).pipe(mapStoreWriteFailure)) as ReadonlyArray<unknown>;
|
|
248
|
+
|
|
249
|
+
if (rows[0] === undefined) {
|
|
250
|
+
return { _tag: "rejected", reason: "missing_challenge" };
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const decoded = yield* Effect.suspend(() =>
|
|
254
|
+
mapping.challenge.decode(selected<C>(rows[0])),
|
|
255
|
+
).pipe(mapStoreReadFailure);
|
|
256
|
+
|
|
257
|
+
if (!decoded.consumed) return { _tag: "rejected", reason: "bad_code" };
|
|
258
|
+
|
|
259
|
+
return {
|
|
260
|
+
_tag: "accepted",
|
|
261
|
+
value: VerifiedEmail.make({
|
|
262
|
+
email: decoded.challenge.email,
|
|
263
|
+
purpose: decoded.challenge.purpose,
|
|
264
|
+
}),
|
|
265
|
+
};
|
|
266
|
+
},
|
|
267
|
+
);
|
|
268
|
+
|
|
269
|
+
const consumeChallenge = Effect.fn("DrizzleSqliteAuthStore.consumeChallenge")(function* (
|
|
270
|
+
input: ConsumeChallenge,
|
|
271
|
+
) {
|
|
272
|
+
yield* requireStandalone;
|
|
273
|
+
const decision = yield* consumeChallengeDecision(input);
|
|
274
|
+
|
|
275
|
+
return decision._tag === "accepted"
|
|
276
|
+
? decision.value
|
|
277
|
+
: yield* EmailOtpRejected.make({ reason: decision.reason });
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
const issueRegistration = Effect.fn("DrizzleSqliteAuthStore.issueRegistration")(function* (
|
|
281
|
+
input: NewRegistration,
|
|
282
|
+
) {
|
|
283
|
+
yield* Effect.suspend(() =>
|
|
284
|
+
db
|
|
285
|
+
.insert(registrationTable as any)
|
|
286
|
+
.values(mapping.registration.encodeInsert(input, false) as any),
|
|
287
|
+
).pipe(mapStoreWriteFailure);
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
const inspectRegistration = Effect.fn("DrizzleSqliteAuthStore.inspectRegistration")(function* (
|
|
291
|
+
tokenDigest: TokenDigest,
|
|
292
|
+
) {
|
|
293
|
+
const now = yield* DateTime.now;
|
|
294
|
+
|
|
295
|
+
const rows = (yield* Effect.suspend(() =>
|
|
296
|
+
db
|
|
297
|
+
.select()
|
|
298
|
+
.from(registrationTable as any)
|
|
299
|
+
.where(
|
|
300
|
+
and(
|
|
301
|
+
eq(registration.tokenDigest, tokenDigest),
|
|
302
|
+
eq(registration.consumed, false),
|
|
303
|
+
gt(registration.expiresAt, mapping.registration.encodeInstant(now)),
|
|
304
|
+
),
|
|
305
|
+
)
|
|
306
|
+
.limit(1),
|
|
307
|
+
).pipe(mapStoreReadFailure)) as ReadonlyArray<unknown>;
|
|
308
|
+
|
|
309
|
+
if (rows[0] === undefined) return yield* InvalidRegistration.make();
|
|
310
|
+
|
|
311
|
+
const decoded = yield* Effect.suspend(() =>
|
|
312
|
+
mapping.registration.decode(selected<R>(rows[0])),
|
|
313
|
+
).pipe(mapStoreReadFailure);
|
|
314
|
+
|
|
315
|
+
return decoded.registration;
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
const consumeRegistrationDecision = Effect.fn(
|
|
319
|
+
"DrizzleSqliteAuthStore.consumeRegistrationDecision",
|
|
320
|
+
)(function* (
|
|
321
|
+
input: ConsumeRegistration,
|
|
322
|
+
): Effect.fn.Return<ConsumeDecision<void>, AuthStoreError> {
|
|
323
|
+
const now = yield* DateTime.now;
|
|
324
|
+
|
|
325
|
+
const rows = (yield* Effect.suspend(() =>
|
|
326
|
+
db
|
|
327
|
+
.update(registrationTable as any)
|
|
328
|
+
.set(updateValues<R>([[registrationColumns.consumed, true]]) as any)
|
|
329
|
+
.where(
|
|
330
|
+
and(
|
|
331
|
+
eq(registration.tokenDigest, input.tokenDigest),
|
|
332
|
+
eq(registration.consumed, false),
|
|
333
|
+
gt(registration.expiresAt, mapping.registration.encodeInstant(now)),
|
|
334
|
+
),
|
|
335
|
+
)
|
|
336
|
+
.returning({ consumed: registration.consumed }),
|
|
337
|
+
).pipe(mapStoreWriteFailure)) as ReadonlyArray<unknown>;
|
|
338
|
+
|
|
339
|
+
return rows.length === 0 ? { _tag: "rejected" } : { _tag: "accepted", value: undefined };
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
const consumeRegistration = Effect.fn("DrizzleSqliteAuthStore.consumeRegistration")(function* (
|
|
343
|
+
input: ConsumeRegistration,
|
|
344
|
+
) {
|
|
345
|
+
yield* requireStandalone;
|
|
346
|
+
const decision = yield* consumeRegistrationDecision(input);
|
|
347
|
+
|
|
348
|
+
if (decision._tag === "rejected") return yield* InvalidRegistration.make();
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
return {
|
|
352
|
+
authStore: AuthStore.of({
|
|
353
|
+
issueChallenge,
|
|
354
|
+
consumeChallenge,
|
|
355
|
+
issueRegistration,
|
|
356
|
+
inspectRegistration,
|
|
357
|
+
consumeRegistration,
|
|
358
|
+
}),
|
|
359
|
+
decisions: {
|
|
360
|
+
consumeChallenge: consumeChallengeDecision,
|
|
361
|
+
consumeRegistration: consumeRegistrationDecision,
|
|
362
|
+
},
|
|
363
|
+
} as const;
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
export const makeSqliteOAuthStateServices = <
|
|
367
|
+
S extends AnySQLiteTable,
|
|
368
|
+
HKT extends ClosedQueryEffectHKT = ClosedQueryEffectHKT,
|
|
369
|
+
RunResult = unknown,
|
|
370
|
+
>(
|
|
371
|
+
database: SQLiteEffectDatabase<HKT, RunResult, AnyRelations>,
|
|
372
|
+
mapping: OAuthStateTables<S>,
|
|
373
|
+
standaloneGuard?: Effect.Effect<void, AuthStoreError>,
|
|
374
|
+
) => {
|
|
375
|
+
const db = database as RuntimeDatabase<HKT, RunResult>;
|
|
376
|
+
|
|
377
|
+
const requireStandalone =
|
|
378
|
+
standaloneGuard ??
|
|
379
|
+
Effect.suspend(() =>
|
|
380
|
+
db.$client === undefined
|
|
381
|
+
? AuthStoreError.make({ message: "Use a root auth store or its decision transaction API" })
|
|
382
|
+
: requireStandaloneConsume({ $client: db.$client }),
|
|
383
|
+
);
|
|
384
|
+
|
|
385
|
+
const stateTable = mapping.oauthState.table;
|
|
386
|
+
const stateColumns = mapping.oauthState.columns;
|
|
387
|
+
|
|
388
|
+
const state = {
|
|
389
|
+
stateDigest: column(stateTable, stateColumns.stateDigest),
|
|
390
|
+
expiresAt: column(stateTable, stateColumns.expiresAt),
|
|
391
|
+
consumed: column(stateTable, stateColumns.consumed),
|
|
392
|
+
} as Record<string, SQLiteColumn>;
|
|
393
|
+
|
|
394
|
+
const issue = Effect.fn("DrizzleSqliteOAuthStateStore.issue")(function* (input: OAuthState) {
|
|
395
|
+
yield* Effect.suspend(() =>
|
|
396
|
+
db.insert(stateTable as any).values(mapping.oauthState.encodeInsert(input, false) as any),
|
|
397
|
+
).pipe(mapStoreWriteFailure);
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
const consumeDecision = Effect.fn("DrizzleSqliteOAuthStateStore.consumeDecision")(function* (
|
|
401
|
+
digest: TokenDigest,
|
|
402
|
+
): Effect.fn.Return<ConsumeDecision<OAuthState>, AuthStoreError> {
|
|
403
|
+
const now = yield* DateTime.now;
|
|
404
|
+
|
|
405
|
+
const rows = (yield* Effect.suspend(() =>
|
|
406
|
+
db
|
|
407
|
+
.update(stateTable as any)
|
|
408
|
+
.set(updateValues<S>([[stateColumns.consumed, true]]) as any)
|
|
409
|
+
.where(
|
|
410
|
+
and(
|
|
411
|
+
eq(state.stateDigest, digest),
|
|
412
|
+
eq(state.consumed, false),
|
|
413
|
+
gt(state.expiresAt, mapping.oauthState.encodeInstant(now)),
|
|
414
|
+
),
|
|
415
|
+
)
|
|
416
|
+
.returning(),
|
|
417
|
+
).pipe(mapStoreWriteFailure)) as ReadonlyArray<unknown>;
|
|
418
|
+
|
|
419
|
+
if (rows[0] === undefined) return { _tag: "rejected" };
|
|
420
|
+
|
|
421
|
+
const decoded = yield* Effect.suspend(() =>
|
|
422
|
+
mapping.oauthState.decode(selected<S>(rows[0])),
|
|
423
|
+
).pipe(mapStoreReadFailure);
|
|
424
|
+
|
|
425
|
+
return { _tag: "accepted", value: decoded.state };
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
const consume = Effect.fn("DrizzleSqliteOAuthStateStore.consume")(function* (
|
|
429
|
+
digest: TokenDigest,
|
|
430
|
+
) {
|
|
431
|
+
yield* requireStandalone;
|
|
432
|
+
const decision = yield* consumeDecision(digest);
|
|
433
|
+
|
|
434
|
+
return decision._tag === "accepted" ? decision.value : yield* InvalidOAuthState.make();
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
return {
|
|
438
|
+
oauthStateStore: OAuthStateStore.of({ issue, consume }),
|
|
439
|
+
decisions: { consumeOAuthState: consumeDecision },
|
|
440
|
+
} as const;
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
export const makeSqliteAuthServices = <
|
|
444
|
+
C extends AnySQLiteTable,
|
|
445
|
+
R extends AnySQLiteTable,
|
|
446
|
+
S extends AnySQLiteTable,
|
|
447
|
+
HKT extends ClosedQueryEffectHKT = ClosedQueryEffectHKT,
|
|
448
|
+
RunResult = unknown,
|
|
449
|
+
>(
|
|
450
|
+
database: SQLiteEffectDatabase<HKT, RunResult, AnyRelations>,
|
|
451
|
+
mapping: AuthTables<C, R, S>,
|
|
452
|
+
standaloneGuard?: Effect.Effect<void, AuthStoreError>,
|
|
453
|
+
) => {
|
|
454
|
+
const auth = makeSqliteAuthStoreServices(database, mapping, standaloneGuard);
|
|
455
|
+
const oauth = makeSqliteOAuthStateServices(database, mapping, standaloneGuard);
|
|
456
|
+
|
|
457
|
+
return { ...auth, ...oauth, decisions: { ...auth.decisions, ...oauth.decisions } } as const;
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Owns the native outer commit for interactive SQLite targets. Keep rejection
|
|
462
|
+
* as a decision value inside the owner; interruption before commit rolls back.
|
|
463
|
+
*/
|
|
464
|
+
export function coordinateSqliteAuthStoreTransaction<
|
|
465
|
+
D extends AnyDatabase,
|
|
466
|
+
C extends AnySQLiteTable,
|
|
467
|
+
R extends AnySQLiteTable,
|
|
468
|
+
A,
|
|
469
|
+
E,
|
|
470
|
+
Requirements,
|
|
471
|
+
DatabaseError,
|
|
472
|
+
DatabaseRequirements,
|
|
473
|
+
>(
|
|
474
|
+
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
475
|
+
options: { readonly mapping: AuthStoreTables<C, R>; readonly transaction?: never },
|
|
476
|
+
body: Effect.Effect<A, E, Requirements>,
|
|
477
|
+
): Effect.Effect<
|
|
478
|
+
A,
|
|
479
|
+
E | DatabaseError | SqlError,
|
|
480
|
+
Exclude<Requirements, AuthStoreDecisions> | DatabaseRequirements
|
|
481
|
+
>;
|
|
482
|
+
|
|
483
|
+
export function coordinateSqliteAuthStoreTransaction<
|
|
484
|
+
D extends AnyDatabase,
|
|
485
|
+
C extends AnySQLiteTable,
|
|
486
|
+
R extends AnySQLiteTable,
|
|
487
|
+
A,
|
|
488
|
+
E,
|
|
489
|
+
Requirements,
|
|
490
|
+
DatabaseError,
|
|
491
|
+
DatabaseRequirements,
|
|
492
|
+
TxId,
|
|
493
|
+
TxShape,
|
|
494
|
+
>(
|
|
495
|
+
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
496
|
+
options: {
|
|
497
|
+
readonly mapping: AuthStoreTables<C, R>;
|
|
498
|
+
readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
499
|
+
},
|
|
500
|
+
body: Effect.Effect<A, E, Requirements>,
|
|
501
|
+
): Effect.Effect<
|
|
502
|
+
A,
|
|
503
|
+
E | DatabaseError | SqlError,
|
|
504
|
+
Exclude<Requirements, AuthStoreDecisions | TxId> | DatabaseRequirements
|
|
505
|
+
>;
|
|
506
|
+
|
|
507
|
+
export function coordinateSqliteAuthStoreTransaction<
|
|
508
|
+
D extends AnyDatabase,
|
|
509
|
+
C extends AnySQLiteTable,
|
|
510
|
+
R extends AnySQLiteTable,
|
|
511
|
+
A,
|
|
512
|
+
E,
|
|
513
|
+
Requirements,
|
|
514
|
+
DatabaseError,
|
|
515
|
+
DatabaseRequirements,
|
|
516
|
+
TxId,
|
|
517
|
+
TxShape,
|
|
518
|
+
>(
|
|
519
|
+
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
520
|
+
options: {
|
|
521
|
+
readonly mapping: AuthStoreTables<C, R>;
|
|
522
|
+
readonly transaction?: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
523
|
+
},
|
|
524
|
+
body: Effect.Effect<A, E, Requirements>,
|
|
525
|
+
) {
|
|
526
|
+
return Effect.flatMap(acquire, (database) =>
|
|
527
|
+
database.transaction<A, E, Exclude<Requirements, AuthStoreDecisions>>((transaction) => {
|
|
528
|
+
const decisions = makeSqliteAuthStoreServices(transaction, options.mapping).decisions;
|
|
529
|
+
const provided = Context.make(AuthStoreDecisions, decisions);
|
|
530
|
+
const work = Effect.provideContext(body, provided);
|
|
531
|
+
|
|
532
|
+
return options.transaction === undefined
|
|
533
|
+
? work
|
|
534
|
+
: Effect.provideService(
|
|
535
|
+
work,
|
|
536
|
+
options.transaction,
|
|
537
|
+
options.transaction.of(transaction as TransactionOf<D>),
|
|
538
|
+
);
|
|
539
|
+
}),
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
export function coordinateSqliteOAuthStateTransaction<
|
|
544
|
+
D extends AnyDatabase,
|
|
545
|
+
S extends AnySQLiteTable,
|
|
546
|
+
A,
|
|
547
|
+
E,
|
|
548
|
+
Requirements,
|
|
549
|
+
DatabaseError,
|
|
550
|
+
DatabaseRequirements,
|
|
551
|
+
>(
|
|
552
|
+
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
553
|
+
options: { readonly mapping: OAuthStateTables<S>; readonly transaction?: never },
|
|
554
|
+
body: Effect.Effect<A, E, Requirements>,
|
|
555
|
+
): Effect.Effect<
|
|
556
|
+
A,
|
|
557
|
+
E | DatabaseError | SqlError,
|
|
558
|
+
Exclude<Requirements, OAuthStateDecisions> | DatabaseRequirements
|
|
559
|
+
>;
|
|
560
|
+
|
|
561
|
+
export function coordinateSqliteOAuthStateTransaction<
|
|
562
|
+
D extends AnyDatabase,
|
|
563
|
+
S extends AnySQLiteTable,
|
|
564
|
+
A,
|
|
565
|
+
E,
|
|
566
|
+
Requirements,
|
|
567
|
+
DatabaseError,
|
|
568
|
+
DatabaseRequirements,
|
|
569
|
+
TxId,
|
|
570
|
+
TxShape,
|
|
571
|
+
>(
|
|
572
|
+
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
573
|
+
options: {
|
|
574
|
+
readonly mapping: OAuthStateTables<S>;
|
|
575
|
+
readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
576
|
+
},
|
|
577
|
+
body: Effect.Effect<A, E, Requirements>,
|
|
578
|
+
): Effect.Effect<
|
|
579
|
+
A,
|
|
580
|
+
E | DatabaseError | SqlError,
|
|
581
|
+
Exclude<Requirements, OAuthStateDecisions | TxId> | DatabaseRequirements
|
|
582
|
+
>;
|
|
583
|
+
|
|
584
|
+
export function coordinateSqliteOAuthStateTransaction<
|
|
585
|
+
D extends AnyDatabase,
|
|
586
|
+
S extends AnySQLiteTable,
|
|
587
|
+
A,
|
|
588
|
+
E,
|
|
589
|
+
Requirements,
|
|
590
|
+
DatabaseError,
|
|
591
|
+
DatabaseRequirements,
|
|
592
|
+
TxId,
|
|
593
|
+
TxShape,
|
|
594
|
+
>(
|
|
595
|
+
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
596
|
+
options: {
|
|
597
|
+
readonly mapping: OAuthStateTables<S>;
|
|
598
|
+
readonly transaction?: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
599
|
+
},
|
|
600
|
+
body: Effect.Effect<A, E, Requirements>,
|
|
601
|
+
) {
|
|
602
|
+
return Effect.flatMap(acquire, (database) =>
|
|
603
|
+
database.transaction<A, E, Exclude<Requirements, OAuthStateDecisions>>((transaction) => {
|
|
604
|
+
const decisions = makeSqliteOAuthStateServices(transaction, options.mapping).decisions;
|
|
605
|
+
const provided = Context.make(OAuthStateDecisions, decisions);
|
|
606
|
+
const work = Effect.provideContext(body, provided);
|
|
607
|
+
|
|
608
|
+
return options.transaction === undefined
|
|
609
|
+
? work
|
|
610
|
+
: Effect.provideService(
|
|
611
|
+
work,
|
|
612
|
+
options.transaction,
|
|
613
|
+
options.transaction.of(transaction as TransactionOf<D>),
|
|
614
|
+
);
|
|
615
|
+
}),
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
export function coordinateSqliteAuthTransaction<
|
|
620
|
+
D extends AnyDatabase,
|
|
621
|
+
C extends AnySQLiteTable,
|
|
622
|
+
R extends AnySQLiteTable,
|
|
623
|
+
S extends AnySQLiteTable,
|
|
624
|
+
A,
|
|
625
|
+
E,
|
|
626
|
+
Requirements,
|
|
627
|
+
DatabaseError,
|
|
628
|
+
DatabaseRequirements,
|
|
629
|
+
>(
|
|
630
|
+
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
631
|
+
options: { readonly mapping: AuthTables<C, R, S>; readonly transaction?: never },
|
|
632
|
+
body: Effect.Effect<A, E, Requirements>,
|
|
633
|
+
): Effect.Effect<
|
|
634
|
+
A,
|
|
635
|
+
E | DatabaseError | SqlError,
|
|
636
|
+
Exclude<Requirements, AuthStoreDecisions | OAuthStateDecisions> | DatabaseRequirements
|
|
637
|
+
>;
|
|
638
|
+
|
|
639
|
+
export function coordinateSqliteAuthTransaction<
|
|
640
|
+
D extends AnyDatabase,
|
|
641
|
+
C extends AnySQLiteTable,
|
|
642
|
+
R extends AnySQLiteTable,
|
|
643
|
+
S extends AnySQLiteTable,
|
|
644
|
+
A,
|
|
645
|
+
E,
|
|
646
|
+
Requirements,
|
|
647
|
+
DatabaseError,
|
|
648
|
+
DatabaseRequirements,
|
|
649
|
+
TxId,
|
|
650
|
+
TxShape,
|
|
651
|
+
>(
|
|
652
|
+
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
653
|
+
options: {
|
|
654
|
+
readonly mapping: AuthTables<C, R, S>;
|
|
655
|
+
readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
656
|
+
},
|
|
657
|
+
body: Effect.Effect<A, E, Requirements>,
|
|
658
|
+
): Effect.Effect<
|
|
659
|
+
A,
|
|
660
|
+
E | DatabaseError | SqlError,
|
|
661
|
+
Exclude<Requirements, AuthStoreDecisions | OAuthStateDecisions | TxId> | DatabaseRequirements
|
|
662
|
+
>;
|
|
663
|
+
|
|
664
|
+
export function coordinateSqliteAuthTransaction<
|
|
665
|
+
D extends AnyDatabase,
|
|
666
|
+
C extends AnySQLiteTable,
|
|
667
|
+
R extends AnySQLiteTable,
|
|
668
|
+
S extends AnySQLiteTable,
|
|
669
|
+
A,
|
|
670
|
+
E,
|
|
671
|
+
Requirements,
|
|
672
|
+
DatabaseError,
|
|
673
|
+
DatabaseRequirements,
|
|
674
|
+
TxId,
|
|
675
|
+
TxShape,
|
|
676
|
+
>(
|
|
677
|
+
acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,
|
|
678
|
+
options: {
|
|
679
|
+
readonly mapping: AuthTables<C, R, S>;
|
|
680
|
+
readonly transaction?: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
681
|
+
},
|
|
682
|
+
body: Effect.Effect<A, E, Requirements>,
|
|
683
|
+
) {
|
|
684
|
+
return Effect.flatMap(acquire, (database) =>
|
|
685
|
+
database.transaction<A, E, Exclude<Requirements, AuthStoreDecisions | OAuthStateDecisions>>(
|
|
686
|
+
(transaction) => {
|
|
687
|
+
const decisions = makeSqliteAuthServices(transaction, options.mapping).decisions;
|
|
688
|
+
|
|
689
|
+
const provided = Context.make(AuthStoreDecisions, decisions).pipe(
|
|
690
|
+
Context.add(OAuthStateDecisions, decisions),
|
|
691
|
+
);
|
|
692
|
+
|
|
693
|
+
const work = Effect.provideContext(body, provided);
|
|
694
|
+
|
|
695
|
+
return options.transaction === undefined
|
|
696
|
+
? work
|
|
697
|
+
: Effect.provideService(
|
|
698
|
+
work,
|
|
699
|
+
options.transaction,
|
|
700
|
+
options.transaction.of(transaction as TransactionOf<D>),
|
|
701
|
+
);
|
|
702
|
+
},
|
|
703
|
+
),
|
|
704
|
+
);
|
|
705
|
+
}
|