@yielded/auth-persistence-drizzle 0.1.0-beta.1 → 0.1.0-beta.13
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/dist/D1.d.mts +23 -18
- package/dist/D1.mjs +10 -4
- package/dist/D1.mjs.map +1 -1
- package/dist/Libsql.d.mts +58 -53
- package/dist/Libsql.mjs +20 -15
- package/dist/Libsql.mjs.map +1 -1
- package/dist/Mysql2.d.mts +58 -46
- package/dist/Mysql2.mjs +13 -6
- package/dist/Mysql2.mjs.map +1 -1
- package/dist/Pglite.d.mts +52 -41
- package/dist/Pglite.mjs +12 -7
- package/dist/Pglite.mjs.map +1 -1
- package/dist/Postgres.d.mts +59 -48
- package/dist/Postgres.mjs +12 -7
- package/dist/Postgres.mjs.map +1 -1
- package/dist/SqliteBun.d.mts +67 -62
- package/dist/SqliteBun.mjs +20 -14
- package/dist/SqliteBun.mjs.map +1 -1
- package/dist/SqliteDo.d.mts +58 -52
- package/dist/SqliteDo.mjs +26 -14
- package/dist/SqliteDo.mjs.map +1 -1
- package/dist/SqliteNode.d.mts +58 -53
- package/dist/SqliteNode.mjs +20 -14
- package/dist/SqliteNode.mjs.map +1 -1
- package/dist/SqliteWasm.d.mts +58 -53
- package/dist/SqliteWasm.mjs +20 -14
- package/dist/SqliteWasm.mjs.map +1 -1
- package/dist/drizzle/d1-database.d.mts +11 -0
- package/dist/drizzle/d1-database.mjs +8 -0
- package/dist/drizzle/d1-database.mjs.map +1 -0
- package/dist/drizzle/d1-emails.d.mts +8 -7
- package/dist/drizzle/d1-emails.mjs +7 -4
- package/dist/drizzle/d1-emails.mjs.map +1 -1
- package/dist/drizzle/d1-identity.mjs +12 -9
- package/dist/drizzle/d1-identity.mjs.map +1 -1
- package/dist/drizzle/d1-oauth.d.mts +10 -9
- package/dist/drizzle/d1-oauth.mjs +7 -4
- package/dist/drizzle/d1-oauth.mjs.map +1 -1
- package/dist/drizzle/d1-passkey.d.mts +3 -14
- package/dist/drizzle/d1-passkey.mjs +2 -1
- package/dist/drizzle/d1-passkey.mjs.map +1 -1
- package/dist/drizzle/d1-password-prepared.d.mts +4 -3
- package/dist/drizzle/d1-password-prepared.mjs +3 -1
- package/dist/drizzle/d1-password-prepared.mjs.map +1 -1
- package/dist/drizzle/d1-passwords.d.mts +6 -5
- package/dist/drizzle/d1-passwords.mjs +11 -7
- package/dist/drizzle/d1-passwords.mjs.map +1 -1
- package/dist/drizzle/d1-phone.d.mts +3 -4
- package/dist/drizzle/d1-phone.mjs +2 -1
- package/dist/drizzle/d1-phone.mjs.map +1 -1
- package/dist/drizzle/d1-planning.d.mts +1 -1
- package/dist/drizzle/d1-proofs.d.mts +4 -3
- package/dist/drizzle/d1-proofs.mjs +3 -1
- package/dist/drizzle/d1-proofs.mjs.map +1 -1
- package/dist/drizzle/d1-sessions.d.mts +11 -10
- package/dist/drizzle/d1-sessions.mjs +15 -9
- package/dist/drizzle/d1-sessions.mjs.map +1 -1
- package/dist/drizzle/d1-totp.d.mts +3 -4
- package/dist/drizzle/d1-totp.mjs +2 -1
- package/dist/drizzle/d1-totp.mjs.map +1 -1
- package/dist/drizzle/email-registration.mjs +2 -1
- package/dist/drizzle/email-registration.mjs.map +1 -1
- package/dist/drizzle/email-target.d.mts +7 -6
- package/dist/drizzle/email-target.mjs +10 -10
- package/dist/drizzle/email-target.mjs.map +1 -1
- package/dist/drizzle/mysql-database.d.mts +8 -0
- package/dist/drizzle/mysql-database.mjs +8 -0
- package/dist/drizzle/mysql-database.mjs.map +1 -0
- package/dist/drizzle/mysql-emails.d.mts +7 -6
- package/dist/drizzle/mysql-emails.mjs +12 -8
- package/dist/drizzle/mysql-emails.mjs.map +1 -1
- package/dist/drizzle/mysql-identity.mjs +12 -9
- package/dist/drizzle/mysql-identity.mjs.map +1 -1
- package/dist/drizzle/mysql-password-prepared.d.mts +3 -2
- package/dist/drizzle/mysql-password-prepared.mjs +6 -2
- package/dist/drizzle/mysql-password-prepared.mjs.map +1 -1
- package/dist/drizzle/mysql-passwords.d.mts +6 -4
- package/dist/drizzle/mysql-passwords.mjs +11 -7
- package/dist/drizzle/mysql-passwords.mjs.map +1 -1
- package/dist/drizzle/mysql-proofs.d.mts +3 -2
- package/dist/drizzle/mysql-proofs.mjs +8 -4
- package/dist/drizzle/mysql-proofs.mjs.map +1 -1
- package/dist/drizzle/mysql-sessions.d.mts +11 -10
- package/dist/drizzle/mysql-sessions.mjs +16 -12
- package/dist/drizzle/mysql-sessions.mjs.map +1 -1
- package/dist/drizzle/native-database.mjs +10 -0
- package/dist/drizzle/native-database.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-drivers.mjs +7 -5
- package/dist/drizzle/oauth-connected-drivers.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-settlement.mjs +3 -2
- package/dist/drizzle/oauth-connected-settlement.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-sign-in.mjs +4 -3
- package/dist/drizzle/oauth-connected-sign-in.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-target.d.mts +6 -7
- package/dist/drizzle/oauth-connected-target.mjs +4 -5
- package/dist/drizzle/oauth-connected-target.mjs.map +1 -1
- package/dist/drizzle/oauth-drivers.mjs +8 -6
- package/dist/drizzle/oauth-drivers.mjs.map +1 -1
- package/dist/drizzle/oauth-target.d.mts +12 -11
- package/dist/drizzle/oauth-target.mjs +13 -12
- package/dist/drizzle/oauth-target.mjs.map +1 -1
- package/dist/drizzle/passkey-drivers.mjs +8 -6
- package/dist/drizzle/passkey-drivers.mjs.map +1 -1
- package/dist/drizzle/passkey-write-drivers.mjs +5 -3
- package/dist/drizzle/passkey-write-drivers.mjs.map +1 -1
- package/dist/drizzle/passkey-write-target.d.mts +1 -1
- package/dist/drizzle/password-prepared-sql.mjs +2 -1
- package/dist/drizzle/password-prepared-sql.mjs.map +1 -1
- package/dist/drizzle/password-prepared-target.d.mts +3 -2
- package/dist/drizzle/password-prepared-target.mjs +4 -3
- package/dist/drizzle/password-prepared-target.mjs.map +1 -1
- package/dist/drizzle/password-registration.mjs +2 -1
- package/dist/drizzle/password-registration.mjs.map +1 -1
- package/dist/drizzle/password-target.d.mts +5 -4
- package/dist/drizzle/password-target.mjs +8 -8
- package/dist/drizzle/password-target.mjs.map +1 -1
- package/dist/drizzle/pg-database.d.mts +9 -0
- package/dist/drizzle/pg-database.mjs +8 -0
- package/dist/drizzle/pg-database.mjs.map +1 -0
- package/dist/drizzle/pg-emails.d.mts +7 -6
- package/dist/drizzle/pg-emails.mjs +12 -8
- package/dist/drizzle/pg-emails.mjs.map +1 -1
- package/dist/drizzle/pg-identity.mjs +12 -9
- package/dist/drizzle/pg-identity.mjs.map +1 -1
- package/dist/drizzle/pg-password-prepared.d.mts +3 -2
- package/dist/drizzle/pg-password-prepared.mjs +6 -2
- package/dist/drizzle/pg-password-prepared.mjs.map +1 -1
- package/dist/drizzle/pg-passwords.d.mts +6 -4
- package/dist/drizzle/pg-passwords.mjs +11 -7
- package/dist/drizzle/pg-passwords.mjs.map +1 -1
- package/dist/drizzle/pg-proofs.d.mts +3 -2
- package/dist/drizzle/pg-proofs.mjs +8 -4
- package/dist/drizzle/pg-proofs.mjs.map +1 -1
- package/dist/drizzle/pg-sessions.d.mts +11 -10
- package/dist/drizzle/pg-sessions.mjs +16 -12
- package/dist/drizzle/pg-sessions.mjs.map +1 -1
- package/dist/drizzle/phone-target.d.mts +4 -3
- package/dist/drizzle/phone-target.mjs +12 -11
- package/dist/drizzle/phone-target.mjs.map +1 -1
- package/dist/drizzle/proof-target.d.mts +3 -2
- package/dist/drizzle/proof-target.mjs +5 -5
- package/dist/drizzle/proof-target.mjs.map +1 -1
- package/dist/drizzle/session-sql.d.mts +1 -0
- package/dist/drizzle/session-target.d.mts +10 -8
- package/dist/drizzle/session-target.mjs +11 -11
- package/dist/drizzle/session-target.mjs.map +1 -1
- package/dist/drizzle/sqlite-emails.mjs +9 -5
- package/dist/drizzle/sqlite-emails.mjs.map +1 -1
- package/dist/drizzle/sqlite-identity.mjs +14 -11
- package/dist/drizzle/sqlite-identity.mjs.map +1 -1
- package/dist/drizzle/sqlite-password-prepared.mjs +7 -3
- package/dist/drizzle/sqlite-password-prepared.mjs.map +1 -1
- package/dist/drizzle/sqlite-passwords.mjs +10 -6
- package/dist/drizzle/sqlite-passwords.mjs.map +1 -1
- package/dist/drizzle/sqlite-proofs.mjs +7 -3
- package/dist/drizzle/sqlite-proofs.mjs.map +1 -1
- package/dist/drizzle/sqlite-sessions.mjs +16 -12
- package/dist/drizzle/sqlite-sessions.mjs.map +1 -1
- package/dist/drizzle/standalone-guard.d.mts +2 -0
- package/dist/drizzle/standalone-guard.mjs +8 -4
- package/dist/drizzle/standalone-guard.mjs.map +1 -1
- package/dist/drizzle/totp-target.d.mts +4 -3
- package/dist/drizzle/totp-target.mjs +31 -28
- package/dist/drizzle/totp-target.mjs.map +1 -1
- package/package.json +1 -1
- package/src/D1.ts +37 -10
- package/src/Libsql.ts +45 -17
- package/src/Mysql2.ts +39 -13
- package/src/Pglite.ts +47 -13
- package/src/Postgres.ts +47 -13
- package/src/SqliteBun.ts +58 -30
- package/src/SqliteDo.ts +61 -19
- package/src/SqliteNode.ts +55 -28
- package/src/SqliteWasm.ts +55 -28
- package/src/drizzle/d1-database.ts +10 -0
- package/src/drizzle/d1-emails.ts +84 -84
- package/src/drizzle/d1-identity.ts +17 -20
- package/src/drizzle/d1-oauth.ts +19 -8
- package/src/drizzle/d1-passkey.ts +5 -1
- package/src/drizzle/d1-password-prepared.ts +38 -37
- package/src/drizzle/d1-passwords.ts +118 -108
- package/src/drizzle/d1-phone.ts +5 -1
- package/src/drizzle/d1-proofs.ts +29 -30
- package/src/drizzle/d1-sessions.ts +51 -38
- package/src/drizzle/d1-totp.ts +5 -1
- package/src/drizzle/email-registration.ts +6 -2
- package/src/drizzle/email-target.ts +17 -19
- package/src/drizzle/mysql-database.ts +8 -0
- package/src/drizzle/mysql-emails.ts +28 -16
- package/src/drizzle/mysql-identity.ts +18 -21
- package/src/drizzle/mysql-password-prepared.ts +10 -8
- package/src/drizzle/mysql-passwords.ts +21 -9
- package/src/drizzle/mysql-proofs.ts +16 -5
- package/src/drizzle/mysql-sessions.ts +40 -17
- package/src/drizzle/native-database.ts +22 -0
- package/src/drizzle/oauth-connected-drivers.ts +18 -6
- package/src/drizzle/oauth-connected-settlement.ts +5 -3
- package/src/drizzle/oauth-connected-sign-in.ts +7 -3
- package/src/drizzle/oauth-connected-target.ts +16 -17
- package/src/drizzle/oauth-drivers.ts +26 -10
- package/src/drizzle/oauth-target.ts +30 -42
- package/src/drizzle/passkey-drivers.ts +21 -13
- package/src/drizzle/passkey-write-drivers.ts +11 -6
- package/src/drizzle/password-prepared-sql.ts +2 -4
- package/src/drizzle/password-prepared-target.ts +9 -6
- package/src/drizzle/password-registration.ts +7 -8
- package/src/drizzle/password-target.ts +19 -18
- package/src/drizzle/pg-database.ts +10 -0
- package/src/drizzle/pg-emails.ts +28 -16
- package/src/drizzle/pg-identity.ts +18 -22
- package/src/drizzle/pg-password-prepared.ts +10 -8
- package/src/drizzle/pg-passwords.ts +21 -9
- package/src/drizzle/pg-proofs.ts +16 -5
- package/src/drizzle/pg-sessions.ts +40 -17
- package/src/drizzle/phone-target.ts +22 -17
- package/src/drizzle/proof-target.ts +9 -12
- package/src/drizzle/session-target.ts +32 -50
- package/src/drizzle/sqlite-emails.ts +30 -13
- package/src/drizzle/sqlite-identity.ts +22 -42
- package/src/drizzle/sqlite-password-prepared.ts +23 -9
- package/src/drizzle/sqlite-passwords.ts +29 -15
- package/src/drizzle/sqlite-proofs.ts +28 -5
- package/src/drizzle/sqlite-sessions.ts +49 -23
- package/src/drizzle/standalone-guard.ts +18 -6
- package/src/drizzle/totp-target.ts +61 -60
- package/dist/drizzle/d1-identity.d.mts +0 -30
- package/dist/drizzle/mysql-identity.d.mts +0 -21
- package/dist/drizzle/pg-identity.d.mts +0 -22
|
@@ -14,12 +14,15 @@ import type { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
|
14
14
|
import { Effect, Context } from "effect";
|
|
15
15
|
import type { SqlError } from "effect/sql/SqlError";
|
|
16
16
|
|
|
17
|
+
import { Database as DatabaseService } from "./mysql-database";
|
|
18
|
+
import { nativeDatabase } from "./native-database";
|
|
17
19
|
import type {
|
|
18
20
|
AuthenticationAuthorityMapping,
|
|
19
21
|
PendingAuthenticationMapping,
|
|
20
22
|
SignedSessionValidityMapping,
|
|
21
23
|
StatefulSessionMapping,
|
|
22
24
|
} from "./session-model";
|
|
25
|
+
import { CurrentSessionSql } from "./session-sql";
|
|
23
26
|
import {
|
|
24
27
|
coordinateTargetAuthenticationAuthority,
|
|
25
28
|
coordinateTargetPendingAuthentication,
|
|
@@ -33,15 +36,20 @@ import {
|
|
|
33
36
|
makeTargetSessionStepUpServices,
|
|
34
37
|
coordinateTargetSessionStepUp,
|
|
35
38
|
} from "./session-target";
|
|
39
|
+
import {
|
|
40
|
+
type TransactionService,
|
|
41
|
+
acquireTransactionService,
|
|
42
|
+
transactionService,
|
|
43
|
+
} from "./standalone-guard";
|
|
36
44
|
import type { SuppliedService } from "./SuppliedService";
|
|
37
45
|
|
|
38
46
|
type Database = EffectMysql2Database<AnyRelations>;
|
|
39
47
|
type Transaction = Parameters<Parameters<Database["transaction"]>[0]>[0];
|
|
40
48
|
|
|
41
|
-
const configuration = (
|
|
49
|
+
const configuration = (service: TransactionService | undefined) => ({
|
|
42
50
|
mode: "interactive" as const,
|
|
43
51
|
locking: true,
|
|
44
|
-
standaloneGuard: sqlClientSessionStandaloneGuard(
|
|
52
|
+
standaloneGuard: sqlClientSessionStandaloneGuard(service),
|
|
45
53
|
});
|
|
46
54
|
|
|
47
55
|
export const makeMysqlAuthenticationAuthorityServices = <
|
|
@@ -52,9 +60,12 @@ export const makeMysqlAuthenticationAuthorityServices = <
|
|
|
52
60
|
P extends AnyMySqlTable,
|
|
53
61
|
NativeId,
|
|
54
62
|
>(
|
|
55
|
-
database: Database,
|
|
56
63
|
mapping: AuthenticationAuthorityMapping<Claims, S, C, F, P, NativeId>,
|
|
57
|
-
) =>
|
|
64
|
+
) =>
|
|
65
|
+
Effect.flatMap(
|
|
66
|
+
Effect.map(acquireTransactionService(DatabaseService), configuration),
|
|
67
|
+
(configuration) => makeTargetAuthenticationAuthorityServices<Claims>(mapping, configuration),
|
|
68
|
+
).pipe(Effect.provideServiceEffect(CurrentSessionSql, nativeDatabase(DatabaseService)));
|
|
58
69
|
|
|
59
70
|
export const makeMysqlPendingAuthenticationServices = <
|
|
60
71
|
Claims,
|
|
@@ -64,9 +75,12 @@ export const makeMysqlPendingAuthenticationServices = <
|
|
|
64
75
|
F extends AnyMySqlTable,
|
|
65
76
|
NativeId,
|
|
66
77
|
>(
|
|
67
|
-
database: Database,
|
|
68
78
|
mapping: PendingAuthenticationMapping<Claims, S, C, P, F, NativeId>,
|
|
69
|
-
) =>
|
|
79
|
+
) =>
|
|
80
|
+
Effect.flatMap(
|
|
81
|
+
Effect.map(acquireTransactionService(DatabaseService), configuration),
|
|
82
|
+
(configuration) => makeTargetPendingAuthenticationServices<Claims>(mapping, configuration),
|
|
83
|
+
).pipe(Effect.provideServiceEffect(CurrentSessionSql, nativeDatabase(DatabaseService)));
|
|
70
84
|
|
|
71
85
|
export const makeMysqlStatefulSessionServices = <
|
|
72
86
|
Claims,
|
|
@@ -78,9 +92,12 @@ export const makeMysqlStatefulSessionServices = <
|
|
|
78
92
|
NativeId,
|
|
79
93
|
NativeSessionId,
|
|
80
94
|
>(
|
|
81
|
-
database: Database,
|
|
82
95
|
mapping: StatefulSessionMapping<Claims, S, C, Session, F, P, NativeId, NativeSessionId>,
|
|
83
|
-
) =>
|
|
96
|
+
) =>
|
|
97
|
+
Effect.flatMap(
|
|
98
|
+
Effect.map(acquireTransactionService(DatabaseService), configuration),
|
|
99
|
+
(configuration) => makeTargetStatefulSessionServices<Claims>(mapping, configuration),
|
|
100
|
+
).pipe(Effect.provideServiceEffect(CurrentSessionSql, nativeDatabase(DatabaseService)));
|
|
84
101
|
|
|
85
102
|
export const makeMysqlSignedSessionValidityServices = <
|
|
86
103
|
S extends AnyMySqlTable,
|
|
@@ -88,9 +105,12 @@ export const makeMysqlSignedSessionValidityServices = <
|
|
|
88
105
|
NativeId,
|
|
89
106
|
NativeSessionId,
|
|
90
107
|
>(
|
|
91
|
-
database: Database,
|
|
92
108
|
mapping: SignedSessionValidityMapping<S, T, NativeId, NativeSessionId>,
|
|
93
|
-
) =>
|
|
109
|
+
) =>
|
|
110
|
+
Effect.flatMap(
|
|
111
|
+
Effect.map(acquireTransactionService(DatabaseService), configuration),
|
|
112
|
+
(configuration) => makeTargetSignedSessionValidityServices(mapping, configuration),
|
|
113
|
+
).pipe(Effect.provideServiceEffect(CurrentSessionSql, nativeDatabase(DatabaseService)));
|
|
94
114
|
|
|
95
115
|
export function coordinateMysqlAuthenticationAuthority<
|
|
96
116
|
D extends Database,
|
|
@@ -183,7 +203,7 @@ export function coordinateMysqlAuthenticationAuthority<
|
|
|
183
203
|
>(
|
|
184
204
|
database,
|
|
185
205
|
options.mapping,
|
|
186
|
-
configuration(database),
|
|
206
|
+
configuration(transactionService(database)),
|
|
187
207
|
(
|
|
188
208
|
transaction: Transaction,
|
|
189
209
|
services: { readonly authenticationAuthority: AuthenticationAuthority["Service"] },
|
|
@@ -290,7 +310,7 @@ export function coordinateMysqlPendingAuthentication<
|
|
|
290
310
|
coordinateTargetPendingAuthentication<Claims, Transaction, A, E, Exclude<R, TargetId>>(
|
|
291
311
|
database,
|
|
292
312
|
options.mapping,
|
|
293
|
-
configuration(database),
|
|
313
|
+
configuration(transactionService(database)),
|
|
294
314
|
(
|
|
295
315
|
transaction: Transaction,
|
|
296
316
|
services: { readonly pendingAuthentication: PendingAuthentication<Claims> },
|
|
@@ -442,7 +462,7 @@ export function coordinateMysqlStatefulSessions<
|
|
|
442
462
|
>(
|
|
443
463
|
database,
|
|
444
464
|
options.mapping,
|
|
445
|
-
configuration(database),
|
|
465
|
+
configuration(transactionService(database)),
|
|
446
466
|
(
|
|
447
467
|
transaction: Transaction,
|
|
448
468
|
services: {
|
|
@@ -550,7 +570,7 @@ export function coordinateMysqlSignedSessionValidity<
|
|
|
550
570
|
coordinateTargetSignedSessionValidity<Transaction, A, E, Exclude<R, TargetId>>(
|
|
551
571
|
database,
|
|
552
572
|
options.mapping,
|
|
553
|
-
configuration(database),
|
|
573
|
+
configuration(transactionService(database)),
|
|
554
574
|
(
|
|
555
575
|
transaction: Transaction,
|
|
556
576
|
services: { readonly signedSessionValidity: SignedSessionValidity },
|
|
@@ -579,10 +599,13 @@ export const makeMysqlSessionStepUpServices = <
|
|
|
579
599
|
NativeId,
|
|
580
600
|
NativeSessionId,
|
|
581
601
|
>(
|
|
582
|
-
database: Database,
|
|
583
602
|
mapping: SessionStepUpMapping<NoInfer<Claims>, S, C, I, Session, T, NativeId, NativeSessionId>,
|
|
584
603
|
target: Context.Service<Id, SessionStepUpPersistence<Claims>>,
|
|
585
|
-
) =>
|
|
604
|
+
) =>
|
|
605
|
+
Effect.flatMap(
|
|
606
|
+
Effect.map(acquireTransactionService(DatabaseService), configuration),
|
|
607
|
+
(configuration) => makeTargetSessionStepUpServices(mapping, target, configuration),
|
|
608
|
+
).pipe(Effect.provideServiceEffect(CurrentSessionSql, nativeDatabase(DatabaseService)));
|
|
586
609
|
|
|
587
610
|
export function coordinateMysqlSessionStepUp<
|
|
588
611
|
Claims,
|
|
@@ -724,7 +747,7 @@ export function coordinateMysqlSessionStepUp<
|
|
|
724
747
|
database,
|
|
725
748
|
options.mapping,
|
|
726
749
|
options.target,
|
|
727
|
-
configuration(database),
|
|
750
|
+
configuration(transactionService(database)),
|
|
728
751
|
(
|
|
729
752
|
transaction: Parameters<Parameters<D["transaction"]>[0]>[0],
|
|
730
753
|
services: { readonly sessionStepUpPersistence: SessionStepUpPersistence<Claims> },
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
TransactionNativeDatabase,
|
|
3
|
+
SessionSqlDatabase,
|
|
4
|
+
PasswordSqlDatabase,
|
|
5
|
+
EmailSqlDatabase,
|
|
6
|
+
ProofSqlDatabase,
|
|
7
|
+
} from "@yielded/auth-persistence/Adapter";
|
|
8
|
+
import { type Context, Effect } from "effect";
|
|
9
|
+
|
|
10
|
+
/** Drizzle omits its captured $client from database class types, and only D1
|
|
11
|
+
* exposes batch. Its generic query builders implement the SQL kernel contracts
|
|
12
|
+
* through drizzleQueryOperations. The selected driver mode controls native calls. */
|
|
13
|
+
export const nativeDatabase = <Id, Database>(databaseService: Context.Key<Id, Database>) =>
|
|
14
|
+
Effect.map(
|
|
15
|
+
Effect.service(databaseService),
|
|
16
|
+
(database) =>
|
|
17
|
+
database as unknown as TransactionNativeDatabase &
|
|
18
|
+
SessionSqlDatabase &
|
|
19
|
+
PasswordSqlDatabase &
|
|
20
|
+
EmailSqlDatabase &
|
|
21
|
+
ProofSqlDatabase,
|
|
22
|
+
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NativeDatabase } from "@yielded/auth-persistence/Adapter";
|
|
1
2
|
import type { LifecycleHooks } from "@yielded/auth/Hooks";
|
|
2
3
|
import {
|
|
3
4
|
OAuthConnectedPersistence,
|
|
@@ -9,6 +10,7 @@ import { Effect, Context } from "effect";
|
|
|
9
10
|
|
|
10
11
|
import { makeD1Owner } from "./d1-planning";
|
|
11
12
|
import { D1BatchStatements } from "./D1BatchStatements";
|
|
13
|
+
import { nativeDatabase } from "./native-database";
|
|
12
14
|
import type {
|
|
13
15
|
OAuthConnectedMapping,
|
|
14
16
|
OAuthConnectedRevocationMapping,
|
|
@@ -28,11 +30,13 @@ type TransactionOf<D> = D extends { readonly transaction: (...args: any[]) => an
|
|
|
28
30
|
const unavailable = () => OAuthUnavailable.make({});
|
|
29
31
|
|
|
30
32
|
export const makeOAuthConnectedTarget = <
|
|
33
|
+
DatabaseId,
|
|
31
34
|
Database,
|
|
32
35
|
Family extends Table,
|
|
33
36
|
Extra = {},
|
|
34
37
|
Synchronous extends boolean = false,
|
|
35
38
|
>(
|
|
39
|
+
databaseService: Context.Service<DatabaseId, Database>,
|
|
36
40
|
configuration: OAuthTargetConfiguration,
|
|
37
41
|
) => {
|
|
38
42
|
function coordinateOAuthConnected<
|
|
@@ -300,9 +304,11 @@ export const makeOAuthConnectedTarget = <
|
|
|
300
304
|
N,
|
|
301
305
|
J extends Family = never,
|
|
302
306
|
>(
|
|
303
|
-
database: Database,
|
|
304
307
|
mapping: OAuthConnectedMapping<S, AC, T, O, F, G, C, H, UA, DC, N, J> & Extra,
|
|
305
|
-
) =>
|
|
308
|
+
) =>
|
|
309
|
+
makeTargetOAuthConnectedServices(mapping, configuration).pipe(
|
|
310
|
+
Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService)),
|
|
311
|
+
),
|
|
306
312
|
makeOAuthConnectedRevocationServices: <
|
|
307
313
|
T extends Family,
|
|
308
314
|
O extends Family,
|
|
@@ -313,15 +319,18 @@ export const makeOAuthConnectedTarget = <
|
|
|
313
319
|
J extends Family,
|
|
314
320
|
N,
|
|
315
321
|
>(
|
|
316
|
-
database: Database,
|
|
317
322
|
mapping: OAuthConnectedRevocationMapping<T, O, F, G, C, H, J, N> & Extra,
|
|
318
|
-
) =>
|
|
323
|
+
) =>
|
|
324
|
+
makeTargetOAuthConnectedRevocationServices(mapping, configuration).pipe(
|
|
325
|
+
Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService)),
|
|
326
|
+
),
|
|
319
327
|
coordinateOAuthConnected,
|
|
320
328
|
coordinateOAuthConnectedRevocations,
|
|
321
329
|
};
|
|
322
330
|
};
|
|
323
331
|
|
|
324
|
-
export const makeD1OAuthConnectedTarget = <Database, Family extends Table, Extra>(
|
|
332
|
+
export const makeD1OAuthConnectedTarget = <DatabaseId, Database, Family extends Table, Extra>(
|
|
333
|
+
databaseService: Context.Service<DatabaseId, Database>,
|
|
325
334
|
configuration: OAuthTargetConfiguration,
|
|
326
335
|
) => {
|
|
327
336
|
function coordinateOAuthConnected<
|
|
@@ -461,7 +470,10 @@ export const makeD1OAuthConnectedTarget = <Database, Family extends Table, Extra
|
|
|
461
470
|
}
|
|
462
471
|
|
|
463
472
|
return {
|
|
464
|
-
...makeOAuthConnectedTarget<Database, Family, Extra>(
|
|
473
|
+
...makeOAuthConnectedTarget<DatabaseId, Database, Family, Extra>(
|
|
474
|
+
databaseService,
|
|
475
|
+
configuration,
|
|
476
|
+
),
|
|
465
477
|
coordinateOAuthConnected,
|
|
466
478
|
coordinateOAuthConnectedRevocations,
|
|
467
479
|
};
|
|
@@ -118,14 +118,16 @@ export const settle = Effect.fn("oauthConnected.settle")(function* (
|
|
|
118
118
|
const claimed = yield* F.exact(mapping, input.claim);
|
|
119
119
|
|
|
120
120
|
if (claimed === undefined) return { _tag: "Rejected" } as const;
|
|
121
|
+
const state = out._tag === "Unissued" ? "Rejected" : out._tag;
|
|
122
|
+
|
|
121
123
|
yield* F.terminal(
|
|
122
124
|
mapping,
|
|
123
125
|
input.claim,
|
|
124
|
-
|
|
125
|
-
out._tag === "Cancelled" ? "Resolved" : "Unresolved",
|
|
126
|
+
state,
|
|
127
|
+
out._tag === "Cancelled" || out._tag === "Unissued" ? "Resolved" : "Unresolved",
|
|
126
128
|
);
|
|
127
129
|
|
|
128
|
-
return { _tag:
|
|
130
|
+
return { _tag: state } as
|
|
129
131
|
| { readonly _tag: "Cancelled" }
|
|
130
132
|
| { readonly _tag: "Rejected" }
|
|
131
133
|
| { readonly _tag: "Conflict" }
|
|
@@ -322,13 +322,17 @@ export const settleSignIn = Effect.fn("oauthConnected.settleSignIn")(function* (
|
|
|
322
322
|
const held = yield* exact(mapping, r);
|
|
323
323
|
|
|
324
324
|
if (held === undefined) return { _tag: "Rejected" } as const;
|
|
325
|
+
// Unissued means the provider definitely returned no token. Resolve that
|
|
326
|
+
// reservation. A Rejected outcome can follow a real exchange, so it stays open.
|
|
327
|
+
const state = out._tag === "Unissued" ? "Rejected" : out._tag;
|
|
328
|
+
|
|
325
329
|
yield* owner.update(f.table, held.key, {
|
|
326
|
-
[f.state]:
|
|
327
|
-
[f.work]: out._tag === "Cancelled" ? "Resolved" : "Unresolved",
|
|
330
|
+
[f.state]: state,
|
|
331
|
+
[f.work]: out._tag === "Cancelled" || out._tag === "Unissued" ? "Resolved" : "Unresolved",
|
|
328
332
|
[f.version]: owner.marker,
|
|
329
333
|
});
|
|
330
334
|
|
|
331
|
-
return { _tag:
|
|
335
|
+
return { _tag: state };
|
|
332
336
|
}
|
|
333
337
|
const token = out.grant.context;
|
|
334
338
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { LifecycleHooks } from "@yielded/auth/Hooks";
|
|
2
1
|
import * as M from "@yielded/auth/OAuth";
|
|
3
2
|
import {
|
|
4
3
|
OAuthConnectedPersistence,
|
|
@@ -185,32 +184,24 @@ export const makeRevocations = (
|
|
|
185
184
|
);
|
|
186
185
|
|
|
187
186
|
export const makeTargetOAuthConnectedServices = (
|
|
188
|
-
database: any,
|
|
189
187
|
mapping: S.Mapping,
|
|
190
188
|
configuration: OAuthTargetConfiguration,
|
|
191
189
|
) => {
|
|
192
190
|
const retained = captured(mapping);
|
|
193
191
|
|
|
194
|
-
return Effect.map(
|
|
195
|
-
oauthConnectedPersistence: makeConnected(
|
|
196
|
-
retained,
|
|
197
|
-
makeOAuthExecution(database, hooks, configuration),
|
|
198
|
-
),
|
|
192
|
+
return Effect.map(makeOAuthExecution(configuration), (execution) => ({
|
|
193
|
+
oauthConnectedPersistence: makeConnected(retained, execution),
|
|
199
194
|
}));
|
|
200
195
|
};
|
|
201
196
|
|
|
202
197
|
export const makeTargetOAuthConnectedRevocationServices = (
|
|
203
|
-
database: any,
|
|
204
198
|
mapping: S.Revocations,
|
|
205
199
|
configuration: OAuthTargetConfiguration,
|
|
206
200
|
) => {
|
|
207
201
|
const retained = captured(mapping);
|
|
208
202
|
|
|
209
|
-
return Effect.map(
|
|
210
|
-
oauthConnectedRevocations: makeRevocations(
|
|
211
|
-
retained,
|
|
212
|
-
makeOAuthExecution(database, hooks, configuration),
|
|
213
|
-
),
|
|
203
|
+
return Effect.map(makeOAuthExecution(configuration), (execution) => ({
|
|
204
|
+
oauthConnectedRevocations: makeRevocations(retained, execution),
|
|
214
205
|
}));
|
|
215
206
|
};
|
|
216
207
|
|
|
@@ -256,16 +247,24 @@ export const coordinateTargetOAuthConnectedRevocations = <Transaction, A, E, R>(
|
|
|
256
247
|
owner,
|
|
257
248
|
);
|
|
258
249
|
|
|
259
|
-
export const oauthConnectedPersistenceLayer = (
|
|
260
|
-
services:
|
|
250
|
+
export const oauthConnectedPersistenceLayer = <E, R>(
|
|
251
|
+
services: Effect.Effect<
|
|
252
|
+
Effect.Success<ReturnType<typeof makeTargetOAuthConnectedServices>>,
|
|
253
|
+
E,
|
|
254
|
+
R
|
|
255
|
+
>,
|
|
261
256
|
) =>
|
|
262
257
|
Layer.effect(
|
|
263
258
|
OAuthConnectedPersistence,
|
|
264
259
|
Effect.map(services, (value) => value.oauthConnectedPersistence),
|
|
265
260
|
);
|
|
266
261
|
|
|
267
|
-
export const oauthConnectedRevocationsLayer = (
|
|
268
|
-
services:
|
|
262
|
+
export const oauthConnectedRevocationsLayer = <E, R>(
|
|
263
|
+
services: Effect.Effect<
|
|
264
|
+
Effect.Success<ReturnType<typeof makeTargetOAuthConnectedRevocationServices>>,
|
|
265
|
+
E,
|
|
266
|
+
R
|
|
267
|
+
>,
|
|
269
268
|
) =>
|
|
270
269
|
Layer.effect(
|
|
271
270
|
OAuthConnectedRevocations,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NativeDatabase } from "@yielded/auth-persistence/Adapter";
|
|
1
2
|
import type { LifecycleHooks } from "@yielded/auth/Hooks";
|
|
2
3
|
import {
|
|
3
4
|
OAuthAccountsPersistence,
|
|
@@ -7,6 +8,7 @@ import {
|
|
|
7
8
|
import type { Table } from "drizzle-orm";
|
|
8
9
|
import { Effect, Context } from "effect";
|
|
9
10
|
|
|
11
|
+
import { nativeDatabase } from "./native-database";
|
|
10
12
|
import { makeOAuthConnectedTarget } from "./oauth-connected-drivers";
|
|
11
13
|
import type {
|
|
12
14
|
OAuthAccountsMapping,
|
|
@@ -35,7 +37,13 @@ type TransactionOf<D> = D extends { readonly transaction: (...args: any[]) => an
|
|
|
35
37
|
: never;
|
|
36
38
|
|
|
37
39
|
/** Driver-specific entry points instantiate both the database and table family. */
|
|
38
|
-
export const makeOAuthTarget = <
|
|
40
|
+
export const makeOAuthTarget = <
|
|
41
|
+
DatabaseId,
|
|
42
|
+
D,
|
|
43
|
+
T extends Table,
|
|
44
|
+
Synchronous extends boolean = false,
|
|
45
|
+
>(
|
|
46
|
+
databaseService: Context.Service<DatabaseId, D>,
|
|
39
47
|
configuration: OAuthTargetConfiguration,
|
|
40
48
|
) => {
|
|
41
49
|
function coordinateOAuthSignIn<
|
|
@@ -516,7 +524,7 @@ export const makeOAuthTarget = <D, T extends Table, Synchronous extends boolean
|
|
|
516
524
|
}
|
|
517
525
|
|
|
518
526
|
return {
|
|
519
|
-
...makeOAuthConnectedTarget<D, T, {}, Synchronous>(configuration),
|
|
527
|
+
...makeOAuthConnectedTarget<DatabaseId, D, T, {}, Synchronous>(databaseService, configuration),
|
|
520
528
|
coordinateOAuthSignIn,
|
|
521
529
|
coordinateOAuthRegistrationIntents,
|
|
522
530
|
coordinateOAuthAccounts,
|
|
@@ -530,13 +538,17 @@ export const makeOAuthTarget = <D, T extends Table, Synchronous extends boolean
|
|
|
530
538
|
U extends T,
|
|
531
539
|
N,
|
|
532
540
|
>(
|
|
533
|
-
database: D,
|
|
534
541
|
mapping: OAuthAccountsMapping<S, O, C, AC, F, TA, U, N>,
|
|
535
|
-
) =>
|
|
542
|
+
) =>
|
|
543
|
+
makeTargetOAuthAccountsServices(mapping, configuration).pipe(
|
|
544
|
+
Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService)),
|
|
545
|
+
),
|
|
536
546
|
makeOAuthSignInServices: <S extends T, O extends T, C extends T, AC extends T, F extends T, N>(
|
|
537
|
-
database: D,
|
|
538
547
|
mapping: OAuthSignInMapping<S, O, C, AC, F, N>,
|
|
539
|
-
) =>
|
|
548
|
+
) =>
|
|
549
|
+
makeTargetOAuthSignInServices(mapping, configuration).pipe(
|
|
550
|
+
Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService)),
|
|
551
|
+
),
|
|
540
552
|
makeOAuthRegistrationIntentServices: <
|
|
541
553
|
S extends T,
|
|
542
554
|
O extends T,
|
|
@@ -547,9 +559,11 @@ export const makeOAuthTarget = <D, T extends Table, Synchronous extends boolean
|
|
|
547
559
|
I extends T,
|
|
548
560
|
N,
|
|
549
561
|
>(
|
|
550
|
-
database: D,
|
|
551
562
|
mapping: OAuthRegistrationIntentMapping<S, O, C, AC, F, TA, I, N>,
|
|
552
|
-
) =>
|
|
563
|
+
) =>
|
|
564
|
+
makeTargetOAuthRegistrationIntentServices(mapping, configuration).pipe(
|
|
565
|
+
Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService)),
|
|
566
|
+
),
|
|
553
567
|
makeOAuthRegistrationServices: <
|
|
554
568
|
Registration,
|
|
555
569
|
S extends T,
|
|
@@ -561,9 +575,11 @@ export const makeOAuthTarget = <D, T extends Table, Synchronous extends boolean
|
|
|
561
575
|
R extends T,
|
|
562
576
|
N,
|
|
563
577
|
>(
|
|
564
|
-
database: D,
|
|
565
578
|
mapping: OAuthRegistrationMapping<Registration, S, O, C, AC, TA, I, R, N>,
|
|
566
|
-
) =>
|
|
579
|
+
) =>
|
|
580
|
+
makeTargetOAuthRegistrationServices<Registration>(mapping, configuration).pipe(
|
|
581
|
+
Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService)),
|
|
582
|
+
),
|
|
567
583
|
coordinateOAuthRegistration,
|
|
568
584
|
};
|
|
569
585
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NativeDatabase } from "@yielded/auth-persistence/Adapter";
|
|
1
2
|
import { LifecycleHooks } from "@yielded/auth/Hooks";
|
|
2
3
|
import {
|
|
3
4
|
OAuthAccountRevision,
|
|
@@ -83,17 +84,16 @@ export type OAuthCoordinatorError<E> = TransactionCoordinatorError<E, OAuthUnava
|
|
|
83
84
|
export type OAuthExecution = TransactionExecution<OAuthUnavailable, CurrentOAuthTransaction, never>;
|
|
84
85
|
|
|
85
86
|
export const sqlClientOAuthStandaloneGuard = (
|
|
86
|
-
|
|
87
|
-
) => sqlClientTransactionStandaloneGuard(unavailable,
|
|
87
|
+
service: Parameters<typeof sqlClientTransactionStandaloneGuard>[1],
|
|
88
|
+
) => sqlClientTransactionStandaloneGuard(unavailable, service);
|
|
88
89
|
|
|
89
|
-
export const makeOAuthExecution = (
|
|
90
|
-
database: OAuthNativeDatabase,
|
|
91
|
-
hooks: LifecycleHooks["Service"],
|
|
90
|
+
export const makeOAuthExecution = Effect.fnUntraced(function* (
|
|
92
91
|
configuration: OAuthTargetConfiguration,
|
|
93
|
-
): OAuthExecution
|
|
94
|
-
const
|
|
92
|
+
): Effect.fn.Return<OAuthExecution, never, LifecycleHooks | NativeDatabase> {
|
|
93
|
+
const hooks = yield* LifecycleHooks;
|
|
94
|
+
|
|
95
|
+
const execution = yield* makeTransactionExecution(
|
|
95
96
|
CurrentOAuthTransaction,
|
|
96
|
-
database,
|
|
97
97
|
configuration,
|
|
98
98
|
unavailable,
|
|
99
99
|
nonce,
|
|
@@ -104,7 +104,7 @@ export const makeOAuthExecution = (
|
|
|
104
104
|
run: (operation, mutation) =>
|
|
105
105
|
execution.run(operation, mutation).pipe(Effect.provideService(LifecycleHooks, hooks)),
|
|
106
106
|
};
|
|
107
|
-
};
|
|
107
|
+
});
|
|
108
108
|
|
|
109
109
|
const prepareValue = <Value, A>(value: Value, prepare: PrepareOAuthCommit<Value, A>) =>
|
|
110
110
|
Effect.flatMap(CurrentOAuthTransaction, (owner) =>
|
|
@@ -388,47 +388,35 @@ export const makeOAuthRegistration = <Registration>(
|
|
|
388
388
|
);
|
|
389
389
|
|
|
390
390
|
export const makeTargetOAuthSignInServices = (
|
|
391
|
-
database: any,
|
|
392
391
|
mapping: any,
|
|
393
392
|
configuration: OAuthTargetConfiguration,
|
|
394
393
|
) => {
|
|
395
394
|
const captured = captureOAuthMapping(mapping);
|
|
396
395
|
|
|
397
|
-
return Effect.map(
|
|
398
|
-
oauthSignInPersistence: makeOAuthSignIn(
|
|
399
|
-
captured,
|
|
400
|
-
makeOAuthExecution(database, hooks, configuration),
|
|
401
|
-
),
|
|
396
|
+
return Effect.map(makeOAuthExecution(configuration), (execution) => ({
|
|
397
|
+
oauthSignInPersistence: makeOAuthSignIn(captured, execution),
|
|
402
398
|
}));
|
|
403
399
|
};
|
|
404
400
|
|
|
405
401
|
export const makeTargetOAuthRegistrationIntentServices = (
|
|
406
|
-
database: any,
|
|
407
402
|
mapping: any,
|
|
408
403
|
configuration: OAuthTargetConfiguration,
|
|
409
404
|
) => {
|
|
410
405
|
const captured = captureOAuthMapping(mapping);
|
|
411
406
|
|
|
412
|
-
return Effect.map(
|
|
413
|
-
oauthRegistrationIntents: makeOAuthRegistrationIntents(
|
|
414
|
-
captured,
|
|
415
|
-
makeOAuthExecution(database, hooks, configuration),
|
|
416
|
-
),
|
|
407
|
+
return Effect.map(makeOAuthExecution(configuration), (execution) => ({
|
|
408
|
+
oauthRegistrationIntents: makeOAuthRegistrationIntents(captured, execution),
|
|
417
409
|
}));
|
|
418
410
|
};
|
|
419
411
|
|
|
420
412
|
export const makeTargetOAuthRegistrationServices = <Registration>(
|
|
421
|
-
database: any,
|
|
422
413
|
mapping: any,
|
|
423
414
|
configuration: OAuthTargetConfiguration,
|
|
424
415
|
) => {
|
|
425
416
|
const captured = captureOAuthMapping(mapping);
|
|
426
417
|
|
|
427
|
-
return Effect.map(
|
|
428
|
-
registrationAuthority: makeOAuthRegistration<Registration>(
|
|
429
|
-
captured,
|
|
430
|
-
makeOAuthExecution(database, hooks, configuration),
|
|
431
|
-
),
|
|
418
|
+
return Effect.map(makeOAuthExecution(configuration), (execution) => ({
|
|
419
|
+
registrationAuthority: makeOAuthRegistration<Registration>(captured, execution),
|
|
432
420
|
}));
|
|
433
421
|
};
|
|
434
422
|
|
|
@@ -698,50 +686,50 @@ export const makeOAuthAccounts = (
|
|
|
698
686
|
);
|
|
699
687
|
|
|
700
688
|
export const makeTargetOAuthAccountsServices = (
|
|
701
|
-
database: any,
|
|
702
689
|
mapping: any,
|
|
703
690
|
configuration: OAuthTargetConfiguration,
|
|
704
691
|
) => {
|
|
705
692
|
const captured = captureOAuthMapping(mapping);
|
|
706
693
|
|
|
707
|
-
return Effect.map(
|
|
708
|
-
oauthAccountsPersistence: makeOAuthAccounts(
|
|
709
|
-
captured,
|
|
710
|
-
makeOAuthExecution(database, hooks, configuration),
|
|
711
|
-
),
|
|
694
|
+
return Effect.map(makeOAuthExecution(configuration), (execution) => ({
|
|
695
|
+
oauthAccountsPersistence: makeOAuthAccounts(captured, execution),
|
|
712
696
|
}));
|
|
713
697
|
};
|
|
714
698
|
|
|
715
|
-
export const oauthAccountsPersistenceLayer = (
|
|
716
|
-
services: ReturnType<typeof makeTargetOAuthAccountsServices>,
|
|
699
|
+
export const oauthAccountsPersistenceLayer = <E, R>(
|
|
700
|
+
services: Effect.Effect<Effect.Success<ReturnType<typeof makeTargetOAuthAccountsServices>>, E, R>,
|
|
717
701
|
) =>
|
|
718
702
|
Layer.effect(
|
|
719
703
|
OAuthAccountsPersistence,
|
|
720
704
|
Effect.map(services, (value) => value.oauthAccountsPersistence),
|
|
721
705
|
);
|
|
722
706
|
|
|
723
|
-
export const oauthSignInPersistenceLayer = (
|
|
724
|
-
services: ReturnType<typeof makeTargetOAuthSignInServices>,
|
|
707
|
+
export const oauthSignInPersistenceLayer = <E, R>(
|
|
708
|
+
services: Effect.Effect<Effect.Success<ReturnType<typeof makeTargetOAuthSignInServices>>, E, R>,
|
|
725
709
|
) =>
|
|
726
710
|
Layer.effect(
|
|
727
711
|
OAuthSignInPersistence,
|
|
728
712
|
Effect.map(services, (value) => value.oauthSignInPersistence),
|
|
729
713
|
);
|
|
730
714
|
|
|
731
|
-
export const oauthRegistrationIntentsLayer = (
|
|
732
|
-
services:
|
|
715
|
+
export const oauthRegistrationIntentsLayer = <E, R>(
|
|
716
|
+
services: Effect.Effect<
|
|
717
|
+
Effect.Success<ReturnType<typeof makeTargetOAuthRegistrationIntentServices>>,
|
|
718
|
+
E,
|
|
719
|
+
R
|
|
720
|
+
>,
|
|
733
721
|
) =>
|
|
734
722
|
Layer.effect(
|
|
735
723
|
OAuthRegistrationIntents,
|
|
736
724
|
Effect.map(services, (value) => value.oauthRegistrationIntents),
|
|
737
725
|
);
|
|
738
726
|
|
|
739
|
-
export const oauthRegistrationAuthorityLayer = <Id, Registration>(
|
|
727
|
+
export const oauthRegistrationAuthorityLayer = <Id, Registration, E, R>(
|
|
740
728
|
tag: Context.Key<Id, OAuthRegistrationAuthority<Registration>>,
|
|
741
729
|
services: Effect.Effect<
|
|
742
730
|
{ readonly registrationAuthority: OAuthRegistrationAuthority<Registration> },
|
|
743
|
-
|
|
744
|
-
|
|
731
|
+
E,
|
|
732
|
+
R
|
|
745
733
|
>,
|
|
746
734
|
) =>
|
|
747
735
|
Layer.effect(
|