@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
|
@@ -10,12 +10,19 @@ import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
|
10
10
|
import { Effect, Context } from "effect";
|
|
11
11
|
import type { SqlError } from "effect/sql/SqlError";
|
|
12
12
|
|
|
13
|
+
import { nativeDatabase } from "./native-database";
|
|
13
14
|
import type { ProofPersistenceMapping } from "./proof-model";
|
|
15
|
+
import { CurrentProofSql } from "./proof-sql";
|
|
14
16
|
import {
|
|
15
17
|
coordinateTargetProofPersistence,
|
|
16
18
|
makeTargetProofPersistenceServices,
|
|
17
19
|
type ProofTargetConfiguration,
|
|
18
20
|
} from "./proof-target";
|
|
21
|
+
import {
|
|
22
|
+
type TransactionService,
|
|
23
|
+
acquireTransactionService,
|
|
24
|
+
transactionService,
|
|
25
|
+
} from "./standalone-guard";
|
|
19
26
|
import type { SuppliedService } from "./SuppliedService";
|
|
20
27
|
|
|
21
28
|
type Database =
|
|
@@ -52,11 +59,25 @@ export const sqliteProofConfiguration = (
|
|
|
52
59
|
...(coordinatorGuard === undefined ? {} : { coordinatorGuard }),
|
|
53
60
|
});
|
|
54
61
|
|
|
55
|
-
export const makeSqliteProofTarget = <
|
|
56
|
-
|
|
62
|
+
export const makeSqliteProofTarget = <
|
|
63
|
+
DatabaseId,
|
|
64
|
+
D extends Database,
|
|
65
|
+
Synchronous extends boolean = false,
|
|
66
|
+
>(
|
|
67
|
+
databaseService: Context.Service<DatabaseId, D>,
|
|
68
|
+
configuration:
|
|
69
|
+
| ProofTargetConfiguration
|
|
70
|
+
| ((service: TransactionService | undefined) => ProofTargetConfiguration),
|
|
57
71
|
) => {
|
|
58
72
|
const configurationFor = (database: D) =>
|
|
59
|
-
typeof configuration === "function"
|
|
73
|
+
typeof configuration === "function"
|
|
74
|
+
? configuration(transactionService(database))
|
|
75
|
+
: configuration;
|
|
76
|
+
|
|
77
|
+
const standaloneConfiguration =
|
|
78
|
+
typeof configuration === "function"
|
|
79
|
+
? Effect.map(acquireTransactionService(databaseService), configuration)
|
|
80
|
+
: Effect.succeed(configuration);
|
|
60
81
|
|
|
61
82
|
function coordinateProofPersistence<
|
|
62
83
|
Database extends D,
|
|
@@ -194,9 +215,11 @@ export const makeSqliteProofTarget = <D extends Database, Synchronous extends bo
|
|
|
194
215
|
Cr extends AnySQLiteTable,
|
|
195
216
|
NativeId,
|
|
196
217
|
>(
|
|
197
|
-
database: D,
|
|
198
218
|
mapping: Mapping<Rq, S, G, Cn, Rs, A, F, C, Sub, I, Cr, NativeId>,
|
|
199
|
-
) =>
|
|
219
|
+
) =>
|
|
220
|
+
Effect.flatMap(standaloneConfiguration, (configuration) =>
|
|
221
|
+
makeTargetProofPersistenceServices(mapping, configuration),
|
|
222
|
+
).pipe(Effect.provideServiceEffect(CurrentProofSql, nativeDatabase(databaseService))),
|
|
200
223
|
coordinateProofPersistence,
|
|
201
224
|
};
|
|
202
225
|
};
|
|
@@ -18,12 +18,14 @@ import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
|
18
18
|
import { Context, Effect } from "effect";
|
|
19
19
|
import type { SqlError } from "effect/sql/SqlError";
|
|
20
20
|
|
|
21
|
+
import { nativeDatabase } from "./native-database";
|
|
21
22
|
import type {
|
|
22
23
|
AuthenticationAuthorityMapping,
|
|
23
24
|
PendingAuthenticationMapping,
|
|
24
25
|
SignedSessionValidityMapping,
|
|
25
26
|
StatefulSessionMapping,
|
|
26
27
|
} from "./session-model";
|
|
28
|
+
import { CurrentSessionSql } from "./session-sql";
|
|
27
29
|
import {
|
|
28
30
|
coordinateTargetAuthenticationAuthority,
|
|
29
31
|
coordinateTargetPendingAuthentication,
|
|
@@ -37,6 +39,11 @@ import {
|
|
|
37
39
|
makeTargetSessionStepUpServices,
|
|
38
40
|
coordinateTargetSessionStepUp,
|
|
39
41
|
} from "./session-target";
|
|
42
|
+
import {
|
|
43
|
+
type TransactionService,
|
|
44
|
+
acquireTransactionService,
|
|
45
|
+
transactionService,
|
|
46
|
+
} from "./standalone-guard";
|
|
40
47
|
import type { SuppliedService } from "./SuppliedService";
|
|
41
48
|
|
|
42
49
|
type Database =
|
|
@@ -66,10 +73,9 @@ export const makeSqliteAuthenticationAuthorityServices = <
|
|
|
66
73
|
P extends AnySQLiteTable,
|
|
67
74
|
NativeId,
|
|
68
75
|
>(
|
|
69
|
-
database: Database,
|
|
70
76
|
mapping: AuthenticationAuthorityMapping<Claims, S, C, F, P, NativeId>,
|
|
71
77
|
configuration: SessionTargetConfiguration,
|
|
72
|
-
) => makeTargetAuthenticationAuthorityServices<Claims>(
|
|
78
|
+
) => makeTargetAuthenticationAuthorityServices<Claims>(mapping, configuration);
|
|
73
79
|
|
|
74
80
|
export const makeSqlitePendingAuthenticationServices = <
|
|
75
81
|
Claims,
|
|
@@ -79,10 +85,9 @@ export const makeSqlitePendingAuthenticationServices = <
|
|
|
79
85
|
F extends AnySQLiteTable,
|
|
80
86
|
NativeId,
|
|
81
87
|
>(
|
|
82
|
-
database: Database,
|
|
83
88
|
mapping: PendingAuthenticationMapping<Claims, S, C, P, F, NativeId>,
|
|
84
89
|
configuration: SessionTargetConfiguration,
|
|
85
|
-
) => makeTargetPendingAuthenticationServices<Claims>(
|
|
90
|
+
) => makeTargetPendingAuthenticationServices<Claims>(mapping, configuration);
|
|
86
91
|
|
|
87
92
|
export const makeSqliteStatefulSessionServices = <
|
|
88
93
|
Claims,
|
|
@@ -94,10 +99,9 @@ export const makeSqliteStatefulSessionServices = <
|
|
|
94
99
|
NativeId,
|
|
95
100
|
NativeSessionId,
|
|
96
101
|
>(
|
|
97
|
-
database: Database,
|
|
98
102
|
mapping: StatefulSessionMapping<Claims, S, C, Session, F, P, NativeId, NativeSessionId>,
|
|
99
103
|
configuration: SessionTargetConfiguration,
|
|
100
|
-
) => makeTargetStatefulSessionServices<Claims>(
|
|
104
|
+
) => makeTargetStatefulSessionServices<Claims>(mapping, configuration);
|
|
101
105
|
|
|
102
106
|
export const makeSqliteSignedSessionValidityServices = <
|
|
103
107
|
S extends AnySQLiteTable,
|
|
@@ -105,10 +109,9 @@ export const makeSqliteSignedSessionValidityServices = <
|
|
|
105
109
|
NativeId,
|
|
106
110
|
NativeSessionId,
|
|
107
111
|
>(
|
|
108
|
-
database: Database,
|
|
109
112
|
mapping: SignedSessionValidityMapping<S, T, NativeId, NativeSessionId>,
|
|
110
113
|
configuration: SessionTargetConfiguration,
|
|
111
|
-
) => makeTargetSignedSessionValidityServices(
|
|
114
|
+
) => makeTargetSignedSessionValidityServices(mapping, configuration);
|
|
112
115
|
|
|
113
116
|
export const coordinateSqliteAuthenticationAuthority = <
|
|
114
117
|
Claims,
|
|
@@ -221,11 +224,25 @@ export const coordinateSqliteSignedSessionValidity = <
|
|
|
221
224
|
owner,
|
|
222
225
|
);
|
|
223
226
|
|
|
224
|
-
export const makeSqliteSessionTarget = <
|
|
225
|
-
|
|
227
|
+
export const makeSqliteSessionTarget = <
|
|
228
|
+
DatabaseId,
|
|
229
|
+
D extends Database,
|
|
230
|
+
Synchronous extends boolean = false,
|
|
231
|
+
>(
|
|
232
|
+
databaseService: Context.Service<DatabaseId, D>,
|
|
233
|
+
configuration:
|
|
234
|
+
| SessionTargetConfiguration
|
|
235
|
+
| ((service: TransactionService | undefined) => SessionTargetConfiguration),
|
|
226
236
|
) => {
|
|
227
237
|
const configurationFor = (database: D) =>
|
|
228
|
-
typeof configuration === "function"
|
|
238
|
+
typeof configuration === "function"
|
|
239
|
+
? configuration(transactionService(database))
|
|
240
|
+
: configuration;
|
|
241
|
+
|
|
242
|
+
const standaloneConfiguration =
|
|
243
|
+
typeof configuration === "function"
|
|
244
|
+
? Effect.map(acquireTransactionService(databaseService), configuration)
|
|
245
|
+
: Effect.succeed(configuration);
|
|
229
246
|
|
|
230
247
|
function coordinateSessionStepUp<
|
|
231
248
|
Database extends D,
|
|
@@ -854,7 +871,6 @@ export const makeSqliteSessionTarget = <D extends Database, Synchronous extends
|
|
|
854
871
|
NativeId,
|
|
855
872
|
NativeSessionId,
|
|
856
873
|
>(
|
|
857
|
-
database: D,
|
|
858
874
|
mapping: SessionStepUpMapping<
|
|
859
875
|
NoInfer<Claims>,
|
|
860
876
|
S,
|
|
@@ -866,7 +882,10 @@ export const makeSqliteSessionTarget = <D extends Database, Synchronous extends
|
|
|
866
882
|
NativeSessionId
|
|
867
883
|
>,
|
|
868
884
|
target: Context.Service<Id, SessionStepUpPersistence<Claims>>,
|
|
869
|
-
) =>
|
|
885
|
+
) =>
|
|
886
|
+
Effect.flatMap(standaloneConfiguration, (configuration) =>
|
|
887
|
+
makeSqliteSessionStepUpServices(mapping, target, configuration),
|
|
888
|
+
).pipe(Effect.provideServiceEffect(CurrentSessionSql, nativeDatabase(databaseService))),
|
|
870
889
|
coordinateSessionStepUp,
|
|
871
890
|
makeAuthenticationAuthorityServices: <
|
|
872
891
|
Claims,
|
|
@@ -876,9 +895,11 @@ export const makeSqliteSessionTarget = <D extends Database, Synchronous extends
|
|
|
876
895
|
P extends AnySQLiteTable,
|
|
877
896
|
NativeId,
|
|
878
897
|
>(
|
|
879
|
-
database: D,
|
|
880
898
|
mapping: AuthenticationAuthorityMapping<Claims, S, C, F, P, NativeId>,
|
|
881
|
-
) =>
|
|
899
|
+
) =>
|
|
900
|
+
Effect.flatMap(standaloneConfiguration, (configuration) =>
|
|
901
|
+
makeSqliteAuthenticationAuthorityServices(mapping, configuration),
|
|
902
|
+
).pipe(Effect.provideServiceEffect(CurrentSessionSql, nativeDatabase(databaseService))),
|
|
882
903
|
makePendingAuthenticationServices: <
|
|
883
904
|
Claims,
|
|
884
905
|
S extends AnySQLiteTable,
|
|
@@ -887,9 +908,11 @@ export const makeSqliteSessionTarget = <D extends Database, Synchronous extends
|
|
|
887
908
|
F extends AnySQLiteTable,
|
|
888
909
|
NativeId,
|
|
889
910
|
>(
|
|
890
|
-
database: D,
|
|
891
911
|
mapping: PendingAuthenticationMapping<Claims, S, C, P, F, NativeId>,
|
|
892
|
-
) =>
|
|
912
|
+
) =>
|
|
913
|
+
Effect.flatMap(standaloneConfiguration, (configuration) =>
|
|
914
|
+
makeSqlitePendingAuthenticationServices(mapping, configuration),
|
|
915
|
+
).pipe(Effect.provideServiceEffect(CurrentSessionSql, nativeDatabase(databaseService))),
|
|
893
916
|
makeStatefulSessionServices: <
|
|
894
917
|
Claims,
|
|
895
918
|
S extends AnySQLiteTable,
|
|
@@ -900,18 +923,22 @@ export const makeSqliteSessionTarget = <D extends Database, Synchronous extends
|
|
|
900
923
|
NativeId,
|
|
901
924
|
NativeSessionId,
|
|
902
925
|
>(
|
|
903
|
-
database: D,
|
|
904
926
|
mapping: StatefulSessionMapping<Claims, S, C, Session, F, P, NativeId, NativeSessionId>,
|
|
905
|
-
) =>
|
|
927
|
+
) =>
|
|
928
|
+
Effect.flatMap(standaloneConfiguration, (configuration) =>
|
|
929
|
+
makeSqliteStatefulSessionServices(mapping, configuration),
|
|
930
|
+
).pipe(Effect.provideServiceEffect(CurrentSessionSql, nativeDatabase(databaseService))),
|
|
906
931
|
makeSignedSessionValidityServices: <
|
|
907
932
|
S extends AnySQLiteTable,
|
|
908
933
|
T extends AnySQLiteTable,
|
|
909
934
|
NativeId,
|
|
910
935
|
NativeSessionId,
|
|
911
936
|
>(
|
|
912
|
-
database: D,
|
|
913
937
|
mapping: SignedSessionValidityMapping<S, T, NativeId, NativeSessionId>,
|
|
914
|
-
) =>
|
|
938
|
+
) =>
|
|
939
|
+
Effect.flatMap(standaloneConfiguration, (configuration) =>
|
|
940
|
+
makeSqliteSignedSessionValidityServices(mapping, configuration),
|
|
941
|
+
).pipe(Effect.provideServiceEffect(CurrentSessionSql, nativeDatabase(databaseService))),
|
|
915
942
|
coordinateAuthenticationAuthority,
|
|
916
943
|
coordinatePendingAuthentication,
|
|
917
944
|
coordinateStatefulSessions,
|
|
@@ -932,11 +959,10 @@ export const makeSqliteSessionStepUpServices = <
|
|
|
932
959
|
NativeId,
|
|
933
960
|
NativeSessionId,
|
|
934
961
|
>(
|
|
935
|
-
database: Database,
|
|
936
962
|
mapping: SessionStepUpMapping<NoInfer<Claims>, S, C, I, Session, T, NativeId, NativeSessionId>,
|
|
937
963
|
target: Context.Service<Id, SessionStepUpPersistence<Claims>>,
|
|
938
964
|
configuration: SessionTargetConfiguration,
|
|
939
|
-
) => makeTargetSessionStepUpServices(
|
|
965
|
+
) => makeTargetSessionStepUpServices(mapping, target, configuration);
|
|
940
966
|
|
|
941
967
|
export const coordinateSqliteSessionStepUp = <
|
|
942
968
|
Claims,
|
|
@@ -2,12 +2,12 @@ import { requireStandalone } from "@yielded/auth-persistence/Adapter";
|
|
|
2
2
|
import { Context, Effect, Predicate } from "effect";
|
|
3
3
|
import type * as SqlClient from "effect/sql/SqlClient";
|
|
4
4
|
|
|
5
|
-
type TransactionService = Context.Key<
|
|
5
|
+
export type TransactionService = Context.Key<
|
|
6
6
|
SqlClient.TransactionConnection,
|
|
7
7
|
SqlClient.TransactionConnection.Service
|
|
8
8
|
>;
|
|
9
9
|
|
|
10
|
-
const transactionService = (database: unknown): TransactionService | undefined => {
|
|
10
|
+
export const transactionService = (database: unknown): TransactionService | undefined => {
|
|
11
11
|
if (
|
|
12
12
|
!Predicate.hasProperty(database, "$client") ||
|
|
13
13
|
!Predicate.hasProperty(database.$client, "transactionService") ||
|
|
@@ -19,14 +19,26 @@ const transactionService = (database: unknown): TransactionService | undefined =
|
|
|
19
19
|
return database.$client.transactionService;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
/** Capture the foreign client's marker while acquiring standalone services. */
|
|
23
|
+
export const acquireTransactionService = <Id, Database>(service: Context.Key<Id, Database>) =>
|
|
24
|
+
Effect.map(Effect.service(service), (database): TransactionService | undefined => {
|
|
25
|
+
if (
|
|
26
|
+
!Predicate.hasProperty(database, "$client") ||
|
|
27
|
+
!Predicate.hasProperty(database.$client, "transactionService") ||
|
|
28
|
+
!Context.isKey(database.$client.transactionService)
|
|
29
|
+
) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return database.$client.transactionService;
|
|
34
|
+
});
|
|
35
|
+
|
|
22
36
|
/** Bind the client-specific transaction marker at foreign adapter construction. */
|
|
23
37
|
export const sqlClientStandaloneGuard = <Failure>(
|
|
24
|
-
|
|
38
|
+
service: TransactionService | undefined,
|
|
25
39
|
unavailable: () => Failure,
|
|
26
40
|
): Effect.Effect<void, Failure> => {
|
|
27
|
-
const service = transactionService(database);
|
|
28
|
-
|
|
29
41
|
if (service === undefined) return Effect.suspend(() => Effect.fail(unavailable()));
|
|
30
42
|
|
|
31
|
-
return requireStandalone(unavailable,
|
|
43
|
+
return requireStandalone(unavailable, service);
|
|
32
44
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { randomId } from "@yielded/auth-crypto";
|
|
2
|
+
import { NativeDatabase } from "@yielded/auth-persistence/Adapter";
|
|
2
3
|
import { LifecycleHooks } from "@yielded/auth/Hooks";
|
|
3
4
|
import {
|
|
4
5
|
TotpConfigurationError,
|
|
@@ -13,6 +14,7 @@ import { Context, Effect, Schema } from "effect";
|
|
|
13
14
|
import type { Statement } from "effect/sql/Statement";
|
|
14
15
|
|
|
15
16
|
import type { PersistenceMappingError } from "./model";
|
|
17
|
+
import { nativeDatabase } from "./native-database";
|
|
16
18
|
import type { SuppliedService } from "./SuppliedService";
|
|
17
19
|
import {
|
|
18
20
|
type TotpMapping,
|
|
@@ -44,8 +46,8 @@ export type TotpCoordinatorError<E> =
|
|
|
44
46
|
| PersistenceMappingError;
|
|
45
47
|
|
|
46
48
|
export const sqlClientTotpStandaloneGuard = (
|
|
47
|
-
|
|
48
|
-
) => sqlClientTransactionStandaloneGuard(unavailable,
|
|
49
|
+
service: Parameters<typeof sqlClientTransactionStandaloneGuard>[1],
|
|
50
|
+
) => sqlClientTransactionStandaloneGuard(unavailable, service);
|
|
49
51
|
|
|
50
52
|
const validateMapping = <M>(original: M, configuration: TotpTargetConfiguration): M => {
|
|
51
53
|
const mapping = original as any;
|
|
@@ -66,55 +68,58 @@ const validateMapping = <M>(original: M, configuration: TotpTargetConfiguration)
|
|
|
66
68
|
});
|
|
67
69
|
};
|
|
68
70
|
|
|
69
|
-
const services = (
|
|
71
|
+
const services = Effect.fnUntraced(function* (
|
|
70
72
|
mapping: any,
|
|
71
73
|
execution: TransactionExecution<TotpUnavailable, CurrentTotpTransaction>,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
totpPersistence: TotpPersistence.of({
|
|
75
|
-
snapshot: Effect.fn("TotpNative.snapshot")(
|
|
76
|
-
function* (input) {
|
|
77
|
-
const captured = { ...input };
|
|
74
|
+
): Effect.fn.Return<TotpPersistenceServices, never, LifecycleHooks> {
|
|
75
|
+
const hooks = yield* LifecycleHooks;
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
return {
|
|
78
|
+
totpPersistence: TotpPersistence.of({
|
|
79
|
+
snapshot: Effect.fn("TotpNative.snapshot")(
|
|
80
|
+
function* (input) {
|
|
81
|
+
const captured = { ...input };
|
|
82
|
+
|
|
83
|
+
invariant(captured.moduleId === mapping.moduleId);
|
|
84
|
+
yield* execution.admit;
|
|
81
85
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
return yield* execution
|
|
87
|
+
.run(
|
|
88
|
+
Effect.map(captureTotp(mapping, captured.subjectId), (value) => value?.snapshot),
|
|
89
|
+
false,
|
|
90
|
+
)
|
|
91
|
+
.pipe(Effect.provideService(LifecycleHooks, hooks));
|
|
92
|
+
},
|
|
93
|
+
Effect.catchDefect(() => Effect.fail(unavailable())),
|
|
94
|
+
),
|
|
95
|
+
mutate: (original, prepare) =>
|
|
96
|
+
Effect.suspend(() => {
|
|
97
|
+
// Detach caller-owned payloads before any driver or hook can suspend.
|
|
98
|
+
const codec = Schema.toCodecIso(TotpMutation);
|
|
99
|
+
const input = Schema.decodeSync(codec)(Schema.encodeSync(codec)(original));
|
|
96
100
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
return execution.admit.pipe(
|
|
102
|
+
Effect.andThen(
|
|
103
|
+
execution.run(
|
|
104
|
+
Effect.gen(function* () {
|
|
105
|
+
const decision = yield* mutateTotp(mapping, input),
|
|
106
|
+
owner = yield* CurrentTotpTransaction;
|
|
103
107
|
|
|
104
|
-
|
|
105
|
-
|
|
108
|
+
owner.guards.push(owner.journal.prepare(undefined));
|
|
109
|
+
const receipt = prepare(decision, owner.journal);
|
|
106
110
|
|
|
107
|
-
|
|
108
|
-
|
|
111
|
+
invariant(receipt?._tag === "PreparedCommit" && Effect.isEffect(receipt.read));
|
|
112
|
+
owner.guards.push(receipt as any);
|
|
109
113
|
|
|
110
|
-
|
|
111
|
-
|
|
114
|
+
return receipt;
|
|
115
|
+
}),
|
|
116
|
+
),
|
|
112
117
|
),
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
+
Effect.provideService(LifecycleHooks, hooks),
|
|
119
|
+
);
|
|
120
|
+
}).pipe(Effect.catchDefect(() => Effect.fail(unavailable()))),
|
|
121
|
+
}),
|
|
122
|
+
};
|
|
118
123
|
});
|
|
119
124
|
|
|
120
125
|
export const makeTargetTotpPersistence = <
|
|
@@ -124,12 +129,10 @@ export const makeTargetTotpPersistence = <
|
|
|
124
129
|
N,
|
|
125
130
|
RSetup = never,
|
|
126
131
|
>(
|
|
127
|
-
database: TransactionNativeDatabase,
|
|
128
132
|
source: TotpMappingSource<TotpMapping<S, F, C, N>, RSetup>,
|
|
129
133
|
configuration: TotpTargetConfiguration,
|
|
130
134
|
) =>
|
|
131
135
|
Effect.gen(function* () {
|
|
132
|
-
const hooks = yield* LifecycleHooks;
|
|
133
136
|
const original = yield* Effect.isEffect(source) ? source : Effect.succeed(source);
|
|
134
137
|
|
|
135
138
|
const mapping = yield* Effect.try({
|
|
@@ -137,15 +140,14 @@ export const makeTargetTotpPersistence = <
|
|
|
137
140
|
catch: () => TotpConfigurationError.make({}),
|
|
138
141
|
});
|
|
139
142
|
|
|
140
|
-
const execution = makeTransactionExecution(
|
|
143
|
+
const execution = yield* makeTransactionExecution(
|
|
141
144
|
CurrentTotpTransaction,
|
|
142
|
-
database,
|
|
143
145
|
configuration,
|
|
144
146
|
unavailable,
|
|
145
147
|
randomId,
|
|
146
148
|
);
|
|
147
149
|
|
|
148
|
-
return services(mapping, execution
|
|
150
|
+
return yield* services(mapping, execution);
|
|
149
151
|
});
|
|
150
152
|
|
|
151
153
|
export const coordinateTargetTotp = <M, A, E, R, RSetup = never>(
|
|
@@ -159,7 +161,6 @@ export const coordinateTargetTotp = <M, A, E, R, RSetup = never>(
|
|
|
159
161
|
) => Effect.Effect<A, E, R>,
|
|
160
162
|
): Effect.Effect<A, TotpCoordinatorError<E>, R | RSetup | LifecycleHooks> =>
|
|
161
163
|
Effect.gen(function* () {
|
|
162
|
-
const hooks = yield* LifecycleHooks;
|
|
163
164
|
const original = yield* Effect.isEffect(source) ? source : Effect.succeed(source);
|
|
164
165
|
|
|
165
166
|
const mapping = yield* Effect.try({
|
|
@@ -174,8 +175,11 @@ export const coordinateTargetTotp = <M, A, E, R, RSetup = never>(
|
|
|
174
175
|
Effect.void,
|
|
175
176
|
unavailable,
|
|
176
177
|
randomId,
|
|
177
|
-
(execution) => services(mapping, execution
|
|
178
|
-
|
|
178
|
+
(execution) => services(mapping, execution),
|
|
179
|
+
(transaction, acquireServices, append) =>
|
|
180
|
+
Effect.flatMap(acquireServices, (boundServices) =>
|
|
181
|
+
body(transaction, boundServices, append),
|
|
182
|
+
),
|
|
179
183
|
);
|
|
180
184
|
});
|
|
181
185
|
|
|
@@ -185,11 +189,13 @@ type TransactionOf<D> = D extends { readonly transaction: (...args: any[]) => an
|
|
|
185
189
|
|
|
186
190
|
/** Concrete driver wrappers select transaction mode; cryptography always precedes these owners. */
|
|
187
191
|
export const makeTotpTarget = <
|
|
192
|
+
DatabaseId,
|
|
188
193
|
D extends { readonly transaction: any },
|
|
189
194
|
T extends Table,
|
|
190
195
|
Extra = unknown,
|
|
191
196
|
Synchronous extends boolean = false,
|
|
192
197
|
>(
|
|
198
|
+
databaseService: Context.Service<DatabaseId, D>,
|
|
193
199
|
configuration: TotpTargetConfiguration,
|
|
194
200
|
) => {
|
|
195
201
|
function coordinateTotpPersistence<
|
|
@@ -292,17 +298,12 @@ export const makeTotpTarget = <
|
|
|
292
298
|
}
|
|
293
299
|
|
|
294
300
|
return {
|
|
295
|
-
makeTotpPersistenceServices: <
|
|
296
|
-
Database extends D,
|
|
297
|
-
S extends T,
|
|
298
|
-
F extends T,
|
|
299
|
-
C extends T,
|
|
300
|
-
N,
|
|
301
|
-
RSetup = never,
|
|
302
|
-
>(
|
|
303
|
-
database: Database,
|
|
301
|
+
makeTotpPersistenceServices: <S extends T, F extends T, C extends T, N, RSetup = never>(
|
|
304
302
|
mapping: TotpMappingSource<TotpMapping<S, F, C, N> & Extra, RSetup>,
|
|
305
|
-
) =>
|
|
303
|
+
) =>
|
|
304
|
+
makeTargetTotpPersistence(mapping, configuration).pipe(
|
|
305
|
+
Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService)),
|
|
306
|
+
),
|
|
306
307
|
coordinateTotpPersistence,
|
|
307
308
|
};
|
|
308
309
|
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { D1ExternalIdentityMapping, D1SubjectProvisioningMapping } from "./model.mjs";
|
|
2
|
-
import { ExternalIdentity, IdentityConflict, IdentityUnavailable, SubjectProvisioningInput } from "@yielded/auth/Identity";
|
|
3
|
-
import { AnyRelations } from "drizzle-orm";
|
|
4
|
-
import { Effect } from "effect";
|
|
5
|
-
import { SubjectId } from "@yielded/auth/Schema";
|
|
6
|
-
import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
7
|
-
import { D1Client } from "@effect/sql-d1/D1Client";
|
|
8
|
-
import { EffectSQLiteD1Database } from "drizzle-orm/effect-d1";
|
|
9
|
-
//#region src/drizzle/d1-identity.d.ts
|
|
10
|
-
/**
|
|
11
|
-
* D1 provisioning is an ordered atomic batch. The receipt captures the
|
|
12
|
-
* database-generated subject id from the first insert via last_insert_rowid;
|
|
13
|
-
* the optional identifier then reads that stable id from the receipt.
|
|
14
|
-
*/
|
|
15
|
-
export declare const makeD1SubjectProvisioningServices: <Subject extends AnySQLiteTable, Identifier extends AnySQLiteTable, Request extends AnySQLiteTable, NativeId>(database: EffectSQLiteD1Database<AnyRelations> & {
|
|
16
|
-
readonly $client: D1Client;
|
|
17
|
-
}, mapping: D1SubjectProvisioningMapping<Subject, Identifier, Request, NativeId>) => {
|
|
18
|
-
readonly subjectProvisioner: {
|
|
19
|
-
readonly provision: (input: SubjectProvisioningInput) => Effect.Effect<import("@yielded/auth/Identity").ProvisioningResult, IdentityConflict | IdentityUnavailable>;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export declare const makeD1ExternalIdentityServices: <Subject extends AnySQLiteTable, External extends AnySQLiteTable, NativeId>(database: EffectSQLiteD1Database<AnyRelations> & {
|
|
23
|
-
readonly $client: D1Client;
|
|
24
|
-
}, mapping: D1ExternalIdentityMapping<Subject, External, NativeId>) => {
|
|
25
|
-
readonly externalIdentityMutation: {
|
|
26
|
-
readonly bind: (subjectId: SubjectId, identity: ExternalIdentity) => Effect.Effect<void, IdentityConflict | IdentityUnavailable>;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
//#endregion
|
|
30
|
-
//# sourceMappingURL=d1-identity.d.mts.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ExternalIdentityTables, SubjectProvisioningTables } from "./model.mjs";
|
|
2
|
-
import { ExternalIdentity, IdentityConflict, IdentityUnavailable, SubjectProvisioningInput } from "@yielded/auth/Identity";
|
|
3
|
-
import { AnyRelations } from "drizzle-orm";
|
|
4
|
-
import { Effect } from "effect";
|
|
5
|
-
import { SubjectId } from "@yielded/auth/Schema";
|
|
6
|
-
import { EffectMysql2Database } from "drizzle-orm/effect-mysql2";
|
|
7
|
-
import { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
8
|
-
//#region src/drizzle/mysql-identity.d.ts
|
|
9
|
-
type Database = EffectMysql2Database<AnyRelations>;
|
|
10
|
-
export declare const makeMysqlSubjectProvisioningServices: <Subject extends AnyMySqlTable, Identifier extends AnyMySqlTable, Request extends AnyMySqlTable, NativeId>(database: Database, mapping: SubjectProvisioningTables<Subject, Identifier, Request, NativeId>) => {
|
|
11
|
-
readonly subjectProvisioner: {
|
|
12
|
-
readonly provision: (input: SubjectProvisioningInput) => Effect.Effect<import("@yielded/auth/Identity").ProvisioningResult, IdentityConflict | IdentityUnavailable>;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export declare const makeMysqlExternalIdentityServices: <Subject extends AnyMySqlTable, External extends AnyMySqlTable, NativeId>(database: Database, mapping: ExternalIdentityTables<Subject, External, NativeId>) => {
|
|
16
|
-
readonly externalIdentityMutation: {
|
|
17
|
-
readonly bind: (subjectId: SubjectId, identity: ExternalIdentity) => Effect.Effect<void, IdentityConflict | IdentityUnavailable>;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
//#endregion
|
|
21
|
-
//# sourceMappingURL=mysql-identity.d.mts.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ExternalIdentityTables, SubjectProvisioningTables } from "./model.mjs";
|
|
2
|
-
import { ExternalIdentity, IdentityConflict, IdentityUnavailable, SubjectProvisioningInput } from "@yielded/auth/Identity";
|
|
3
|
-
import { AnyRelations } from "drizzle-orm";
|
|
4
|
-
import { Effect } from "effect";
|
|
5
|
-
import { SubjectId } from "@yielded/auth/Schema";
|
|
6
|
-
import { EffectPgDatabase } from "drizzle-orm/effect-pglite";
|
|
7
|
-
import { AnyPgTable } from "drizzle-orm/pg-core";
|
|
8
|
-
import { EffectPgDatabase as EffectPgDatabase$1 } from "drizzle-orm/effect-postgres";
|
|
9
|
-
//#region src/drizzle/pg-identity.d.ts
|
|
10
|
-
type Database = EffectPgDatabase$1<AnyRelations> | EffectPgDatabase<AnyRelations>;
|
|
11
|
-
export declare const makePgSubjectProvisioningServices: <Subject extends AnyPgTable, Identifier extends AnyPgTable, Request extends AnyPgTable, NativeId>(database: Database, mapping: SubjectProvisioningTables<Subject, Identifier, Request, NativeId>) => {
|
|
12
|
-
readonly subjectProvisioner: {
|
|
13
|
-
readonly provision: (input: SubjectProvisioningInput) => Effect.Effect<import("@yielded/auth/Identity").ProvisioningResult, IdentityConflict | IdentityUnavailable>;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export declare const makePgExternalIdentityServices: <Subject extends AnyPgTable, External extends AnyPgTable, NativeId>(database: Database, mapping: ExternalIdentityTables<Subject, External, NativeId>) => {
|
|
17
|
-
readonly externalIdentityMutation: {
|
|
18
|
-
readonly bind: (subjectId: SubjectId, identity: ExternalIdentity) => Effect.Effect<void, IdentityConflict | IdentityUnavailable>;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
//#endregion
|
|
22
|
-
//# sourceMappingURL=pg-identity.d.mts.map
|