@yielded/auth-persistence-drizzle 0.1.0-beta.0 → 0.1.0-beta.1
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 +6 -1
- package/dist/D1.d.mts +135 -25
- package/dist/D1.mjs +1 -3
- package/dist/D1.mjs.map +1 -1
- package/dist/Libsql.d.mts +192 -75
- package/dist/Libsql.mjs +1 -7
- package/dist/Libsql.mjs.map +1 -1
- package/dist/Mysql2.d.mts +177 -37
- package/dist/Mysql2.mjs +1 -3
- package/dist/Mysql2.mjs.map +1 -1
- package/dist/Pglite.d.mts +171 -30
- package/dist/Pglite.mjs +2 -3
- package/dist/Pglite.mjs.map +1 -1
- package/dist/Postgres.d.mts +177 -36
- package/dist/Postgres.mjs +2 -3
- package/dist/Postgres.mjs.map +1 -1
- package/dist/SqliteBun.d.mts +192 -74
- package/dist/SqliteBun.mjs +1 -5
- package/dist/SqliteBun.mjs.map +1 -1
- package/dist/SqliteDo.d.mts +194 -110
- package/dist/SqliteDo.mjs +2 -32
- package/dist/SqliteDo.mjs.map +1 -1
- package/dist/SqliteNode.d.mts +190 -72
- package/dist/SqliteNode.mjs +1 -5
- package/dist/SqliteNode.mjs.map +1 -1
- package/dist/SqliteWasm.d.mts +192 -74
- package/dist/SqliteWasm.mjs +1 -5
- package/dist/SqliteWasm.mjs.map +1 -1
- package/dist/drizzle/D1BatchStatements.d.mts +1 -1
- package/dist/drizzle/D1BatchStatements.mjs.map +1 -1
- package/dist/drizzle/d1-emails.mjs.map +1 -1
- package/dist/drizzle/d1-generated-statement.mjs.map +1 -1
- package/dist/drizzle/d1-identity.d.mts +1 -1
- package/dist/drizzle/d1-oauth.d.mts +35 -5
- package/dist/drizzle/d1-oauth.mjs +1 -1
- package/dist/drizzle/d1-password-prepared.mjs.map +1 -1
- package/dist/drizzle/d1-passwords.d.mts +1 -1
- package/dist/drizzle/d1-passwords.mjs.map +1 -1
- package/dist/drizzle/d1-proofs.d.mts +1 -1
- package/dist/drizzle/d1-proofs.mjs.map +1 -1
- package/dist/drizzle/d1-sessions.d.mts +3 -3
- package/dist/drizzle/d1-sessions.mjs.map +1 -1
- package/dist/drizzle/email-registration.d.mts +1 -1
- package/dist/drizzle/email-target.d.mts +1 -1
- package/dist/drizzle/email-target.mjs.map +1 -1
- package/dist/drizzle/model.d.mts +2 -126
- package/dist/drizzle/model.mjs +2 -21
- package/dist/drizzle/model.mjs.map +1 -1
- package/dist/drizzle/mysql-emails.d.mts +1 -1
- package/dist/drizzle/mysql-emails.mjs.map +1 -1
- package/dist/drizzle/mysql-identity.d.mts +1 -1
- package/dist/drizzle/mysql-password-prepared.d.mts +1 -1
- package/dist/drizzle/mysql-password-prepared.mjs.map +1 -1
- package/dist/drizzle/mysql-passwords.d.mts +1 -1
- package/dist/drizzle/mysql-passwords.mjs.map +1 -1
- package/dist/drizzle/mysql-proofs.d.mts +1 -1
- package/dist/drizzle/mysql-proofs.mjs.map +1 -1
- package/dist/drizzle/mysql-sessions.d.mts +1 -1
- package/dist/drizzle/mysql-sessions.mjs.map +1 -1
- package/dist/drizzle/oauth-accounts.mjs +1 -1
- package/dist/drizzle/oauth-connected-access.mjs +14 -12
- package/dist/drizzle/oauth-connected-access.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-custody.mjs +2 -2
- package/dist/drizzle/oauth-connected-drivers.mjs +4 -1
- package/dist/drizzle/oauth-connected-drivers.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-flow.mjs +2 -2
- package/dist/drizzle/oauth-connected-input.mjs +14 -1
- package/dist/drizzle/oauth-connected-input.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-maintenance.mjs +1 -1
- package/dist/drizzle/oauth-connected-management.mjs +2 -2
- package/dist/drizzle/oauth-connected-model.d.mts +17 -3
- package/dist/drizzle/oauth-connected-model.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-settlement.mjs +51 -41
- package/dist/drizzle/oauth-connected-settlement.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-sign-in.mjs +263 -0
- package/dist/drizzle/oauth-connected-sign-in.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-state.d.mts +110 -2
- package/dist/drizzle/oauth-connected-state.mjs +9 -4
- package/dist/drizzle/oauth-connected-state.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-target.d.mts +137 -9
- package/dist/drizzle/oauth-connected-target.mjs +6 -2
- package/dist/drizzle/oauth-connected-target.mjs.map +1 -1
- package/dist/drizzle/oauth-drivers.mjs +1 -1
- package/dist/drizzle/oauth-flow.d.mts +1 -1
- package/dist/drizzle/oauth-flow.mjs +1 -1
- package/dist/drizzle/oauth-input.mjs +1 -1
- package/dist/drizzle/oauth-model.d.mts +1 -1
- package/dist/drizzle/oauth-owner.d.mts +1 -1
- package/dist/drizzle/oauth-registration.d.mts +2 -2
- package/dist/drizzle/oauth-registration.mjs +1 -1
- package/dist/drizzle/oauth-state.mjs +5 -4
- package/dist/drizzle/oauth-state.mjs.map +1 -1
- package/dist/drizzle/oauth-target.d.mts +2 -2
- package/dist/drizzle/oauth-target.mjs +1 -1
- package/dist/drizzle/oauth-target.mjs.map +1 -1
- package/dist/drizzle/passkey-write-target.d.mts +1 -1
- package/dist/drizzle/password-prepared-state.mjs +1 -1
- package/dist/drizzle/password-prepared-target.d.mts +1 -1
- package/dist/drizzle/password-prepared-target.mjs.map +1 -1
- package/dist/drizzle/password-target.d.mts +1 -1
- package/dist/drizzle/password-target.mjs.map +1 -1
- package/dist/drizzle/pg-emails.d.mts +1 -1
- package/dist/drizzle/pg-emails.mjs.map +1 -1
- package/dist/drizzle/pg-identity.d.mts +22 -0
- package/dist/drizzle/pg-identity.mjs +89 -0
- package/dist/drizzle/pg-identity.mjs.map +1 -0
- package/dist/drizzle/pg-password-prepared.d.mts +1 -1
- package/dist/drizzle/pg-password-prepared.mjs.map +1 -1
- package/dist/drizzle/pg-passwords.d.mts +1 -1
- package/dist/drizzle/pg-passwords.mjs.map +1 -1
- package/dist/drizzle/pg-proofs.d.mts +1 -1
- package/dist/drizzle/pg-proofs.mjs.map +1 -1
- package/dist/drizzle/pg-sessions.d.mts +1 -1
- package/dist/drizzle/pg-sessions.mjs.map +1 -1
- package/dist/drizzle/phone-model.d.mts +1 -1
- package/dist/drizzle/phone-target.d.mts +1 -1
- package/dist/drizzle/phone-target.mjs.map +1 -1
- package/dist/drizzle/proof-target.d.mts +1 -1
- package/dist/drizzle/proof-target.mjs.map +1 -1
- package/dist/drizzle/session-target.d.mts +1 -1
- package/dist/drizzle/session-target.mjs.map +1 -1
- package/dist/drizzle/sqlite-emails.mjs.map +1 -1
- package/dist/drizzle/sqlite-password-prepared.mjs.map +1 -1
- package/dist/drizzle/sqlite-passwords.mjs.map +1 -1
- package/dist/drizzle/sqlite-proofs.mjs.map +1 -1
- package/dist/drizzle/sqlite-sessions.mjs.map +1 -1
- package/dist/drizzle/standalone-guard.mjs.map +1 -1
- package/dist/drizzle/totp-model.d.mts +1 -1
- package/dist/drizzle/totp-target.d.mts +1 -1
- package/dist/drizzle/totp-target.mjs.map +1 -1
- package/dist/drizzle/transaction-mysql.mjs +1 -1
- package/dist/drizzle/transaction-mysql.mjs.map +1 -1
- package/dist/index.d.mts +2 -4
- package/dist/index.mjs +2 -4
- package/dist/internal/drizzle-postgres.mjs.map +1 -1
- package/dist/internal/drizzle-sqlite.mjs.map +1 -1
- package/package.json +1 -1
- package/src/D1.ts +1 -17
- package/src/Libsql.ts +0 -44
- package/src/Mysql2.ts +1 -23
- package/src/Pglite.ts +2 -18
- package/src/Postgres.ts +2 -18
- package/src/SqliteBun.ts +1 -38
- package/src/SqliteDo.ts +1 -256
- package/src/SqliteNode.ts +1 -38
- package/src/SqliteWasm.ts +1 -38
- package/src/drizzle/D1BatchStatements.ts +1 -1
- package/src/drizzle/d1-emails.ts +2 -4
- package/src/drizzle/d1-generated-statement.ts +1 -1
- package/src/drizzle/d1-password-prepared.ts +2 -5
- package/src/drizzle/d1-passwords.ts +2 -4
- package/src/drizzle/d1-proofs.ts +2 -4
- package/src/drizzle/d1-sessions.ts +2 -2
- package/src/drizzle/email-target.ts +1 -1
- package/src/drizzle/model.ts +1 -208
- package/src/drizzle/mysql-emails.ts +1 -1
- package/src/drizzle/mysql-password-prepared.ts +1 -1
- package/src/drizzle/mysql-passwords.ts +1 -1
- package/src/drizzle/mysql-proofs.ts +1 -1
- package/src/drizzle/mysql-sessions.ts +1 -1
- package/src/drizzle/oauth-connected-access.ts +8 -1
- package/src/drizzle/oauth-connected-drivers.ts +3 -0
- package/src/drizzle/oauth-connected-input.ts +13 -0
- package/src/drizzle/oauth-connected-model.ts +17 -0
- package/src/drizzle/oauth-connected-settlement.ts +65 -42
- package/src/drizzle/oauth-connected-sign-in.ts +438 -0
- package/src/drizzle/oauth-connected-state.ts +19 -7
- package/src/drizzle/oauth-connected-target.ts +10 -1
- package/src/drizzle/oauth-state.ts +5 -4
- package/src/drizzle/oauth-target.ts +1 -1
- package/src/drizzle/password-prepared-target.ts +1 -1
- package/src/drizzle/password-target.ts +1 -1
- package/src/drizzle/pg-emails.ts +1 -1
- package/src/drizzle/pg-identity.ts +301 -0
- package/src/drizzle/pg-password-prepared.ts +1 -1
- package/src/drizzle/pg-passwords.ts +1 -1
- package/src/drizzle/pg-proofs.ts +1 -1
- package/src/drizzle/pg-sessions.ts +1 -1
- package/src/drizzle/phone-target.ts +1 -1
- package/src/drizzle/proof-target.ts +1 -1
- package/src/drizzle/session-target.ts +1 -1
- package/src/drizzle/sqlite-emails.ts +1 -1
- package/src/drizzle/sqlite-password-prepared.ts +1 -1
- package/src/drizzle/sqlite-passwords.ts +1 -1
- package/src/drizzle/sqlite-proofs.ts +1 -1
- package/src/drizzle/sqlite-sessions.ts +1 -1
- package/src/drizzle/standalone-guard.ts +1 -1
- package/src/drizzle/totp-target.ts +1 -1
- package/src/drizzle/transaction-mysql.ts +1 -1
- package/src/index.ts +0 -24
- package/src/internal/drizzle-postgres.ts +1 -1
- package/src/internal/drizzle-sqlite.ts +1 -1
- package/dist/drizzle/mysql.d.mts +0 -69
- package/dist/drizzle/mysql.mjs +0 -218
- package/dist/drizzle/mysql.mjs.map +0 -1
- package/dist/drizzle/pg.d.mts +0 -80
- package/dist/drizzle/pg.mjs +0 -289
- package/dist/drizzle/pg.mjs.map +0 -1
- package/dist/drizzle/sqlite.d.mts +0 -77
- package/dist/drizzle/sqlite.mjs +0 -217
- package/dist/drizzle/sqlite.mjs.map +0 -1
- package/src/drizzle/mysql.ts +0 -687
- package/src/drizzle/pg.ts +0 -984
- package/src/drizzle/sqlite.ts +0 -705
package/src/SqliteNode.ts
CHANGED
|
@@ -3,30 +3,12 @@ import { type EffectSQLiteNodeDatabase, makeWithDefaults } from "drizzle-orm/eff
|
|
|
3
3
|
import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
|
|
6
|
+
import { sqlClientEmailStandaloneGuard } from "./drizzle/email-target";
|
|
6
7
|
import type {
|
|
7
|
-
AuthStoreTables,
|
|
8
|
-
AuthTables,
|
|
9
8
|
ExternalIdentityTables,
|
|
10
9
|
IdentityTables,
|
|
11
|
-
OAuthStateTables,
|
|
12
10
|
SubjectProvisioningTables,
|
|
13
11
|
} from "./drizzle/model";
|
|
14
|
-
import {
|
|
15
|
-
coordinateSqliteAuthStoreTransaction,
|
|
16
|
-
coordinateSqliteAuthTransaction,
|
|
17
|
-
coordinateSqliteOAuthStateTransaction,
|
|
18
|
-
makeSqliteAuthServices,
|
|
19
|
-
makeSqliteAuthStoreServices,
|
|
20
|
-
makeSqliteOAuthStateServices,
|
|
21
|
-
} from "./drizzle/sqlite";
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
coordinateSqliteAuthStoreTransaction as coordinateAuthStoreTransaction,
|
|
25
|
-
coordinateSqliteAuthTransaction as coordinateAuthTransaction,
|
|
26
|
-
coordinateSqliteOAuthStateTransaction as coordinateOAuthStateTransaction,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
import { sqlClientEmailStandaloneGuard } from "./drizzle/email-target";
|
|
30
12
|
import { sqlClientPasswordStandaloneGuard } from "./drizzle/password-target";
|
|
31
13
|
import { sqlClientProofStandaloneGuard } from "./drizzle/proof-target";
|
|
32
14
|
import { sqlClientSessionStandaloneGuard } from "./drizzle/session-target";
|
|
@@ -97,25 +79,6 @@ export const {
|
|
|
97
79
|
|
|
98
80
|
export const commitMode = "interactive" as const;
|
|
99
81
|
|
|
100
|
-
export const makeAuthStoreServices = <C extends AnySQLiteTable, R extends AnySQLiteTable>(
|
|
101
|
-
database: EffectSQLiteNodeDatabase<AnyRelations>,
|
|
102
|
-
mapping: AuthStoreTables<C, R>,
|
|
103
|
-
) => makeSqliteAuthStoreServices(database, mapping);
|
|
104
|
-
|
|
105
|
-
export const makeOAuthStateServices = <S extends AnySQLiteTable>(
|
|
106
|
-
database: EffectSQLiteNodeDatabase<AnyRelations>,
|
|
107
|
-
mapping: OAuthStateTables<S>,
|
|
108
|
-
) => makeSqliteOAuthStateServices(database, mapping);
|
|
109
|
-
|
|
110
|
-
export const makeAuthServices = <
|
|
111
|
-
C extends AnySQLiteTable,
|
|
112
|
-
R extends AnySQLiteTable,
|
|
113
|
-
S extends AnySQLiteTable,
|
|
114
|
-
>(
|
|
115
|
-
database: EffectSQLiteNodeDatabase<AnyRelations>,
|
|
116
|
-
mapping: AuthTables<C, R, S>,
|
|
117
|
-
) => makeSqliteAuthServices(database, mapping);
|
|
118
|
-
|
|
119
82
|
export const makeIdentityServices = <
|
|
120
83
|
Subject extends AnySQLiteTable,
|
|
121
84
|
Identifier extends AnySQLiteTable,
|
package/src/SqliteWasm.ts
CHANGED
|
@@ -3,30 +3,12 @@ import { type EffectSQLiteWasmDatabase, makeWithDefaults } from "drizzle-orm/eff
|
|
|
3
3
|
import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
|
|
6
|
+
import { sqlClientEmailStandaloneGuard } from "./drizzle/email-target";
|
|
6
7
|
import type {
|
|
7
|
-
AuthStoreTables,
|
|
8
|
-
AuthTables,
|
|
9
8
|
ExternalIdentityTables,
|
|
10
9
|
IdentityTables,
|
|
11
|
-
OAuthStateTables,
|
|
12
10
|
SubjectProvisioningTables,
|
|
13
11
|
} from "./drizzle/model";
|
|
14
|
-
import {
|
|
15
|
-
coordinateSqliteAuthStoreTransaction,
|
|
16
|
-
coordinateSqliteAuthTransaction,
|
|
17
|
-
coordinateSqliteOAuthStateTransaction,
|
|
18
|
-
makeSqliteAuthServices,
|
|
19
|
-
makeSqliteAuthStoreServices,
|
|
20
|
-
makeSqliteOAuthStateServices,
|
|
21
|
-
} from "./drizzle/sqlite";
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
coordinateSqliteAuthStoreTransaction as coordinateAuthStoreTransaction,
|
|
25
|
-
coordinateSqliteAuthTransaction as coordinateAuthTransaction,
|
|
26
|
-
coordinateSqliteOAuthStateTransaction as coordinateOAuthStateTransaction,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
import { sqlClientEmailStandaloneGuard } from "./drizzle/email-target";
|
|
30
12
|
import { sqlClientPasswordStandaloneGuard } from "./drizzle/password-target";
|
|
31
13
|
import { sqlClientProofStandaloneGuard } from "./drizzle/proof-target";
|
|
32
14
|
import { sqlClientSessionStandaloneGuard } from "./drizzle/session-target";
|
|
@@ -97,25 +79,6 @@ export const {
|
|
|
97
79
|
|
|
98
80
|
export const commitMode = "interactive" as const;
|
|
99
81
|
|
|
100
|
-
export const makeAuthStoreServices = <C extends AnySQLiteTable, R extends AnySQLiteTable>(
|
|
101
|
-
database: EffectSQLiteWasmDatabase<AnyRelations>,
|
|
102
|
-
mapping: AuthStoreTables<C, R>,
|
|
103
|
-
) => makeSqliteAuthStoreServices(database, mapping);
|
|
104
|
-
|
|
105
|
-
export const makeOAuthStateServices = <S extends AnySQLiteTable>(
|
|
106
|
-
database: EffectSQLiteWasmDatabase<AnyRelations>,
|
|
107
|
-
mapping: OAuthStateTables<S>,
|
|
108
|
-
) => makeSqliteOAuthStateServices(database, mapping);
|
|
109
|
-
|
|
110
|
-
export const makeAuthServices = <
|
|
111
|
-
C extends AnySQLiteTable,
|
|
112
|
-
R extends AnySQLiteTable,
|
|
113
|
-
S extends AnySQLiteTable,
|
|
114
|
-
>(
|
|
115
|
-
database: EffectSQLiteWasmDatabase<AnyRelations>,
|
|
116
|
-
mapping: AuthTables<C, R, S>,
|
|
117
|
-
) => makeSqliteAuthServices(database, mapping);
|
|
118
|
-
|
|
119
82
|
export const makeIdentityServices = <
|
|
120
83
|
Subject extends AnySQLiteTable,
|
|
121
84
|
Identifier extends AnySQLiteTable,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context, type Effect } from "effect";
|
|
2
|
-
import type { Statement } from "effect/
|
|
2
|
+
import type { Statement } from "effect/sql/Statement";
|
|
3
3
|
|
|
4
4
|
/** Appends application statements to the current coordinator's single atomic batch. */
|
|
5
5
|
export class D1BatchStatements extends Context.Service<
|
package/src/drizzle/d1-emails.ts
CHANGED
|
@@ -35,7 +35,7 @@ import type { EffectDrizzleQueryError } from "drizzle-orm/effect-core";
|
|
|
35
35
|
import type { EffectSQLiteD1Database } from "drizzle-orm/effect-d1";
|
|
36
36
|
import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
37
37
|
import { Schema, Cause, DateTime, Effect, Option, Context } from "effect";
|
|
38
|
-
import type { Statement } from "effect/
|
|
38
|
+
import type { Statement } from "effect/sql/Statement";
|
|
39
39
|
|
|
40
40
|
import { CurrentD1PlanningDatabase, makeD1Owner } from "./d1-planning";
|
|
41
41
|
import { compileD1ProofCompletionPlan } from "./d1-proofs";
|
|
@@ -1797,9 +1797,7 @@ const executeStandalone = <A, E, R>(
|
|
|
1797
1797
|
retries = 2,
|
|
1798
1798
|
): Effect.Effect<
|
|
1799
1799
|
A,
|
|
1800
|
-
|
|
|
1801
|
-
| import("@yielded/auth/Hooks").HookConfigurationError
|
|
1802
|
-
| import("effect/unstable/sql/SqlError").SqlError,
|
|
1800
|
+
E | import("@yielded/auth/Hooks").HookConfigurationError | import("effect/sql/SqlError").SqlError,
|
|
1803
1801
|
Exclude<R, CurrentCommitJournal> | CurrentD1PlanningDatabase | LifecycleHooks
|
|
1804
1802
|
> =>
|
|
1805
1803
|
Effect.suspend(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { sql, type SQL } from "drizzle-orm";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
|
-
import type { Statement } from "effect/
|
|
3
|
+
import type { Statement } from "effect/sql/Statement";
|
|
4
4
|
|
|
5
5
|
// oxlint-disable-next-line no-restricted-properties -- Statement.compile exposes untyped native SQL parameters.
|
|
6
6
|
const valuesJson = Schema.encodeUnknownSync(
|
|
@@ -30,7 +30,7 @@ import { eq, is, isNotNull, lte, or, SQL, sql, type AnyRelations, type Table } f
|
|
|
30
30
|
import type { EffectSQLiteD1Database } from "drizzle-orm/effect-d1";
|
|
31
31
|
import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
32
32
|
import { Cause, DateTime, Effect, Predicate, Redacted, Schema, Context } from "effect";
|
|
33
|
-
import type { Statement } from "effect/
|
|
33
|
+
import type { Statement } from "effect/sql/Statement";
|
|
34
34
|
|
|
35
35
|
import { balancedD1And as and, compactD1GeneratedStatement } from "./d1-generated-statement";
|
|
36
36
|
import { passwordD1Kernel as kernel } from "./d1-passwords";
|
|
@@ -791,10 +791,7 @@ const makePreparedPlans = (mapping: Mapping, proofMapping?: any) => {
|
|
|
791
791
|
Effect.catchCause(
|
|
792
792
|
(
|
|
793
793
|
cause,
|
|
794
|
-
): Effect.Effect<
|
|
795
|
-
never,
|
|
796
|
-
PasswordRejected | import("effect/unstable/sql/SqlError").SqlError
|
|
797
|
-
> =>
|
|
794
|
+
): Effect.Effect<never, PasswordRejected | import("effect/sql/SqlError").SqlError> =>
|
|
798
795
|
everyFailureMatches(cause, (failure) =>
|
|
799
796
|
kernel.isGuardFailure(
|
|
800
797
|
failure,
|
|
@@ -54,7 +54,7 @@ import type { EffectDrizzleQueryError } from "drizzle-orm/effect-core";
|
|
|
54
54
|
import type { EffectSQLiteD1Database } from "drizzle-orm/effect-d1";
|
|
55
55
|
import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
56
56
|
import { Cause, DateTime, Effect, Option, Predicate, Redacted, Schema, Context } from "effect";
|
|
57
|
-
import type { Statement } from "effect/
|
|
57
|
+
import type { Statement } from "effect/sql/Statement";
|
|
58
58
|
|
|
59
59
|
import { balancedD1And } from "./d1-generated-statement";
|
|
60
60
|
import { CurrentD1PlanningDatabase, makeD1Owner } from "./d1-planning";
|
|
@@ -2624,9 +2624,7 @@ const executeStandalone = <A, E, R>(
|
|
|
2624
2624
|
retries = 2,
|
|
2625
2625
|
): Effect.Effect<
|
|
2626
2626
|
A,
|
|
2627
|
-
|
|
|
2628
|
-
| import("@yielded/auth/Hooks").HookConfigurationError
|
|
2629
|
-
| import("effect/unstable/sql/SqlError").SqlError,
|
|
2627
|
+
E | import("@yielded/auth/Hooks").HookConfigurationError | import("effect/sql/SqlError").SqlError,
|
|
2630
2628
|
Exclude<R, CurrentCommitJournal> | CurrentD1PlanningDatabase | LifecycleHooks
|
|
2631
2629
|
> =>
|
|
2632
2630
|
Effect.suspend(() => {
|
package/src/drizzle/d1-proofs.ts
CHANGED
|
@@ -45,7 +45,7 @@ import type { EffectDrizzleQueryError } from "drizzle-orm/effect-core";
|
|
|
45
45
|
import type { EffectSQLiteD1Database } from "drizzle-orm/effect-d1";
|
|
46
46
|
import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
47
47
|
import { Cause, Effect, Schema, Context } from "effect";
|
|
48
|
-
import type { Statement } from "effect/
|
|
48
|
+
import type { Statement } from "effect/sql/Statement";
|
|
49
49
|
|
|
50
50
|
import { balancedD1And } from "./d1-generated-statement";
|
|
51
51
|
import { CurrentD1PlanningDatabase, makeD1Owner } from "./d1-planning";
|
|
@@ -2273,9 +2273,7 @@ const executeStandalone = <A, E, R>(
|
|
|
2273
2273
|
retries = 2,
|
|
2274
2274
|
): Effect.Effect<
|
|
2275
2275
|
A,
|
|
2276
|
-
|
|
|
2277
|
-
| import("@yielded/auth/Hooks").HookConfigurationError
|
|
2278
|
-
| import("effect/unstable/sql/SqlError").SqlError,
|
|
2276
|
+
E | import("@yielded/auth/Hooks").HookConfigurationError | import("effect/sql/SqlError").SqlError,
|
|
2279
2277
|
Exclude<R, CurrentCommitJournal> | CurrentD1PlanningDatabase | LifecycleHooks
|
|
2280
2278
|
> =>
|
|
2281
2279
|
Effect.suspend(() => {
|
|
@@ -49,8 +49,8 @@ import { and, eq, getTableColumns, gt, inArray, not, or, sql, type SQL } from "d
|
|
|
49
49
|
import type { EffectDrizzleQueryError } from "drizzle-orm/effect-core";
|
|
50
50
|
import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
51
51
|
import { Cause, Context, Data, DateTime, Effect, Schema } from "effect";
|
|
52
|
-
import type * as SqlError from "effect/
|
|
53
|
-
import type { Statement } from "effect/
|
|
52
|
+
import type * as SqlError from "effect/sql/SqlError";
|
|
53
|
+
import type { Statement } from "effect/sql/Statement";
|
|
54
54
|
|
|
55
55
|
import { compactD1GeneratedStatement } from "./d1-generated-statement";
|
|
56
56
|
import {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@yielded/auth/Hooks";
|
|
8
8
|
/* oxlint-disable no-explicit-any -- public driver wrappers restore concrete Drizzle generics. */
|
|
9
9
|
import { type Context, Effect, Layer } from "effect";
|
|
10
|
-
import type * as SqlError from "effect/
|
|
10
|
+
import type * as SqlError from "effect/sql/SqlError";
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
makeSqlEmailRegistrationAuthority,
|
package/src/drizzle/model.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { requireStandalone } from "@yielded/auth-persistence/Adapter";
|
|
2
|
-
import { AuthStore } from "@yielded/auth/AuthStore";
|
|
3
|
-
import { AuthStoreError } from "@yielded/auth/Errors";
|
|
4
1
|
import {
|
|
5
2
|
ExternalIdentityMutation,
|
|
6
3
|
SubjectProvisioner,
|
|
@@ -8,48 +5,11 @@ import {
|
|
|
8
5
|
type ExternalIdentity,
|
|
9
6
|
type LoginIdentifier,
|
|
10
7
|
} from "@yielded/auth/Identity";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
type ConsumeChallenge,
|
|
14
|
-
type NewChallenge,
|
|
15
|
-
type NewRegistration,
|
|
16
|
-
type PendingRegistration,
|
|
17
|
-
} from "@yielded/auth/Schema";
|
|
18
|
-
import {
|
|
19
|
-
getTableColumns,
|
|
20
|
-
type AnyColumn,
|
|
21
|
-
type InferInsertModel,
|
|
22
|
-
type InferSelectModel,
|
|
23
|
-
type Table,
|
|
24
|
-
} from "drizzle-orm";
|
|
8
|
+
import { getTableColumns, type AnyColumn, type InferInsertModel, type Table } from "drizzle-orm";
|
|
25
9
|
import { Context, DateTime, Effect, Layer } from "effect";
|
|
26
|
-
import type * as SqlClient from "effect/unstable/sql/SqlClient";
|
|
27
10
|
|
|
28
11
|
export type CommitMode = "interactive" | "synchronous" | "batch";
|
|
29
12
|
|
|
30
|
-
/**
|
|
31
|
-
* Ordinary error-channel consumes must own their commit. Coordinated callers
|
|
32
|
-
* use the decision methods inside their outer transaction and translate only
|
|
33
|
-
* after that owner commits.
|
|
34
|
-
*/
|
|
35
|
-
export interface SqlClientTransactionDatabase {
|
|
36
|
-
readonly $client: Pick<SqlClient.SqlClient, "transactionService">;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const requireStandaloneConsume = (
|
|
40
|
-
database: SqlClientTransactionDatabase,
|
|
41
|
-
): Effect.Effect<void, AuthStoreError> =>
|
|
42
|
-
requireStandalone(
|
|
43
|
-
() =>
|
|
44
|
-
AuthStoreError.make({
|
|
45
|
-
message: "Use the decision consume API inside an outer database transaction",
|
|
46
|
-
}),
|
|
47
|
-
database.$client,
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
export type { ChallengeConsumeDecision } from "@yielded/auth/Persistence";
|
|
51
|
-
export type { ConsumeDecision } from "@yielded/auth/AuthStore";
|
|
52
|
-
|
|
53
13
|
export {
|
|
54
14
|
PersistenceMappingError,
|
|
55
15
|
isMappedConstraintConflict,
|
|
@@ -62,156 +22,8 @@ export interface InstantCodec<NativeInstant> {
|
|
|
62
22
|
readonly decode: (native: NativeInstant) => Effect.Effect<DateTime.Utc, PersistenceMappingError>;
|
|
63
23
|
}
|
|
64
24
|
|
|
65
|
-
export interface RequiredAuthStoreConstraints {
|
|
66
|
-
readonly series: "unique(namespace,value,purpose)";
|
|
67
|
-
readonly challengeDigest: "unique(tokenDigest)";
|
|
68
|
-
readonly registrationDigest: "unique(tokenDigest)";
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface RequiredOAuthStateConstraints {
|
|
72
|
-
readonly oauthStateDigest: "unique(stateDigest)";
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface RequiredAuthConstraints
|
|
76
|
-
extends RequiredAuthStoreConstraints, RequiredOAuthStateConstraints {}
|
|
77
|
-
|
|
78
|
-
export const requiredAuthConstraints: RequiredAuthConstraints = {
|
|
79
|
-
series: "unique(namespace,value,purpose)",
|
|
80
|
-
challengeDigest: "unique(tokenDigest)",
|
|
81
|
-
registrationDigest: "unique(tokenDigest)",
|
|
82
|
-
oauthStateDigest: "unique(stateDigest)",
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export const requiredAuthStoreConstraints: RequiredAuthStoreConstraints = {
|
|
86
|
-
series: "unique(namespace,value,purpose)",
|
|
87
|
-
challengeDigest: "unique(tokenDigest)",
|
|
88
|
-
registrationDigest: "unique(tokenDigest)",
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export const requiredOAuthStateConstraints: RequiredOAuthStateConstraints = {
|
|
92
|
-
oauthStateDigest: "unique(stateDigest)",
|
|
93
|
-
};
|
|
94
|
-
|
|
95
25
|
type ColumnKey<T extends Table> = Extract<keyof T["_"]["columns"], string>;
|
|
96
26
|
|
|
97
|
-
export interface ChallengeRecord {
|
|
98
|
-
readonly challenge: NewChallenge;
|
|
99
|
-
readonly namespace: string;
|
|
100
|
-
readonly failedAttempts: number;
|
|
101
|
-
readonly consumed: boolean;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface ChallengeColumns<T extends Table> {
|
|
105
|
-
readonly challengeId: ColumnKey<T>;
|
|
106
|
-
readonly tokenDigest: ColumnKey<T>;
|
|
107
|
-
readonly namespace: ColumnKey<T>;
|
|
108
|
-
readonly value: ColumnKey<T>;
|
|
109
|
-
readonly purpose: ColumnKey<T>;
|
|
110
|
-
readonly otpKeyId: ColumnKey<T>;
|
|
111
|
-
readonly otpDigest: ColumnKey<T>;
|
|
112
|
-
readonly issuedAt: ColumnKey<T>;
|
|
113
|
-
readonly expiresAt: ColumnKey<T>;
|
|
114
|
-
readonly attemptLimit: ColumnKey<T>;
|
|
115
|
-
readonly failedAttempts: ColumnKey<T>;
|
|
116
|
-
readonly consumed: ColumnKey<T>;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Inputs are immutable server-created issuances. Replacements must advance
|
|
121
|
-
* issuedAt; equal or older issuances fail even after consumption or expiry.
|
|
122
|
-
* Instant encoding must preserve this ordering. Retain the series row as an
|
|
123
|
-
* issuance watermark until every previously accepted issuance has expired;
|
|
124
|
-
* current-row expiry alone is insufficient if historical lifetimes were longer.
|
|
125
|
-
*/
|
|
126
|
-
export interface ChallengeTableMapping<T extends Table> {
|
|
127
|
-
readonly table: T;
|
|
128
|
-
readonly columns: ChallengeColumns<T>;
|
|
129
|
-
readonly identifierNamespace: string;
|
|
130
|
-
readonly encodeInstant: (instant: DateTime.Utc) => unknown;
|
|
131
|
-
readonly encodeInsert: (
|
|
132
|
-
input: NewChallenge,
|
|
133
|
-
state: {
|
|
134
|
-
readonly namespace: string;
|
|
135
|
-
readonly failedAttempts: number;
|
|
136
|
-
readonly consumed: false;
|
|
137
|
-
},
|
|
138
|
-
) => InferInsertModel<T>;
|
|
139
|
-
readonly encodeUpdate: (
|
|
140
|
-
input: NewChallenge,
|
|
141
|
-
state: {
|
|
142
|
-
readonly namespace: string;
|
|
143
|
-
readonly failedAttempts: unknown;
|
|
144
|
-
readonly consumed: false;
|
|
145
|
-
},
|
|
146
|
-
) => Readonly<Record<string, unknown>>;
|
|
147
|
-
readonly decode: (
|
|
148
|
-
row: InferSelectModel<T>,
|
|
149
|
-
) => Effect.Effect<ChallengeRecord, PersistenceMappingError>;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface RegistrationRecord {
|
|
153
|
-
readonly registration: PendingRegistration;
|
|
154
|
-
readonly consumed: boolean;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export interface RegistrationColumns<T extends Table> {
|
|
158
|
-
readonly registrationId: ColumnKey<T>;
|
|
159
|
-
readonly tokenDigest: ColumnKey<T>;
|
|
160
|
-
readonly expiresAt: ColumnKey<T>;
|
|
161
|
-
readonly consumed: ColumnKey<T>;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export interface RegistrationTableMapping<T extends Table> {
|
|
165
|
-
readonly table: T;
|
|
166
|
-
readonly columns: RegistrationColumns<T>;
|
|
167
|
-
readonly encodeInstant: (instant: DateTime.Utc) => unknown;
|
|
168
|
-
readonly encodeInsert: (input: NewRegistration, consumed: false) => InferInsertModel<T>;
|
|
169
|
-
readonly decode: (
|
|
170
|
-
row: InferSelectModel<T>,
|
|
171
|
-
) => Effect.Effect<RegistrationRecord, PersistenceMappingError>;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export interface OAuthStateColumns<T extends Table> {
|
|
175
|
-
readonly stateDigest: ColumnKey<T>;
|
|
176
|
-
readonly expiresAt: ColumnKey<T>;
|
|
177
|
-
readonly consumed: ColumnKey<T>;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export interface OAuthStateTableMapping<T extends Table> {
|
|
181
|
-
readonly table: T;
|
|
182
|
-
readonly columns: OAuthStateColumns<T>;
|
|
183
|
-
readonly encodeInstant: (instant: DateTime.Utc) => unknown;
|
|
184
|
-
readonly encodeInsert: (state: OAuthState, consumed: false) => InferInsertModel<T>;
|
|
185
|
-
readonly decode: (
|
|
186
|
-
row: InferSelectModel<T>,
|
|
187
|
-
) => Effect.Effect<
|
|
188
|
-
{ readonly state: OAuthState; readonly consumed: boolean },
|
|
189
|
-
PersistenceMappingError
|
|
190
|
-
>;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export interface AuthStoreTables<Challenge extends Table, Registration extends Table> {
|
|
194
|
-
readonly constraints: RequiredAuthStoreConstraints;
|
|
195
|
-
readonly challenge: ChallengeTableMapping<Challenge>;
|
|
196
|
-
readonly registration: RegistrationTableMapping<Registration>;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export interface OAuthStateTables<State extends Table> {
|
|
200
|
-
readonly constraints: RequiredOAuthStateConstraints;
|
|
201
|
-
readonly oauthState: OAuthStateTableMapping<State>;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export interface AuthTables<
|
|
205
|
-
Challenge extends Table,
|
|
206
|
-
Registration extends Table,
|
|
207
|
-
State extends Table,
|
|
208
|
-
> {
|
|
209
|
-
readonly constraints: RequiredAuthConstraints;
|
|
210
|
-
readonly challenge: ChallengeTableMapping<Challenge>;
|
|
211
|
-
readonly registration: RegistrationTableMapping<Registration>;
|
|
212
|
-
readonly oauthState: OAuthStateTableMapping<State>;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
27
|
export interface RequiredIdentityConstraints {
|
|
216
28
|
readonly identifier: "unique(namespace,value)";
|
|
217
29
|
readonly externalIdentity: "unique(provider,issuer,subject)";
|
|
@@ -420,25 +232,6 @@ export const updateValues = <T extends Table>(
|
|
|
420
232
|
entries: ReadonlyArray<readonly [ColumnKey<T>, unknown]>,
|
|
421
233
|
): Partial<InferInsertModel<T>> => Object.fromEntries(entries) as Partial<InferInsertModel<T>>;
|
|
422
234
|
|
|
423
|
-
export type ChallengeInput = ConsumeChallenge;
|
|
424
|
-
|
|
425
|
-
/** Acquire an application database in Effect and expose the auth stores as one layer. */
|
|
426
|
-
export const authServicesLayer = <E, R>(
|
|
427
|
-
acquire: Effect.Effect<
|
|
428
|
-
{
|
|
429
|
-
readonly authStore: AuthStore["Service"];
|
|
430
|
-
readonly oauthStateStore: OAuthStateStore["Service"];
|
|
431
|
-
},
|
|
432
|
-
E,
|
|
433
|
-
R
|
|
434
|
-
>,
|
|
435
|
-
) =>
|
|
436
|
-
Layer.effectContext(
|
|
437
|
-
Effect.map(acquire, ({ authStore, oauthStateStore }) =>
|
|
438
|
-
Context.make(AuthStore, authStore).pipe(Context.add(OAuthStateStore, oauthStateStore)),
|
|
439
|
-
),
|
|
440
|
-
);
|
|
441
|
-
|
|
442
235
|
/** Acquire an application database in Effect and expose the identity services as one layer. */
|
|
443
236
|
export const identityServicesLayer = <E, R>(
|
|
444
237
|
acquire: Effect.Effect<
|
|
@@ -5,7 +5,7 @@ import type { AnyRelations } from "drizzle-orm";
|
|
|
5
5
|
import type { EffectMysql2Database } from "drizzle-orm/effect-mysql2";
|
|
6
6
|
import type { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
7
7
|
import { Effect, Context } from "effect";
|
|
8
|
-
import type { SqlError } from "effect/
|
|
8
|
+
import type { SqlError } from "effect/sql/SqlError";
|
|
9
9
|
|
|
10
10
|
import type {
|
|
11
11
|
EmailAddressMapping,
|
|
@@ -4,7 +4,7 @@ import type { AnyRelations } from "drizzle-orm";
|
|
|
4
4
|
import type { EffectMysql2Database } from "drizzle-orm/effect-mysql2";
|
|
5
5
|
import type { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
6
6
|
import { Effect, Context } from "effect";
|
|
7
|
-
import type { SqlError } from "effect/
|
|
7
|
+
import type { SqlError } from "effect/sql/SqlError";
|
|
8
8
|
|
|
9
9
|
import { mysqlPasswordConfiguration as configuration } from "./mysql-passwords";
|
|
10
10
|
import type {
|
|
@@ -5,7 +5,7 @@ import type { AnyRelations } from "drizzle-orm";
|
|
|
5
5
|
import type { EffectMysql2Database } from "drizzle-orm/effect-mysql2";
|
|
6
6
|
import type { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
7
7
|
import { Effect, Context } from "effect";
|
|
8
|
-
import type { SqlError } from "effect/
|
|
8
|
+
import type { SqlError } from "effect/sql/SqlError";
|
|
9
9
|
|
|
10
10
|
import type { PasswordPersistenceMapping, PasswordRegistrationMapping } from "./password-model";
|
|
11
11
|
import type { PasswordRegistrationAuthority } from "./password-registration";
|
|
@@ -4,7 +4,7 @@ import type { AnyRelations } from "drizzle-orm";
|
|
|
4
4
|
import type { EffectMysql2Database } from "drizzle-orm/effect-mysql2";
|
|
5
5
|
import type { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
6
6
|
import { Effect, Context } from "effect";
|
|
7
|
-
import type { SqlError } from "effect/
|
|
7
|
+
import type { SqlError } from "effect/sql/SqlError";
|
|
8
8
|
|
|
9
9
|
import { updateValues } from "./model";
|
|
10
10
|
import type { ProofPersistenceMapping } from "./proof-model";
|
|
@@ -12,7 +12,7 @@ import type { AnyRelations } from "drizzle-orm";
|
|
|
12
12
|
import type { EffectMysql2Database } from "drizzle-orm/effect-mysql2";
|
|
13
13
|
import type { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
14
14
|
import { Effect, Context } from "effect";
|
|
15
|
-
import type { SqlError } from "effect/
|
|
15
|
+
import type { SqlError } from "effect/sql/SqlError";
|
|
16
16
|
|
|
17
17
|
import type {
|
|
18
18
|
AuthenticationAuthorityMapping,
|
|
@@ -132,6 +132,7 @@ export const claimRefresh = Effect.fn("oauthConnected.claimRefresh")(function* (
|
|
|
132
132
|
|
|
133
133
|
const claim = snapshotOAuthSync(M.OAuthConnectedRefreshClaim, {
|
|
134
134
|
grant: input.grant,
|
|
135
|
+
order: String(yield* S.nextOrder(mapping, read.client)),
|
|
135
136
|
claimId: input.claimId,
|
|
136
137
|
claimedAtMillis: read.now,
|
|
137
138
|
claimExpiresAtMillis: expires,
|
|
@@ -204,10 +205,16 @@ export const settleRefresh = Effect.fn("oauthConnected.settleRefresh")(function*
|
|
|
204
205
|
if (incoming !== undefined)
|
|
205
206
|
invariant(
|
|
206
207
|
C.sameContext(
|
|
207
|
-
{
|
|
208
|
+
{
|
|
209
|
+
...incoming.context,
|
|
210
|
+
tokenVersion: old.tokenVersion,
|
|
211
|
+
metadata: old.metadata,
|
|
212
|
+
exchangeOrder: old.exchangeOrder,
|
|
213
|
+
},
|
|
208
214
|
old,
|
|
209
215
|
) &&
|
|
210
216
|
incoming.context.tokenVersion === input.claim.nextTokenVersion &&
|
|
217
|
+
incoming.context.exchangeOrder === input.claim.order &&
|
|
211
218
|
validMetadata(incoming.context, now) &&
|
|
212
219
|
incoming.context.metadata.obtainedAtMillis >= input.claim.claimedAtMillis &&
|
|
213
220
|
(incoming.context.metadata.refreshUseUntilMillis === undefined ||
|
|
@@ -374,6 +374,9 @@ export const makeD1OAuthConnectedTarget = <Database, Family extends Table, Extra
|
|
|
374
374
|
);
|
|
375
375
|
|
|
376
376
|
const service: OAuthConnectedPersistence["Service"] = {
|
|
377
|
+
claimSignIn: (input, prepare) => owner.run(original.claimSignIn(input, prepare)),
|
|
378
|
+
inspectSignIn: (input) => owner.run(original.inspectSignIn(input)),
|
|
379
|
+
settleSignIn: (input, prepare) => owner.run(original.settleSignIn(input, prepare)),
|
|
377
380
|
capture: (input) => owner.run(original.capture(input)),
|
|
378
381
|
issue: (input, prepare) => owner.run(original.issue(input, prepare)),
|
|
379
382
|
preflight: (input) => owner.run(original.preflight(input)),
|
|
@@ -105,6 +105,19 @@ const snapshot =
|
|
|
105
105
|
snapshotOAuthSync(schema, input);
|
|
106
106
|
|
|
107
107
|
export const connectedInputs = {
|
|
108
|
+
claimSignIn: snapshot(
|
|
109
|
+
Schema.Struct({ claim: M.OAuthClaim, configuration: M.OAuthConnectedConfiguration }),
|
|
110
|
+
),
|
|
111
|
+
inspectSignIn: snapshot(
|
|
112
|
+
Schema.Struct({
|
|
113
|
+
reservation: M.OAuthSignInAccessClaim,
|
|
114
|
+
credential: M.OAuthCredentialSnapshot,
|
|
115
|
+
grantId: M.OAuthGrantId,
|
|
116
|
+
}),
|
|
117
|
+
),
|
|
118
|
+
settleSignIn: snapshot(
|
|
119
|
+
Schema.Struct({ reservation: M.OAuthSignInAccessClaim, outcome: M.OAuthSignInAccessOutcome }),
|
|
120
|
+
),
|
|
108
121
|
capture: snapshot(capture),
|
|
109
122
|
issue: snapshot(issue),
|
|
110
123
|
preflight: snapshot(M.OAuthConnectedAccess),
|
|
@@ -7,6 +7,8 @@ import type { SubjectIdCodec } from "./model";
|
|
|
7
7
|
import type {
|
|
8
8
|
OAuthAuthorityReadTable,
|
|
9
9
|
OAuthClock,
|
|
10
|
+
OAuthCredentialReadTable,
|
|
11
|
+
OAuthFlowTable,
|
|
10
12
|
OAuthOwnershipMutation,
|
|
11
13
|
OAuthSubjectReadTable,
|
|
12
14
|
requiredOAuthTupleConstraints,
|
|
@@ -53,6 +55,9 @@ export interface OAuthConnectedFlowTable<F extends Table, N> {
|
|
|
53
55
|
readonly work: Column<F>;
|
|
54
56
|
/** Exact sealed quarantine when no correctly sealed revocation job is available. */
|
|
55
57
|
readonly custody: Column<F>;
|
|
58
|
+
/** Required when retaining grants during sign-in. subjectId is NULL until
|
|
59
|
+
* identity resolution; custom required columns are supplied by this encoder. */
|
|
60
|
+
readonly encodeSignIn?: (reservation: M.OAuthSignInAccessClaim) => InferInsertModel<F>;
|
|
56
61
|
readonly encodeInsert: (input: {
|
|
57
62
|
readonly flow: M.OAuthConnectedPendingFlow;
|
|
58
63
|
readonly subjectId: N;
|
|
@@ -192,6 +197,12 @@ export type OAuthConnectedPolicyInput<N> = {
|
|
|
192
197
|
readonly configuration: M.OAuthConnectedConfiguration;
|
|
193
198
|
readonly grant?: M.OAuthConnectedTokenContext;
|
|
194
199
|
}
|
|
200
|
+
| {
|
|
201
|
+
readonly kind: "sign-in";
|
|
202
|
+
readonly credential: M.OAuthCredentialSnapshot;
|
|
203
|
+
readonly configuration: M.OAuthConnectedConfiguration;
|
|
204
|
+
readonly grant?: M.OAuthConnectedTokenContext;
|
|
205
|
+
}
|
|
195
206
|
| {
|
|
196
207
|
readonly kind: "metadata" | "use";
|
|
197
208
|
readonly authorization: M.OAuthConnectedUseAuthorization;
|
|
@@ -307,6 +318,12 @@ export interface OAuthConnectedMapping<
|
|
|
307
318
|
readonly subject: OAuthConnectedSubjectTable<S>;
|
|
308
319
|
readonly authority: OAuthAuthorityReadTable<AC>;
|
|
309
320
|
readonly admission: OAuthConnectedAdmissionTable<A, N>;
|
|
321
|
+
/** Same shared sign-in tables used by OAuthSignInPersistence. Enable only
|
|
322
|
+
* alongside a nullable connected-flow subjectId and flow.encodeSignIn. */
|
|
323
|
+
readonly signIn?: {
|
|
324
|
+
readonly credential: OAuthCredentialReadTable<Table>;
|
|
325
|
+
readonly flow: OAuthFlowTable<Table>;
|
|
326
|
+
};
|
|
310
327
|
readonly command: OAuthConnectedCommandTable<D, N>;
|
|
311
328
|
readonly policy: OAuthConnectedSqlPolicy<N>;
|
|
312
329
|
readonly constraints: typeof requiredOAuthConnectedConstraints;
|