@yielded/auth-persistence-drizzle 0.1.0-beta.14 → 0.1.0-beta.16
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 +123 -9
- package/dist/Libsql.d.mts +141 -27
- package/dist/Mysql2.d.mts +124 -10
- package/dist/Pglite.d.mts +124 -10
- package/dist/Postgres.d.mts +129 -15
- package/dist/SqliteBun.d.mts +135 -21
- package/dist/SqliteDo.d.mts +135 -21
- package/dist/SqliteNode.d.mts +135 -21
- package/dist/SqliteWasm.d.mts +135 -21
- package/dist/drizzle/d1-emails.d.mts +3 -3
- package/dist/drizzle/d1-emails.mjs +56 -11
- package/dist/drizzle/d1-emails.mjs.map +1 -1
- package/dist/drizzle/d1-identity.mjs +9 -2
- package/dist/drizzle/d1-identity.mjs.map +1 -1
- package/dist/drizzle/d1-oauth.d.mts +6 -6
- package/dist/drizzle/d1-oauth.mjs +8 -8
- package/dist/drizzle/d1-oauth.mjs.map +1 -1
- package/dist/drizzle/d1-passkey.d.mts +2 -1
- package/dist/drizzle/d1-passkey.mjs +10 -8
- package/dist/drizzle/d1-passkey.mjs.map +1 -1
- package/dist/drizzle/d1-password-prepared.d.mts +1 -1
- package/dist/drizzle/d1-password-prepared.mjs +16 -5
- package/dist/drizzle/d1-password-prepared.mjs.map +1 -1
- package/dist/drizzle/d1-passwords.d.mts +2 -2
- package/dist/drizzle/d1-passwords.mjs +19 -6
- package/dist/drizzle/d1-passwords.mjs.map +1 -1
- package/dist/drizzle/d1-phone.d.mts +2 -1
- package/dist/drizzle/d1-phone.mjs +4 -2
- package/dist/drizzle/d1-phone.mjs.map +1 -1
- package/dist/drizzle/d1-proofs.d.mts +1 -1
- package/dist/drizzle/d1-proofs.mjs +18 -7
- package/dist/drizzle/d1-proofs.mjs.map +1 -1
- package/dist/drizzle/d1-sessions.d.mts +6 -5
- package/dist/drizzle/d1-sessions.mjs +29 -19
- package/dist/drizzle/d1-sessions.mjs.map +1 -1
- package/dist/drizzle/d1-totp.d.mts +2 -1
- package/dist/drizzle/d1-totp.mjs +4 -2
- package/dist/drizzle/d1-totp.mjs.map +1 -1
- package/dist/drizzle/email-registration.d.mts +5 -1
- package/dist/drizzle/email-registration.mjs +48 -4
- package/dist/drizzle/email-registration.mjs.map +1 -1
- package/dist/drizzle/email-target.d.mts +1 -0
- package/dist/drizzle/email-target.mjs +9 -0
- package/dist/drizzle/email-target.mjs.map +1 -1
- package/dist/drizzle/mysql-emails.d.mts +4 -4
- package/dist/drizzle/mysql-emails.mjs +8 -7
- package/dist/drizzle/mysql-emails.mjs.map +1 -1
- package/dist/drizzle/mysql-identity.mjs +11 -4
- package/dist/drizzle/mysql-identity.mjs.map +1 -1
- package/dist/drizzle/mysql-password-prepared.d.mts +2 -2
- package/dist/drizzle/mysql-password-prepared.mjs +4 -3
- package/dist/drizzle/mysql-password-prepared.mjs.map +1 -1
- package/dist/drizzle/mysql-passwords.d.mts +3 -3
- package/dist/drizzle/mysql-passwords.mjs +7 -6
- package/dist/drizzle/mysql-passwords.mjs.map +1 -1
- package/dist/drizzle/mysql-proofs.d.mts +2 -2
- package/dist/drizzle/mysql-proofs.mjs +4 -3
- package/dist/drizzle/mysql-proofs.mjs.map +1 -1
- package/dist/drizzle/mysql-sessions.d.mts +6 -6
- package/dist/drizzle/mysql-sessions.mjs +16 -15
- package/dist/drizzle/mysql-sessions.mjs.map +1 -1
- package/dist/drizzle/native-database.mjs +1 -1
- package/dist/drizzle/native-database.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-drivers.mjs +10 -8
- package/dist/drizzle/oauth-connected-drivers.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-flow.mjs +62 -13
- package/dist/drizzle/oauth-connected-flow.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-input.mjs +6 -0
- package/dist/drizzle/oauth-connected-input.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-maintenance.mjs +3 -3
- package/dist/drizzle/oauth-connected-maintenance.mjs.map +1 -1
- package/dist/drizzle/oauth-connected-target.d.mts +116 -2
- package/dist/drizzle/oauth-connected-target.mjs +5 -3
- package/dist/drizzle/oauth-connected-target.mjs.map +1 -1
- package/dist/drizzle/oauth-drivers.mjs +8 -8
- package/dist/drizzle/oauth-drivers.mjs.map +1 -1
- package/dist/drizzle/oauth-target.d.mts +3 -3
- package/dist/drizzle/oauth-target.mjs +8 -6
- package/dist/drizzle/oauth-target.mjs.map +1 -1
- package/dist/drizzle/passkey-drivers.mjs +4 -4
- package/dist/drizzle/passkey-drivers.mjs.map +1 -1
- package/dist/drizzle/passkey-write-drivers.mjs +4 -4
- 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 +5 -0
- package/dist/drizzle/password-prepared-sql.mjs.map +1 -1
- package/dist/drizzle/password-prepared-target.d.mts +2 -1
- package/dist/drizzle/password-prepared-target.mjs +5 -0
- package/dist/drizzle/password-prepared-target.mjs.map +1 -1
- package/dist/drizzle/password-registration.d.mts +1 -1
- package/dist/drizzle/password-registration.mjs +2 -0
- package/dist/drizzle/password-registration.mjs.map +1 -1
- package/dist/drizzle/password-target.d.mts +1 -0
- package/dist/drizzle/password-target.mjs +6 -0
- package/dist/drizzle/password-target.mjs.map +1 -1
- package/dist/drizzle/pg-emails.d.mts +4 -4
- package/dist/drizzle/pg-emails.mjs +8 -7
- package/dist/drizzle/pg-emails.mjs.map +1 -1
- package/dist/drizzle/pg-identity.mjs +12 -5
- package/dist/drizzle/pg-identity.mjs.map +1 -1
- package/dist/drizzle/pg-password-prepared.d.mts +2 -2
- package/dist/drizzle/pg-password-prepared.mjs +4 -3
- package/dist/drizzle/pg-password-prepared.mjs.map +1 -1
- package/dist/drizzle/pg-passwords.d.mts +3 -3
- package/dist/drizzle/pg-passwords.mjs +7 -6
- package/dist/drizzle/pg-passwords.mjs.map +1 -1
- package/dist/drizzle/pg-proofs.d.mts +2 -2
- package/dist/drizzle/pg-proofs.mjs +4 -3
- package/dist/drizzle/pg-proofs.mjs.map +1 -1
- package/dist/drizzle/pg-sessions.d.mts +6 -6
- package/dist/drizzle/pg-sessions.mjs +16 -15
- package/dist/drizzle/pg-sessions.mjs.map +1 -1
- package/dist/drizzle/phone-target.mjs +11 -2
- package/dist/drizzle/phone-target.mjs.map +1 -1
- package/dist/drizzle/proof-target.d.mts +1 -0
- package/dist/drizzle/proof-target.mjs +2 -0
- package/dist/drizzle/proof-target.mjs.map +1 -1
- package/dist/drizzle/query-operations.mjs +2 -0
- package/dist/drizzle/query-operations.mjs.map +1 -1
- package/dist/drizzle/session-target.d.mts +1 -0
- package/dist/drizzle/session-target.mjs +9 -6
- package/dist/drizzle/session-target.mjs.map +1 -1
- package/dist/drizzle/sqlite-emails.mjs +8 -7
- package/dist/drizzle/sqlite-emails.mjs.map +1 -1
- package/dist/drizzle/sqlite-identity.mjs +7 -2
- package/dist/drizzle/sqlite-identity.mjs.map +1 -1
- package/dist/drizzle/sqlite-password-prepared.mjs +4 -3
- package/dist/drizzle/sqlite-password-prepared.mjs.map +1 -1
- package/dist/drizzle/sqlite-passwords.mjs +7 -6
- package/dist/drizzle/sqlite-passwords.mjs.map +1 -1
- package/dist/drizzle/sqlite-proofs.mjs +4 -3
- package/dist/drizzle/sqlite-proofs.mjs.map +1 -1
- package/dist/drizzle/sqlite-sessions.mjs +16 -15
- package/dist/drizzle/sqlite-sessions.mjs.map +1 -1
- package/dist/drizzle/storage-validation.mjs +234 -0
- package/dist/drizzle/storage-validation.mjs.map +1 -0
- package/dist/drizzle/totp-target.mjs +5 -2
- package/dist/drizzle/totp-target.mjs.map +1 -1
- package/dist/drizzle/transaction-mysql.mjs +1 -1
- package/package.json +1 -1
- package/src/drizzle/d1-emails.ts +158 -40
- package/src/drizzle/d1-identity.ts +13 -0
- package/src/drizzle/d1-oauth.ts +8 -8
- package/src/drizzle/d1-passkey.ts +10 -8
- package/src/drizzle/d1-password-prepared.ts +14 -2
- package/src/drizzle/d1-passwords.ts +22 -4
- package/src/drizzle/d1-phone.ts +4 -2
- package/src/drizzle/d1-proofs.ts +55 -3
- package/src/drizzle/d1-sessions.ts +67 -18
- package/src/drizzle/d1-totp.ts +4 -2
- package/src/drizzle/email-registration.ts +160 -12
- package/src/drizzle/email-target.ts +22 -4
- package/src/drizzle/mysql-emails.ts +17 -7
- package/src/drizzle/mysql-identity.ts +13 -0
- package/src/drizzle/mysql-password-prepared.ts +7 -3
- package/src/drizzle/mysql-passwords.ts +13 -6
- package/src/drizzle/mysql-proofs.ts +7 -3
- package/src/drizzle/mysql-sessions.ts +31 -15
- package/src/drizzle/native-database.ts +5 -4
- package/src/drizzle/oauth-connected-drivers.ts +10 -8
- package/src/drizzle/oauth-connected-flow.ts +98 -10
- package/src/drizzle/oauth-connected-input.ts +7 -0
- package/src/drizzle/oauth-connected-maintenance.ts +3 -2
- package/src/drizzle/oauth-connected-target.ts +4 -2
- package/src/drizzle/oauth-drivers.ts +8 -8
- package/src/drizzle/oauth-target.ts +13 -7
- package/src/drizzle/passkey-drivers.ts +4 -4
- package/src/drizzle/passkey-write-drivers.ts +8 -5
- package/src/drizzle/password-prepared-sql.ts +13 -1
- package/src/drizzle/password-prepared-target.ts +7 -1
- package/src/drizzle/password-registration.ts +10 -3
- package/src/drizzle/password-target.ts +22 -4
- package/src/drizzle/pg-emails.ts +17 -7
- package/src/drizzle/pg-identity.ts +13 -0
- package/src/drizzle/pg-password-prepared.ts +7 -3
- package/src/drizzle/pg-passwords.ts +13 -6
- package/src/drizzle/pg-proofs.ts +7 -3
- package/src/drizzle/pg-sessions.ts +31 -15
- package/src/drizzle/phone-target.ts +30 -5
- package/src/drizzle/proof-target.ts +10 -2
- package/src/drizzle/query-operations.ts +2 -0
- package/src/drizzle/session-target.ts +20 -3
- package/src/drizzle/sqlite-emails.ts +17 -7
- package/src/drizzle/sqlite-identity.ts +5 -0
- package/src/drizzle/sqlite-password-prepared.ts +7 -3
- package/src/drizzle/sqlite-passwords.ts +13 -6
- package/src/drizzle/sqlite-proofs.ts +7 -3
- package/src/drizzle/sqlite-sessions.ts +31 -15
- package/src/drizzle/storage-validation.ts +285 -0
- package/src/drizzle/totp-target.ts +16 -4
package/dist/SqliteWasm.d.mts
CHANGED
|
@@ -73,16 +73,16 @@ export declare const coordinateEmailAddress: {
|
|
|
73
73
|
readonly hasMore: boolean;
|
|
74
74
|
}, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/Email").EmailUnavailable>;
|
|
75
75
|
};
|
|
76
|
-
},
|
|
76
|
+
}, import("@yielded/auth/Email").EmailUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeEmailRegistrationServices: <Registration, S extends AnySQLiteTable, I extends AnySQLiteTable, C extends AnySQLiteTable, AC extends AnySQLiteTable, Rq extends AnySQLiteTable, NativeId>(mapping: EmailRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>, proofMapping: import("@yielded/auth-persistence/Adapter").ProofPersistenceMapping<DrizzleTableModel<any>, DrizzleTableModel<any>, DrizzleTableModel<any>, DrizzleTableModel<any>, DrizzleTableModel<any>, DrizzleTableModel<any>, DrizzleTableModel<any>, DrizzleTableModel<any>, DrizzleTableModel<any>, DrizzleTableModel<any>, DrizzleTableModel<any>, any, import("drizzle-orm").SQL<unknown>>) => Effect.Effect<{
|
|
77
77
|
registrationAuthority: EmailRegistrationAuthority<Registration>;
|
|
78
|
-
},
|
|
78
|
+
}, import("@yielded/auth/Email").EmailUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeEmailSignInServices: <S extends AnySQLiteTable, I extends AnySQLiteTable, C extends AnySQLiteTable, NativeId>(mapping: EmailSignInMapping<S, I, C, NativeId>) => Effect.Effect<{
|
|
79
79
|
emailSignInTargets: {
|
|
80
80
|
readonly lookup: (input: {
|
|
81
81
|
readonly moduleId: string;
|
|
82
82
|
readonly identifier: import("@yielded/auth/Identity").LoginIdentifier;
|
|
83
83
|
}) => Effect.Effect<import("effect/Option").Option<import("@yielded/auth/Email").EmailCredentialSnapshot>, import("@yielded/auth/Email").EmailUnavailable>;
|
|
84
84
|
};
|
|
85
|
-
},
|
|
85
|
+
}, import("@yielded/auth/Email").EmailUnavailable, Database>;
|
|
86
86
|
export declare const coordinatePasswordPersistence: {
|
|
87
87
|
<Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable, I extends AnySQLiteTable, C extends AnySQLiteTable, AC extends AnySQLiteTable, A extends AnySQLiteTable, RS extends AnySQLiteTable, CE extends AnySQLiteTable, M extends AnySQLiteTable, NativeId, PM extends ProofPersistenceMapping<any, any, any, any, any, any, any, any, any, any, any, any> | undefined, Out, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
|
|
88
88
|
readonly mapping: import("@yielded/auth-persistence/Adapter").PasswordPersistenceMapping<DrizzleTableModel<S>, DrizzleTableModel<I>, DrizzleTableModel<C>, DrizzleTableModel<AC>, DrizzleTableModel<A>, DrizzleTableModel<RS>, DrizzleTableModel<CE>, DrizzleTableModel<M>, NativeId, import("drizzle-orm").SQL<unknown>>;
|
|
@@ -147,9 +147,9 @@ export declare const coordinatePasswordPersistence: {
|
|
|
147
147
|
readonly hasMore: boolean;
|
|
148
148
|
}, A_1>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A_1>, import("@yielded/auth/Password").PasswordUnavailable>;
|
|
149
149
|
};
|
|
150
|
-
},
|
|
150
|
+
}, import("@yielded/auth/Password").PasswordUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, makePasswordRegistrationServices: <Registration, S extends AnySQLiteTable, I extends AnySQLiteTable, C extends AnySQLiteTable, AC extends AnySQLiteTable, Rq extends AnySQLiteTable, NativeId>(mapping: PasswordRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>) => Effect.Effect<{
|
|
151
151
|
registrationAuthority: import("@yielded/auth-persistence/Adapter").PasswordRegistrationAuthority<Registration>;
|
|
152
|
-
},
|
|
152
|
+
}, import("@yielded/auth/Password").PasswordUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>;
|
|
153
153
|
export declare const coordinateProofPersistence: {
|
|
154
154
|
<Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, Rq extends AnySQLiteTable, S extends AnySQLiteTable, G extends AnySQLiteTable, Cn extends AnySQLiteTable, Rs extends AnySQLiteTable, Aev extends AnySQLiteTable, F extends AnySQLiteTable, C extends AnySQLiteTable, Sub extends AnySQLiteTable, I extends AnySQLiteTable, Cr extends AnySQLiteTable, NativeId, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
|
|
155
155
|
readonly mapping: import("@yielded/auth-persistence/Adapter").ProofPersistenceMapping<DrizzleTableModel<Rq>, DrizzleTableModel<S>, DrizzleTableModel<G>, DrizzleTableModel<Cn>, DrizzleTableModel<Rs>, DrizzleTableModel<Aev>, DrizzleTableModel<F>, DrizzleTableModel<C>, DrizzleTableModel<Sub>, DrizzleTableModel<I>, DrizzleTableModel<Cr>, NativeId, import("drizzle-orm").SQL<unknown>>;
|
|
@@ -209,7 +209,7 @@ export declare const coordinateProofPersistence: {
|
|
|
209
209
|
readonly limit: number;
|
|
210
210
|
}, prepare: import("@yielded/auth/Proofs").PrepareProofCommit<import("@yielded/auth/Proofs").ProofCleanupResult, A_1>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A_1>, import("@yielded/auth/Proofs").ProofUnavailable>;
|
|
211
211
|
};
|
|
212
|
-
},
|
|
212
|
+
}, import("@yielded/auth/Proofs").ProofUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>;
|
|
213
213
|
export declare const coordinateAuthenticationAuthority: {
|
|
214
214
|
<Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, Claims, S extends AnySQLiteTable, C extends AnySQLiteTable, F extends AnySQLiteTable, P extends AnySQLiteTable, NativeId, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
|
|
215
215
|
readonly mapping: AuthenticationAuthorityMapping<Claims, S, C, F, P, NativeId>;
|
|
@@ -266,11 +266,11 @@ export declare const coordinateAuthenticationAuthority: {
|
|
|
266
266
|
readonly pending?: import("@yielded/auth/Sessions").PendingConsumption;
|
|
267
267
|
}, prepare: import("@yielded/auth/Sessions").PrepareSessionCommit<void, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/Sessions").StaleAuthentication | import("@yielded/auth/Sessions").PendingAuthenticationInvalid | import("@yielded/auth/Sessions").SessionUnavailable>;
|
|
268
268
|
};
|
|
269
|
-
},
|
|
269
|
+
}, import("@yielded/auth/Sessions").SessionUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, makePendingAuthenticationServices: <Claims, S extends AnySQLiteTable, C extends AnySQLiteTable, P extends AnySQLiteTable, F extends AnySQLiteTable, NativeId>(mapping: PendingAuthenticationMapping<Claims, S, C, P, F, NativeId>) => Effect.Effect<{
|
|
270
270
|
pendingAuthentication: import("@yielded/auth/Sessions").PendingAuthentication<Claims>;
|
|
271
|
-
},
|
|
271
|
+
}, import("@yielded/auth/Sessions").SessionUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeSessionStepUpServices: <Claims, Id, S extends AnySQLiteTable, C extends AnySQLiteTable, I extends AnySQLiteTable, Session extends AnySQLiteTable, T extends AnySQLiteTable, NativeId, NativeSessionId>(mapping: SessionStepUpMapping<NoInfer<Claims>, S, C, I, Session, T, NativeId, NativeSessionId>, target: Context.Service<Id, import("@yielded/auth/Sessions").SessionStepUpPersistence<Claims>>) => Effect.Effect<{
|
|
272
272
|
sessionStepUpPersistence: import("@yielded/auth/Sessions").SessionStepUpPersistence<Claims>;
|
|
273
|
-
},
|
|
273
|
+
}, import("@yielded/auth/Sessions").SessionUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, coordinateSessionStepUp: {
|
|
274
274
|
<Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, Claims, Id, S extends AnySQLiteTable, C extends AnySQLiteTable, I extends AnySQLiteTable, Session extends AnySQLiteTable, T extends AnySQLiteTable, NativeId, NativeSessionId, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
|
|
275
275
|
readonly mapping: SessionStepUpMapping<NoInfer<Claims>, S, C, I, Session, T, NativeId, NativeSessionId>;
|
|
276
276
|
readonly target: SuppliedService<Id, import("@yielded/auth/Sessions").SessionStepUpPersistence<Claims>>;
|
|
@@ -283,10 +283,10 @@ export declare const coordinateAuthenticationAuthority: {
|
|
|
283
283
|
}, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | E | import("@yielded/auth/Hooks").HookConfigurationError | import("@yielded/auth/Sessions").SessionUnavailable | import("effect/sql/SqlError").SqlError, DatabaseRequirements | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, Id | TxId>>;
|
|
284
284
|
}, makeSignedSessionValidityServices: <S extends AnySQLiteTable, T extends AnySQLiteTable, NativeId, NativeSessionId>(mapping: SignedSessionValidityMapping<S, T, NativeId, NativeSessionId>) => Effect.Effect<{
|
|
285
285
|
signedSessionValidity: import("@yielded/auth/Sessions").SignedSessionValidity;
|
|
286
|
-
},
|
|
286
|
+
}, import("@yielded/auth/Sessions").SessionUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeStatefulSessionServices: <Claims, S extends AnySQLiteTable, C extends AnySQLiteTable, Session extends AnySQLiteTable, F extends AnySQLiteTable, P extends AnySQLiteTable, NativeId, NativeSessionId>(mapping: StatefulSessionMapping<Claims, S, C, Session, F, P, NativeId, NativeSessionId>) => Effect.Effect<{
|
|
287
287
|
readonly statefulSessionPersistence: import("@yielded/auth/Sessions").StatefulSessionPersistence<Claims>;
|
|
288
288
|
readonly sessionRepository: import("@yielded/auth/Sessions").SessionRepository;
|
|
289
|
-
},
|
|
289
|
+
}, import("@yielded/auth/Sessions").SessionUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>;
|
|
290
290
|
export declare const commitMode: "interactive";
|
|
291
291
|
export declare const makeIdentityServices: <Subject extends AnySQLiteTable, Identifier extends AnySQLiteTable, External extends AnySQLiteTable, Request extends AnySQLiteTable, NativeId>(mapping: IdentityTables<Subject, Identifier, External, Request, NativeId>) => Effect.Effect<{
|
|
292
292
|
subjectProvisioner: {
|
|
@@ -295,20 +295,20 @@ export declare const makeIdentityServices: <Subject extends AnySQLiteTable, Iden
|
|
|
295
295
|
externalIdentityMutation: {
|
|
296
296
|
readonly bind: (subjectId: import("@yielded/auth/Schema").SubjectId, identity: import("@yielded/auth/Identity").ExternalIdentity) => Effect.Effect<void, import("@yielded/auth/Identity").IdentityConflict | import("@yielded/auth/Identity").IdentityUnavailable>;
|
|
297
297
|
};
|
|
298
|
-
},
|
|
298
|
+
}, import("@yielded/auth/Identity").IdentityUnavailable, Database>;
|
|
299
299
|
export declare const makeSubjectProvisioningServices: <Subject extends AnySQLiteTable, Identifier extends AnySQLiteTable, Request extends AnySQLiteTable, NativeId>(mapping: SubjectProvisioningTables<Subject, Identifier, Request, NativeId>) => Effect.Effect<{
|
|
300
300
|
readonly subjectProvisioner: {
|
|
301
301
|
readonly provision: (input: import("@yielded/auth/Identity").SubjectProvisioningInput) => Effect.Effect<import("@yielded/auth/Identity").ProvisioningResult, import("@yielded/auth/Identity").IdentityConflict | import("@yielded/auth/Identity").IdentityUnavailable>;
|
|
302
302
|
};
|
|
303
|
-
},
|
|
303
|
+
}, import("@yielded/auth/Identity").IdentityUnavailable, Database>;
|
|
304
304
|
export declare const makeExternalIdentityServices: <Subject extends AnySQLiteTable, External extends AnySQLiteTable, NativeId>(mapping: ExternalIdentityTables<Subject, External, NativeId>) => Effect.Effect<{
|
|
305
305
|
readonly externalIdentityMutation: {
|
|
306
306
|
readonly bind: (subjectId: import("@yielded/auth/Schema").SubjectId, identity: import("@yielded/auth/Identity").ExternalIdentity) => Effect.Effect<void, import("@yielded/auth/Identity").IdentityConflict | import("@yielded/auth/Identity").IdentityUnavailable>;
|
|
307
307
|
};
|
|
308
|
-
},
|
|
308
|
+
}, import("@yielded/auth/Identity").IdentityUnavailable, Database>;
|
|
309
309
|
export declare const makePasswordPreparedPersistenceServices: <S extends AnySQLiteTable, I extends AnySQLiteTable, C extends AnySQLiteTable, AC extends AnySQLiteTable, A extends AnySQLiteTable, RS extends AnySQLiteTable, CE extends AnySQLiteTable, M extends AnySQLiteTable, T extends AnySQLiteTable, B extends AnySQLiteTable, NativeId, PS extends AnySQLiteTable = AnySQLiteTable, PC extends AnySQLiteTable = AnySQLiteTable, PM extends AnySQLiteTable = AnySQLiteTable, PSub extends AnySQLiteTable = AnySQLiteTable, PI extends AnySQLiteTable = AnySQLiteTable, PCr extends AnySQLiteTable = AnySQLiteTable, PNativeId = unknown>(mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, A, RS, CE, M, T, B, NativeId>, proofMapping?: PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId> | undefined) => Effect.Effect<{
|
|
310
310
|
passwordPreparedPersistence: import("@yielded/auth/Password").PasswordPreparedPersistence;
|
|
311
|
-
},
|
|
311
|
+
}, import("@yielded/auth/Password").PasswordUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, coordinatePasswordPreparedPersistence: {
|
|
312
312
|
<Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, TargetId, S extends AnySQLiteTable, I extends AnySQLiteTable, C extends AnySQLiteTable, AC extends AnySQLiteTable, A extends AnySQLiteTable, RS extends AnySQLiteTable, CE extends AnySQLiteTable, M extends AnySQLiteTable, T extends AnySQLiteTable, B extends AnySQLiteTable, NativeId, PS extends AnySQLiteTable, PC extends AnySQLiteTable, PM extends AnySQLiteTable, PSub extends AnySQLiteTable, PI extends AnySQLiteTable, PCr extends AnySQLiteTable, PNativeId, Out, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
|
|
313
313
|
readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, A, RS, CE, M, T, B, NativeId>;
|
|
314
314
|
readonly proofMapping?: PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId> | undefined;
|
|
@@ -586,7 +586,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
|
|
|
586
586
|
readonly hasMore: boolean;
|
|
587
587
|
}, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/OAuth").OAuthUnavailable>;
|
|
588
588
|
};
|
|
589
|
-
},
|
|
589
|
+
}, import("@yielded/auth/OAuth").OAuthUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeOAuthSignInServices: <S extends AnySQLiteTable<{
|
|
590
590
|
dialect: "sqlite";
|
|
591
591
|
}>, O extends AnySQLiteTable<{
|
|
592
592
|
dialect: "sqlite";
|
|
@@ -628,7 +628,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
|
|
|
628
628
|
readonly hasMore: boolean;
|
|
629
629
|
}, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/OAuth").OAuthUnavailable>;
|
|
630
630
|
};
|
|
631
|
-
},
|
|
631
|
+
}, import("@yielded/auth/OAuth").OAuthUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeOAuthRegistrationIntentServices: <S extends AnySQLiteTable<{
|
|
632
632
|
dialect: "sqlite";
|
|
633
633
|
}>, O extends AnySQLiteTable<{
|
|
634
634
|
dialect: "sqlite";
|
|
@@ -651,7 +651,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
|
|
|
651
651
|
readonly nowMillis: number;
|
|
652
652
|
}, prepare: import("@yielded/auth/OAuth").PrepareOAuthCommit<import("@yielded/auth/OAuth").OAuthRegistrationSettlement, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/OAuth").OAuthUnavailable>;
|
|
653
653
|
};
|
|
654
|
-
},
|
|
654
|
+
}, import("@yielded/auth/OAuth").OAuthUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeOAuthRegistrationServices: <Registration, S extends AnySQLiteTable<{
|
|
655
655
|
dialect: "sqlite";
|
|
656
656
|
}>, O extends AnySQLiteTable<{
|
|
657
657
|
dialect: "sqlite";
|
|
@@ -667,7 +667,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
|
|
|
667
667
|
dialect: "sqlite";
|
|
668
668
|
}>, N>(mapping: OAuthRegistrationMapping<Registration, S, O, C, AC, TA, I, R, N>) => Effect.Effect<{
|
|
669
669
|
registrationAuthority: OAuthRegistrationAuthority<Registration>;
|
|
670
|
-
},
|
|
670
|
+
}, import("@yielded/auth/OAuth").OAuthUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, coordinateOAuthRegistration: {
|
|
671
671
|
<Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, TargetId, Registration, S extends AnySQLiteTable<{
|
|
672
672
|
dialect: "sqlite";
|
|
673
673
|
}>, O extends AnySQLiteTable<{
|
|
@@ -1054,6 +1054,120 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
|
|
|
1054
1054
|
readonly retentionUntilMillis: number;
|
|
1055
1055
|
};
|
|
1056
1056
|
}, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/OAuth").OAuthUnavailable, never>;
|
|
1057
|
+
readonly prepare: <A>(input: {
|
|
1058
|
+
readonly flow: import("@yielded/auth/OAuth").OAuthConnectedPendingFlow;
|
|
1059
|
+
readonly authorization: import("@yielded/auth/OAuth").OAuthConnectedUseAuthorization;
|
|
1060
|
+
}, prepare: import("@yielded/auth/OAuth").PrepareOAuthCommit<{
|
|
1061
|
+
readonly _tag: "Rejected";
|
|
1062
|
+
} | {
|
|
1063
|
+
readonly _tag: "Issued";
|
|
1064
|
+
readonly flow: {
|
|
1065
|
+
readonly context: {
|
|
1066
|
+
readonly provider: string & import("effect/Brand").Brand<"effect-auth/OAuthProviderKey">;
|
|
1067
|
+
readonly protocol: "oauth" | "oidc";
|
|
1068
|
+
readonly configurationGeneration: number;
|
|
1069
|
+
readonly issuer: string & import("effect/Brand").Brand<"effect-auth/OAuthIssuer">;
|
|
1070
|
+
readonly responseIssuerMode: "required" | "unsupported";
|
|
1071
|
+
readonly callbackId: string & import("effect/Brand").Brand<"effect-auth/OAuthCallbackId">;
|
|
1072
|
+
readonly redirectUri: string & import("effect/Brand").Brand<"effect-auth/OAuthRedirectUri">;
|
|
1073
|
+
readonly moduleId: string & import("effect/Brand").Brand<"effect-auth/OAuthModuleId">;
|
|
1074
|
+
readonly generation: number;
|
|
1075
|
+
readonly flowId: string & import("effect/Brand").Brand<"effect-auth/RequestBindingFlowId">;
|
|
1076
|
+
readonly commandId: string & import("effect/Brand").Brand<"effect-auth/OAuthCommandId">;
|
|
1077
|
+
readonly access?: {
|
|
1078
|
+
readonly key: string & import("effect/Brand").Brand<"effect-auth/OAuthPermissionProfileKey">;
|
|
1079
|
+
readonly generation: number;
|
|
1080
|
+
readonly issuance: "active" | "retired";
|
|
1081
|
+
readonly provider: string & import("effect/Brand").Brand<"effect-auth/OAuthProviderKey">;
|
|
1082
|
+
readonly clientRegistrationId: string;
|
|
1083
|
+
readonly scopes: readonly string[];
|
|
1084
|
+
readonly resources: readonly string[];
|
|
1085
|
+
readonly retention: "access-and-refresh" | "access-only";
|
|
1086
|
+
readonly maximumAccessLifetimeMillis: number;
|
|
1087
|
+
readonly maximumRefreshLifetimeMillis?: number | undefined;
|
|
1088
|
+
readonly refreshAheadMillis: number;
|
|
1089
|
+
readonly refresh: "confidential" | "rotating" | "unsupported";
|
|
1090
|
+
readonly revocation: "cohort" | "unsupported";
|
|
1091
|
+
} | undefined;
|
|
1092
|
+
readonly returnTarget: string & import("effect/Brand").Brand<"effect-auth/OAuthReturnTarget">;
|
|
1093
|
+
readonly stateDigest: string & import("effect/Brand").Brand<"effect-auth/TokenDigest">;
|
|
1094
|
+
readonly requestBindingVerifier: string & import("effect/Brand").Brand<"effect-auth/TokenDigest">;
|
|
1095
|
+
readonly requestBindingExpiresAtMillis: number;
|
|
1096
|
+
readonly issuedAtMillis: number;
|
|
1097
|
+
readonly expiresAtMillis: number;
|
|
1098
|
+
readonly claimLifetimeMillis: number;
|
|
1099
|
+
readonly namespace: "effect-auth/oauth-connected-context/v1";
|
|
1100
|
+
readonly revision: {
|
|
1101
|
+
readonly subjectId: string & import("effect/Brand").Brand<"effect-auth/SubjectId">;
|
|
1102
|
+
readonly securityRevision: string & import("effect/Brand").Brand<"effect-auth/SecurityRevision">;
|
|
1103
|
+
readonly credentials: readonly {
|
|
1104
|
+
readonly credentialId: string;
|
|
1105
|
+
readonly revision: string & import("effect/Brand").Brand<"effect-auth/SecurityRevision">;
|
|
1106
|
+
}[];
|
|
1107
|
+
};
|
|
1108
|
+
readonly profile: {
|
|
1109
|
+
readonly key: string & import("effect/Brand").Brand<"effect-auth/OAuthPermissionProfileKey">;
|
|
1110
|
+
readonly generation: number;
|
|
1111
|
+
readonly issuance: "active" | "retired";
|
|
1112
|
+
readonly provider: string & import("effect/Brand").Brand<"effect-auth/OAuthProviderKey">;
|
|
1113
|
+
readonly clientRegistrationId: string;
|
|
1114
|
+
readonly scopes: readonly string[];
|
|
1115
|
+
readonly resources: readonly string[];
|
|
1116
|
+
readonly retention: "access-and-refresh" | "access-only";
|
|
1117
|
+
readonly maximumAccessLifetimeMillis: number;
|
|
1118
|
+
readonly maximumRefreshLifetimeMillis?: number | undefined;
|
|
1119
|
+
readonly refreshAheadMillis: number;
|
|
1120
|
+
readonly refresh: "confidential" | "rotating" | "unsupported";
|
|
1121
|
+
readonly revocation: "cohort" | "unsupported";
|
|
1122
|
+
};
|
|
1123
|
+
readonly grantId: string & import("effect/Brand").Brand<"effect-auth/OAuthGrantId">;
|
|
1124
|
+
readonly reconnect?: {
|
|
1125
|
+
readonly grantId: string & import("effect/Brand").Brand<"effect-auth/OAuthGrantId">;
|
|
1126
|
+
readonly grantVersion: string & import("effect/Brand").Brand<"effect-auth/SecurityRevision">;
|
|
1127
|
+
readonly tokenVersion: string & import("effect/Brand").Brand<"effect-auth/SecurityRevision">;
|
|
1128
|
+
readonly cohortGeneration: string & import("effect/Brand").Brand<"effect-auth/SecurityRevision">;
|
|
1129
|
+
readonly identity: {
|
|
1130
|
+
readonly provider: string & import("effect/Brand").Brand<"effect-auth/OAuthProviderKey">;
|
|
1131
|
+
readonly issuer: string & import("effect/Brand").Brand<"effect-auth/OAuthIssuer">;
|
|
1132
|
+
readonly subject: string;
|
|
1133
|
+
};
|
|
1134
|
+
readonly configuration: {
|
|
1135
|
+
readonly provider: string & import("effect/Brand").Brand<"effect-auth/OAuthProviderKey">;
|
|
1136
|
+
readonly protocol: "oauth" | "oidc";
|
|
1137
|
+
readonly configurationGeneration: number;
|
|
1138
|
+
readonly issuer: string & import("effect/Brand").Brand<"effect-auth/OAuthIssuer">;
|
|
1139
|
+
readonly responseIssuerMode: "required" | "unsupported";
|
|
1140
|
+
readonly callbackId: string & import("effect/Brand").Brand<"effect-auth/OAuthCallbackId">;
|
|
1141
|
+
readonly redirectUri: string & import("effect/Brand").Brand<"effect-auth/OAuthRedirectUri">;
|
|
1142
|
+
readonly profile: {
|
|
1143
|
+
readonly key: string & import("effect/Brand").Brand<"effect-auth/OAuthPermissionProfileKey">;
|
|
1144
|
+
readonly generation: number;
|
|
1145
|
+
readonly issuance: "active" | "retired";
|
|
1146
|
+
readonly provider: string & import("effect/Brand").Brand<"effect-auth/OAuthProviderKey">;
|
|
1147
|
+
readonly clientRegistrationId: string;
|
|
1148
|
+
readonly scopes: readonly string[];
|
|
1149
|
+
readonly resources: readonly string[];
|
|
1150
|
+
readonly retention: "access-and-refresh" | "access-only";
|
|
1151
|
+
readonly maximumAccessLifetimeMillis: number;
|
|
1152
|
+
readonly maximumRefreshLifetimeMillis?: number | undefined;
|
|
1153
|
+
readonly refreshAheadMillis: number;
|
|
1154
|
+
readonly refresh: "confidential" | "rotating" | "unsupported";
|
|
1155
|
+
readonly revocation: "cohort" | "unsupported";
|
|
1156
|
+
};
|
|
1157
|
+
};
|
|
1158
|
+
} | undefined;
|
|
1159
|
+
readonly maximumEvidenceAgeMillis: number;
|
|
1160
|
+
};
|
|
1161
|
+
readonly sealed: {
|
|
1162
|
+
readonly format: "oauth-xchacha20poly1305-v1";
|
|
1163
|
+
readonly keyId: string;
|
|
1164
|
+
readonly nonce: string;
|
|
1165
|
+
readonly ciphertext: import("effect/Redacted").Redacted<string>;
|
|
1166
|
+
};
|
|
1167
|
+
readonly retentionUntilMillis: number;
|
|
1168
|
+
};
|
|
1169
|
+
}, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/OAuth").OAuthUnavailable, never>;
|
|
1170
|
+
readonly inspectPrepared: (input: import("@yielded/auth/OAuth").OAuthConnectedPreparedAccess) => Effect.Effect<import("@yielded/auth/OAuth").OAuthConnectedPendingFlow | undefined, import("@yielded/auth/OAuth").OAuthUnavailable>;
|
|
1057
1171
|
readonly preflight: (input: import("@yielded/auth/OAuth").OAuthConnectedAccess) => Effect.Effect<import("@yielded/auth/OAuth").OAuthConnectedPendingFlow | undefined, import("@yielded/auth/OAuth").OAuthUnavailable>;
|
|
1058
1172
|
readonly claim: <A>(input: {
|
|
1059
1173
|
readonly access: import("@yielded/auth/OAuth").OAuthConnectedAccess;
|
|
@@ -1695,7 +1809,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
|
|
|
1695
1809
|
readonly hasMore: boolean;
|
|
1696
1810
|
}, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/OAuth").OAuthUnavailable, never>;
|
|
1697
1811
|
};
|
|
1698
|
-
},
|
|
1812
|
+
}, import("@yielded/auth/OAuth").OAuthUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeOAuthConnectedRevocationServices: <T extends AnySQLiteTable<{
|
|
1699
1813
|
dialect: "sqlite";
|
|
1700
1814
|
}>, O extends AnySQLiteTable<{
|
|
1701
1815
|
dialect: "sqlite";
|
|
@@ -1803,7 +1917,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
|
|
|
1803
1917
|
readonly settled: boolean;
|
|
1804
1918
|
}, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/OAuth").OAuthUnavailable>;
|
|
1805
1919
|
};
|
|
1806
|
-
},
|
|
1920
|
+
}, import("@yielded/auth/OAuth").OAuthUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, coordinateOAuthConnected: {
|
|
1807
1921
|
<D extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
|
|
1808
1922
|
dialect: "sqlite";
|
|
1809
1923
|
}>, AC extends AnySQLiteTable<{
|
|
@@ -24,7 +24,7 @@ export declare const makeD1EmailSignInServices: <S extends AnySQLiteTable, I ext
|
|
|
24
24
|
readonly identifier: LoginIdentifier;
|
|
25
25
|
}) => Effect.Effect<Option.Option<import("@yielded/auth/Email").EmailCredentialSnapshot>, EmailUnavailable>;
|
|
26
26
|
};
|
|
27
|
-
},
|
|
27
|
+
}, EmailUnavailable, Database$1>;
|
|
28
28
|
export declare const makeD1EmailAddressServices: <S extends AnySQLiteTable, I extends AnySQLiteTable, C extends AnySQLiteTable, AC extends AnySQLiteTable, M extends AnySQLiteTable, NativeId, PRq extends AnySQLiteTable, PS extends AnySQLiteTable, PG extends AnySQLiteTable, PCn extends AnySQLiteTable, PRs extends AnySQLiteTable, PAev extends AnySQLiteTable, PF extends AnySQLiteTable, PC extends AnySQLiteTable, PSub extends AnySQLiteTable, PI extends AnySQLiteTable, PCr extends AnySQLiteTable, PNativeId>(mapping: D1EmailAddressMapping<S, I, C, AC, M, NativeId>, proofMapping: D1ProofPersistenceMapping<PRq, PS, PG, PCn, PRs, PAev, PF, PC, PSub, PI, PCr, PNativeId>) => Effect.Effect<{
|
|
29
29
|
emailAddressPersistence: {
|
|
30
30
|
readonly target: (input: {
|
|
@@ -44,10 +44,10 @@ export declare const makeD1EmailAddressServices: <S extends AnySQLiteTable, I ex
|
|
|
44
44
|
readonly hasMore: boolean;
|
|
45
45
|
}, A>) => Effect.Effect<PreparedCommit<A>, EmailUnavailable>;
|
|
46
46
|
};
|
|
47
|
-
},
|
|
47
|
+
}, EmailUnavailable, Database$1 | LifecycleHooks>;
|
|
48
48
|
export declare const makeD1EmailRegistrationServices: <Registration, S extends AnySQLiteTable, I extends AnySQLiteTable, C extends AnySQLiteTable, AC extends AnySQLiteTable, Rq extends AnySQLiteTable, NativeId, PRq extends AnySQLiteTable, PS extends AnySQLiteTable, PG extends AnySQLiteTable, PCn extends AnySQLiteTable, PRs extends AnySQLiteTable, PAev extends AnySQLiteTable, PF extends AnySQLiteTable, PC extends AnySQLiteTable, PSub extends AnySQLiteTable, PI extends AnySQLiteTable, PCr extends AnySQLiteTable, PNativeId>(mapping: D1EmailRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>, proofMapping: D1ProofPersistenceMapping<PRq, PS, PG, PCn, PRs, PAev, PF, PC, PSub, PI, PCr, PNativeId>) => Effect.Effect<{
|
|
49
49
|
registrationAuthority: EmailRegistrationAuthority<Registration>;
|
|
50
|
-
},
|
|
50
|
+
}, EmailUnavailable, Database$1 | LifecycleHooks>;
|
|
51
51
|
type CoordinatorError<E> = E | EmailUnavailable | HookConfigurationError;
|
|
52
52
|
export declare function coordinateD1EmailAddress<S extends AnySQLiteTable, I extends AnySQLiteTable, C extends AnySQLiteTable, AC extends AnySQLiteTable, M extends AnySQLiteTable, NativeId, PRq extends AnySQLiteTable, PS extends AnySQLiteTable, PG extends AnySQLiteTable, PCn extends AnySQLiteTable, PRs extends AnySQLiteTable, PAev extends AnySQLiteTable, PF extends AnySQLiteTable, PC extends AnySQLiteTable, PSub extends AnySQLiteTable, PI extends AnySQLiteTable, PCr extends AnySQLiteTable, PNativeId, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
|
|
53
53
|
readonly mapping: D1EmailAddressMapping<S, I, C, AC, M, NativeId>;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { requiredEmailAddressConstraints, requiredEmailRegistrationConstraints } from "./email-model.mjs";
|
|
2
|
-
import { PersistenceMappingError, column, isMappedConstraintConflict, updateValues } from "./model.mjs";
|
|
2
|
+
import { PersistenceMappingError as PersistenceMappingError$1, column, isMappedConstraintConflict, updateValues } from "./model.mjs";
|
|
3
|
+
import { validateDrizzleStorage } from "./storage-validation.mjs";
|
|
3
4
|
import { CurrentEmailSql, currentAddress, decodeEmailSnapshot, emailLookupQuery, sameEmailRevision, snapshotEmailMutation, validEmailSignInConstraints, validateEmailAuthority } from "./email-sql.mjs";
|
|
5
|
+
import { readEmailRegistrationTarget } from "./email-registration.mjs";
|
|
4
6
|
import { Database } from "./d1-database.mjs";
|
|
5
7
|
import { D1BatchStatements } from "./D1BatchStatements.mjs";
|
|
6
8
|
import { CurrentD1PlanningDatabase, makeD1Owner } from "./d1-planning.mjs";
|
|
9
|
+
import { nativeDatabase } from "./native-database.mjs";
|
|
7
10
|
import { compileD1ProofCompletionPlan } from "./d1-proofs.mjs";
|
|
11
|
+
import { NativeDatabase } from "@yielded/auth-persistence/Adapter";
|
|
8
12
|
import { and, eq, inArray, lte, sql } from "drizzle-orm";
|
|
9
13
|
import { Cause, Context, DateTime, Effect, Option, Schema } from "effect";
|
|
10
14
|
import { CurrentCommitJournal, HookConfigurationError, LifecycleHooks, coordinateCommit, hasCommitScope } from "@yielded/auth/Hooks";
|
|
@@ -65,7 +69,7 @@ const driverValues = (values, entries) => ({
|
|
|
65
69
|
});
|
|
66
70
|
const allocate = (asynchronous, synchronous) => asynchronous !== void 0 ? asynchronous : synchronous === void 0 ? Effect.fail(unavailable()) : Effect.try({
|
|
67
71
|
try: synchronous,
|
|
68
|
-
catch: (cause) => new PersistenceMappingError({
|
|
72
|
+
catch: (cause) => new PersistenceMappingError$1({
|
|
69
73
|
operation: "mapping",
|
|
70
74
|
cause
|
|
71
75
|
})
|
|
@@ -314,6 +318,12 @@ const registrationPlan = Effect.fn("Drizzle.registrationPlan")(function* (mappin
|
|
|
314
318
|
receipt: prepare({ _tag: "Rejected" }, journal),
|
|
315
319
|
statements: []
|
|
316
320
|
};
|
|
321
|
+
const target = mapping.mode === "atomic" ? yield* readEmailRegistrationTarget(mapping, input.identifier, false) : void 0;
|
|
322
|
+
if (target?._tag === "Rejected") return {
|
|
323
|
+
receipt: prepare({ _tag: "Rejected" }, journal),
|
|
324
|
+
statements: []
|
|
325
|
+
};
|
|
326
|
+
if (target?._tag === "Reserved" && (allocated.displacedSecurityRevision === void 0 || allocated.displacedSecurityRevision === target.securityRevision || allocated.identifierRevision === target.bindingRevision)) return yield* unavailable();
|
|
317
327
|
const intent = {
|
|
318
328
|
moduleId: input.moduleId,
|
|
319
329
|
commandId: input.commandId,
|
|
@@ -358,15 +368,30 @@ const registrationPlan = Effect.fn("Drizzle.registrationPlan")(function* (mappin
|
|
|
358
368
|
};
|
|
359
369
|
const nativeSubjectId = allocated.nativeSubjectId;
|
|
360
370
|
desired = { _tag: "Registered" };
|
|
371
|
+
const i = mapping.identifier;
|
|
372
|
+
const s = mapping.subject;
|
|
373
|
+
const marker = `effect-auth-proof-guard:protected:${input.completion.input.continuationId}`;
|
|
374
|
+
if (target?._tag === "Reserved") statements.push(yield* assertion(and(existsSql(sql`select 1 from ${i.table} where
|
|
375
|
+
${column(i.table, i.namespace)}=${sql.param(input.identifier.namespace, column(i.table, i.namespace))}
|
|
376
|
+
and ${column(i.table, i.value)}=${sql.param(input.identifier.value, column(i.table, i.value))}
|
|
377
|
+
and ${column(i.table, i.subjectId)}=${sql.param(target.nativeSubjectId, column(i.table, i.subjectId))}
|
|
378
|
+
and ${column(i.table, i.bindingRevision)}=${sql.param(target.bindingRevision, column(i.table, i.bindingRevision))}
|
|
379
|
+
and ${column(i.table, i.verifiedAt)} is null`), existsSql(sql`select 1 from ${s.table} where
|
|
380
|
+
${column(s.table, s.id)}=${sql.param(target.nativeSubjectId, column(s.table, s.id))}
|
|
381
|
+
and ${column(s.table, s.securityRevision)}=${sql.param(target.securityRevision, column(s.table, s.securityRevision))}`)), marker));
|
|
361
382
|
statements.push(yield* statement(database.insert(mapping.subject.table).values(mapping.provisioning.encodeSubjectInsert(intent, {
|
|
362
383
|
nativeSubjectId,
|
|
363
384
|
securityRevision: allocated.securityRevision
|
|
364
|
-
}))), yield* statement(database.
|
|
385
|
+
}))), ...target?._tag === "Reserved" ? [yield* statement(database.update(i.table).set(updateValues([
|
|
386
|
+
[i.subjectId, nativeSubjectId],
|
|
387
|
+
[i.verifiedAt, mapping.encodeInstant(transitionMillis)],
|
|
388
|
+
[i.bindingRevision, allocated.identifierRevision]
|
|
389
|
+
])).where(and(eq(column(i.table, i.namespace), input.identifier.namespace), eq(column(i.table, i.value), input.identifier.value), eq(column(i.table, i.subjectId), target.nativeSubjectId), eq(column(i.table, i.bindingRevision), target.bindingRevision), sql`${column(i.table, i.verifiedAt)} is null`))), yield* statement(database.update(s.table).set(updateValues([[s.securityRevision, allocated.displacedSecurityRevision]])).where(and(eq(column(s.table, s.id), target.nativeSubjectId), eq(column(s.table, s.securityRevision), target.securityRevision))))] : [yield* statement(database.insert(i.table).values(driverValues(i.encodeVerifiedInsert({
|
|
365
390
|
identifier: input.identifier,
|
|
366
391
|
subjectId: nativeSubjectId,
|
|
367
392
|
verifiedAtMillis: transitionMillis,
|
|
368
393
|
bindingRevision: allocated.identifierRevision
|
|
369
|
-
}), [[
|
|
394
|
+
}), [[i.verifiedAt, mapping.encodeInstant(transitionMillis)]])))], yield* statement(database.insert(mapping.credential.table).values(mapping.credential.encodeVerifiedInsert({
|
|
370
395
|
moduleId: input.moduleId,
|
|
371
396
|
subjectId: nativeSubjectId,
|
|
372
397
|
credentialId: allocated.credentialId,
|
|
@@ -398,7 +423,9 @@ const registrationPlan = Effect.fn("Drizzle.registrationPlan")(function* (mappin
|
|
|
398
423
|
const aSubject = column(mapping.authorityCredential.table, mapping.authorityCredential.subjectId);
|
|
399
424
|
const aId = column(mapping.authorityCredential.table, mapping.authorityCredential.credentialId);
|
|
400
425
|
const aRevision = column(mapping.authorityCredential.table, mapping.authorityCredential.revision);
|
|
401
|
-
applied = and(
|
|
426
|
+
applied = and(target?._tag === "Reserved" ? existsSql(sql`select 1 from ${s.table} where
|
|
427
|
+
${sId}=${sql.param(target.nativeSubjectId, sId)}
|
|
428
|
+
and ${sRevision}=${sql.param(allocated.displacedSecurityRevision, sRevision)}`) : sql`true`, existsSql(sql`select 1 from ${mapping.subject.table} where ${sId}=${sql.param(nativeSubjectId, sId)} and ${sStatus}=${sql.param(mapping.subject.d1ActiveStatusValue, sStatus)} and ${sRevision}=${sql.param(allocated.securityRevision, sRevision)}`), existsSql(sql`select 1 from ${mapping.identifier.table} where ${iNamespace}=${sql.param(input.identifier.namespace, iNamespace)} and ${iValue}=${sql.param(input.identifier.value, iValue)} and ${iSubject}=${sql.param(nativeSubjectId, iSubject)} and ${iVerifiedAt}=${sql.param(mapping.encodeInstant(transitionMillis), iVerifiedAt)} and ${iRevision}=${sql.param(allocated.identifierRevision, iRevision)} and ${mapping.identifier.d1CurrentCondition({
|
|
402
429
|
identifier: input.identifier,
|
|
403
430
|
nativeSubjectId,
|
|
404
431
|
bindingRevision: allocated.identifierRevision
|
|
@@ -436,6 +463,7 @@ const makeRegistrationPlans = (mapping, proofMapping) => ({
|
|
|
436
463
|
const atomic = mapping.mode === "atomic";
|
|
437
464
|
const credentialId = atomic ? yield* allocate(mapping.allocateCredentialId, mapping.allocateCredentialIdSync) : void 0;
|
|
438
465
|
const securityRevision = atomic ? yield* allocate(mapping.allocateRevision, mapping.allocateRevisionSync) : void 0;
|
|
466
|
+
const displacedSecurityRevision = atomic ? yield* allocate(mapping.allocateRevision, mapping.allocateRevisionSync) : void 0;
|
|
439
467
|
const identifierRevision = atomic ? yield* allocate(mapping.allocateRevision, mapping.allocateRevisionSync) : void 0;
|
|
440
468
|
const credentialRevision = atomic ? yield* allocate(mapping.allocateRevision, mapping.allocateRevisionSync) : void 0;
|
|
441
469
|
const nativeSubjectId = atomic && mapping.provisioning.idMode !== "generated" ? yield* allocate(mapping.provisioning.allocateSubjectId, mapping.provisioning.allocateSubjectIdSync) : void 0;
|
|
@@ -443,6 +471,7 @@ const makeRegistrationPlans = (mapping, proofMapping) => ({
|
|
|
443
471
|
return yield* registrationPlan(mapping, proofMapping, input, inspected, {
|
|
444
472
|
...credentialId === void 0 ? {} : { credentialId },
|
|
445
473
|
...securityRevision === void 0 ? {} : { securityRevision },
|
|
474
|
+
...displacedSecurityRevision === void 0 ? {} : { displacedSecurityRevision },
|
|
446
475
|
...identifierRevision === void 0 ? {} : { identifierRevision },
|
|
447
476
|
...credentialRevision === void 0 ? {} : { credentialRevision },
|
|
448
477
|
...nativeSubjectId === void 0 ? {} : { nativeSubjectId },
|
|
@@ -450,16 +479,20 @@ const makeRegistrationPlans = (mapping, proofMapping) => ({
|
|
|
450
479
|
}, prepare);
|
|
451
480
|
})
|
|
452
481
|
});
|
|
453
|
-
const makeD1EmailSignInServices = (mapping) => Effect.
|
|
482
|
+
const makeD1EmailSignInServices = (mapping) => Effect.flatMap(nativeDatabase(Database), (database) => validateDrizzleStorage(mapping).pipe(Effect.provideService(NativeDatabase, database), Effect.mapError(unavailable), Effect.as({ emailSignInTargets: EmailSignInTargets.of({ lookup: (input) => {
|
|
454
483
|
if (!validEmailSignInConstraints(mapping)) return Effect.fail(unavailable());
|
|
455
484
|
return emailLookupRows(mapping, input.moduleId, input.identifier).pipe(Effect.flatMap((rows) => {
|
|
456
485
|
const row = rows[0];
|
|
457
486
|
if (row === void 0) return Effect.succeed(Option.none());
|
|
458
487
|
return decodeEmailSnapshot(mapping, input.moduleId, input.identifier, row).pipe(Effect.map((snapshot) => snapshot === void 0 ? Option.none() : Option.some(snapshot)));
|
|
459
488
|
}), Effect.provideService(CurrentD1PlanningDatabase, database), translateFailure);
|
|
460
|
-
} }) }));
|
|
489
|
+
} }) })));
|
|
461
490
|
const makeD1EmailAddressServices = Effect.fnUntraced(function* (mapping, proofMapping) {
|
|
462
491
|
const database = yield* Database;
|
|
492
|
+
yield* validateDrizzleStorage({
|
|
493
|
+
...mapping,
|
|
494
|
+
proof: proofMapping
|
|
495
|
+
}).pipe(Effect.provideServiceEffect(NativeDatabase, nativeDatabase(Database)), Effect.mapError(unavailable));
|
|
463
496
|
const hooks = yield* LifecycleHooks;
|
|
464
497
|
const plans = makeAddressPlans(mapping, proofMapping);
|
|
465
498
|
const run = (plan) => Effect.gen(function* () {
|
|
@@ -476,6 +509,10 @@ const makeD1EmailAddressServices = Effect.fnUntraced(function* (mapping, proofMa
|
|
|
476
509
|
});
|
|
477
510
|
const makeD1EmailRegistrationServices = Effect.fnUntraced(function* (mapping, proofMapping) {
|
|
478
511
|
const database = yield* Database;
|
|
512
|
+
yield* validateDrizzleStorage({
|
|
513
|
+
...mapping,
|
|
514
|
+
proof: proofMapping
|
|
515
|
+
}).pipe(Effect.provideServiceEffect(NativeDatabase, nativeDatabase(Database)), Effect.mapError(unavailable));
|
|
479
516
|
const hooks = yield* LifecycleHooks;
|
|
480
517
|
const plans = makeRegistrationPlans(mapping, proofMapping);
|
|
481
518
|
const run = (plan) => Effect.gen(function* () {
|
|
@@ -488,7 +525,11 @@ const makeD1EmailRegistrationServices = Effect.fnUntraced(function* (mapping, pr
|
|
|
488
525
|
} };
|
|
489
526
|
});
|
|
490
527
|
function coordinateD1EmailAddress(acquire, options, body) {
|
|
491
|
-
return Effect.flatMap(acquire, (database) => Effect.gen(function* () {
|
|
528
|
+
return Effect.flatMap(nativeDatabase(acquire), (database) => Effect.gen(function* () {
|
|
529
|
+
yield* validateDrizzleStorage({
|
|
530
|
+
...options.mapping,
|
|
531
|
+
proof: options.proofMapping
|
|
532
|
+
}).pipe(Effect.mapError(unavailable));
|
|
492
533
|
const hooks = yield* LifecycleHooks;
|
|
493
534
|
if (yield* hasCommitScope) return yield* unavailable();
|
|
494
535
|
return (yield* coordinateCommit(() => Effect.gen(function* () {
|
|
@@ -525,10 +566,14 @@ function coordinateD1EmailAddress(acquire, options, body) {
|
|
|
525
566
|
yield* database.$client.batch(statements).pipe(Effect.catchCause((cause) => Effect.failCause(Cause.map(cause, (error) => everyFailureMatches(cause, mutation?.retryable) ? unavailable() : error))), translateFailure);
|
|
526
567
|
return value;
|
|
527
568
|
}), { mode: "batch" }).pipe(Effect.provideService(LifecycleHooks, hooks))).value;
|
|
528
|
-
}));
|
|
569
|
+
}).pipe(Effect.provideService(NativeDatabase, database)));
|
|
529
570
|
}
|
|
530
571
|
function coordinateD1EmailRegistration(acquire, options, body) {
|
|
531
|
-
return Effect.flatMap(acquire, (database) => Effect.gen(function* () {
|
|
572
|
+
return Effect.flatMap(nativeDatabase(acquire), (database) => Effect.gen(function* () {
|
|
573
|
+
yield* validateDrizzleStorage({
|
|
574
|
+
...options.mapping,
|
|
575
|
+
proof: options.proofMapping
|
|
576
|
+
}).pipe(Effect.mapError(unavailable));
|
|
532
577
|
const hooks = yield* LifecycleHooks;
|
|
533
578
|
if (yield* hasCommitScope) return yield* unavailable();
|
|
534
579
|
return (yield* coordinateCommit(() => Effect.gen(function* () {
|
|
@@ -562,7 +607,7 @@ function coordinateD1EmailRegistration(acquire, options, body) {
|
|
|
562
607
|
yield* database.$client.batch(statements).pipe(Effect.catchCause((cause) => Effect.failCause(Cause.map(cause, (error) => everyFailureMatches(cause, mutation?.retryable) ? unavailable() : error))), translateFailure);
|
|
563
608
|
return value;
|
|
564
609
|
}), { mode: "batch" }).pipe(Effect.provideService(LifecycleHooks, hooks))).value;
|
|
565
|
-
}));
|
|
610
|
+
}).pipe(Effect.provideService(NativeDatabase, database)));
|
|
566
611
|
}
|
|
567
612
|
const translateFailure = (effect) => reportPersistenceFailure(effect, (error) => Schema.is(EmailUnavailable)(error) || Schema.is(ProofUnavailable)(error) || Schema.is(HookConfigurationError)(error)).pipe(Effect.catchCause((cause) => Effect.failCause(Cause.map(cause, () => unavailable()))));
|
|
568
613
|
const executeStandalone = (plan, retries = 2) => Effect.suspend(() => {
|