@yielded/auth-persistence 0.1.0-beta.7 → 0.1.0-beta.9
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 +9 -0
- package/dist/DrizzleD1.d.mts +9 -9
- package/dist/DrizzleLibsql.d.mts +25 -25
- package/dist/DrizzleLibsql.mjs +7 -22
- package/dist/DrizzleLibsql.mjs.map +1 -1
- package/dist/DrizzleMysql2.d.mts +15 -15
- package/dist/DrizzlePglite.d.mts +9 -9
- package/dist/DrizzlePostgres.d.mts +15 -15
- package/dist/DrizzleSqliteBun.d.mts +18 -18
- package/dist/DrizzleSqliteDo.d.mts +29 -29
- package/dist/DrizzleSqliteNode.d.mts +24 -24
- package/dist/DrizzleSqliteWasm.d.mts +24 -24
- package/dist/_virtual/_rolldown/runtime.mjs +13 -0
- package/dist/drizzle/D1BatchStatements.d.mts +1 -2
- package/dist/drizzle/SuppliedService.d.mts +1 -2
- package/dist/drizzle/d1-emails.d.mts +5 -6
- package/dist/drizzle/d1-identity.d.mts +2 -3
- package/dist/drizzle/d1-oauth.d.mts +10 -11
- package/dist/drizzle/d1-passkey.d.mts +5 -6
- package/dist/drizzle/d1-password-prepared.d.mts +2 -3
- package/dist/drizzle/d1-passwords.d.mts +4 -5
- package/dist/drizzle/d1-phone.d.mts +2 -3
- package/dist/drizzle/d1-planning.d.mts +1 -2
- package/dist/drizzle/d1-proofs.d.mts +2 -3
- package/dist/drizzle/d1-sessions.d.mts +10 -11
- package/dist/drizzle/d1-totp.d.mts +2 -3
- package/dist/drizzle/email-model.d.mts +30 -31
- package/dist/drizzle/email-registration.d.mts +1 -2
- package/dist/drizzle/email-target.d.mts +3 -4
- package/dist/drizzle/model.d.mts +42 -42
- package/dist/drizzle/model.mjs +4 -6
- package/dist/drizzle/model.mjs.map +1 -1
- package/dist/drizzle/mysql-emails.d.mts +7 -8
- package/dist/drizzle/mysql-identity.d.mts +2 -3
- package/dist/drizzle/mysql-password-prepared.d.mts +3 -4
- package/dist/drizzle/mysql-passwords.d.mts +6 -7
- package/dist/drizzle/mysql-proofs.d.mts +3 -4
- package/dist/drizzle/mysql-sessions.d.mts +15 -16
- package/dist/drizzle/mysql.d.mts +9 -10
- package/dist/drizzle/mysql.mjs +1 -1
- package/dist/drizzle/oauth-connected-model.d.mts +21 -22
- package/dist/drizzle/oauth-connected-reference.d.mts +1 -2
- package/dist/drizzle/oauth-connected-state.d.mts +1950 -7
- package/dist/drizzle/oauth-connected-target.d.mts +9 -10
- package/dist/drizzle/oauth-flow.d.mts +22 -2
- package/dist/drizzle/oauth-model.d.mts +45 -46
- package/dist/drizzle/oauth-owner.d.mts +10 -2
- package/dist/drizzle/oauth-target.d.mts +9 -10
- package/dist/drizzle/passkey-model.d.mts +34 -35
- package/dist/drizzle/passkey-registration-ceremony-model.d.mts +5 -6
- package/dist/drizzle/passkey-write-model.d.mts +13 -14
- package/dist/drizzle/password-model.d.mts +29 -30
- package/dist/drizzle/password-prepared-model.d.mts +10 -11
- package/dist/drizzle/password-prepared-target.d.mts +1 -2
- package/dist/drizzle/password-registration.d.mts +1 -2
- package/dist/drizzle/password-target.d.mts +2 -3
- package/dist/drizzle/pg-emails.d.mts +7 -8
- package/dist/drizzle/pg-password-prepared.d.mts +3 -4
- package/dist/drizzle/pg-passwords.d.mts +6 -7
- package/dist/drizzle/pg-proofs.d.mts +3 -4
- package/dist/drizzle/pg-sessions.d.mts +15 -16
- package/dist/drizzle/pg.d.mts +11 -12
- package/dist/drizzle/pg.mjs +1 -1
- package/dist/drizzle/phone-model.d.mts +9 -10
- package/dist/drizzle/phone-target.d.mts +1 -2
- package/dist/drizzle/proof-model.d.mts +25 -26
- package/dist/drizzle/proof-target.d.mts +1 -2
- package/dist/drizzle/session-model.d.mts +25 -26
- package/dist/drizzle/session-target.d.mts +4 -5
- package/dist/drizzle/sqlite.d.mts +9 -10
- package/dist/drizzle/sqlite.mjs +1 -1
- package/dist/drizzle/standalone-guard.mjs +3 -5
- package/dist/drizzle/standalone-guard.mjs.map +1 -1
- package/dist/drizzle/step-up-model.d.mts +6 -7
- package/dist/drizzle/totp-model.d.mts +7 -8
- package/dist/drizzle/totp-state.d.mts +2 -3
- package/dist/drizzle/totp-target.d.mts +1 -2
- package/dist/drizzle/transaction-mysql.mjs +1 -0
- package/dist/drizzle/transaction-mysql.mjs.map +1 -1
- package/dist/drizzle/transaction-owner.d.mts +3 -2
- package/dist/index.d.mts +3 -1
- package/dist/index.mjs +3 -1
- package/dist/internal/configuration.d.mts +19 -19
- package/dist/internal/mapping-error.d.mts +2 -3
- package/dist/internal/oauth-app.d.mts +11 -0
- package/dist/internal/oauth-app.mjs +57 -0
- package/dist/internal/oauth-app.mjs.map +1 -0
- package/dist/internal/oauth-server.d.mts +10 -0
- package/dist/internal/oauth-server.mjs +66 -0
- package/dist/internal/oauth-server.mjs.map +1 -0
- package/dist/internal/passkey/target.d.mts +2 -3
- package/dist/internal/passkeys.mjs +2 -1
- package/dist/internal/passkeys.mjs.map +1 -1
- package/dist/internal/persistence.mjs +3 -2
- package/dist/internal/persistence.mjs.map +1 -1
- package/dist/internal/sql-persistence.d.mts +1 -2
- package/dist/internal/sql-table.d.mts +6 -7
- package/dist/internal/sql-table.mjs +12 -2
- package/dist/internal/sql-table.mjs.map +1 -1
- package/dist/internal/standalone.mjs +13 -0
- package/dist/internal/standalone.mjs.map +1 -0
- package/dist/internal/storage-tables.d.mts +5 -6
- package/dist/internal/transaction-execution-kernel.d.mts +2 -3
- package/dist/internal/transaction-execution-kernel.mjs +3 -5
- package/dist/internal/transaction-execution-kernel.mjs.map +1 -1
- package/dist/internal/transaction-kernel.d.mts +49 -2
- package/package.json +1 -1
- package/src/DrizzleLibsql.ts +10 -54
- package/src/drizzle/model.ts +8 -10
- package/src/drizzle/standalone-guard.ts +4 -9
- package/src/drizzle/transaction-mysql.ts +2 -0
- package/src/index.ts +2 -0
- package/src/internal/oauth-app.ts +82 -0
- package/src/internal/oauth-server.ts +89 -0
- package/src/internal/passkeys.ts +2 -6
- package/src/internal/persistence.ts +3 -5
- package/src/internal/sql-table.ts +17 -2
- package/src/internal/standalone.ts +30 -0
- package/src/internal/transaction-execution-kernel.ts +3 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.mjs","names":[],"sources":["../../src/drizzle/model.ts"],"sourcesContent":["import { AuthStore } from \"@yielded/auth/AuthStore\";\nimport { AuthStoreError } from \"@yielded/auth/Errors\";\nimport {\n ExternalIdentityMutation,\n SubjectProvisioner,\n type SubjectProvisioningInput,\n type ExternalIdentity,\n type LoginIdentifier,\n} from \"@yielded/auth/Identity\";\nimport { OAuthStateStore, type OAuthState } from \"@yielded/auth/OAuth\";\nimport {\n type ConsumeChallenge,\n type NewChallenge,\n type NewRegistration,\n type PendingRegistration,\n type SubjectId,\n} from \"@yielded/auth/Schema\";\nimport {\n getTableColumns,\n type AnyColumn,\n type InferInsertModel,\n type InferSelectModel,\n type Table,\n} from \"drizzle-orm\";\nimport { Context, DateTime, Effect, Layer, Option } from \"effect\";\nimport type * as SqlClient from \"effect/unstable/sql/SqlClient\";\n\nexport type CommitMode = \"interactive\" | \"synchronous\" | \"batch\";\n\n/**\n * Ordinary error-channel consumes must own their commit. Coordinated callers\n * use the decision methods inside their outer transaction and translate only\n * after that owner commits.\n */\nexport interface SqlClientTransactionDatabase {\n readonly $client: Pick<SqlClient.SqlClient, \"transactionService\">;\n}\n\nexport const requireStandaloneConsume = (\n database: SqlClientTransactionDatabase,\n): Effect.Effect<void, AuthStoreError> =>\n Effect.serviceOption(database.$client.transactionService).pipe(\n Effect.flatMap(\n Option.match({\n onNone: () => Effect.void,\n onSome: () =>\n AuthStoreError.make({\n message: \"Use the decision consume API inside an outer database transaction\",\n }),\n }),\n ),\n );\n\nexport type { ChallengeConsumeDecision } from \"@yielded/auth/Persistence\";\nexport type { ConsumeDecision } from \"@yielded/auth/AuthStore\";\n\nexport { PersistenceMappingError, isMappedConstraintConflict } from \"../internal/mapping-error\";\nimport type { PersistenceMappingError } from \"../internal/mapping-error\";\n\nexport interface InstantCodec<NativeInstant> {\n readonly encode: (instant: DateTime.Utc) => NativeInstant;\n readonly decode: (native: NativeInstant) => Effect.Effect<DateTime.Utc, PersistenceMappingError>;\n}\n\nexport interface RequiredAuthStoreConstraints {\n readonly series: \"unique(namespace,value,purpose)\";\n readonly challengeDigest: \"unique(tokenDigest)\";\n readonly registrationDigest: \"unique(tokenDigest)\";\n}\n\nexport interface RequiredOAuthStateConstraints {\n readonly oauthStateDigest: \"unique(stateDigest)\";\n}\n\nexport interface RequiredAuthConstraints\n extends RequiredAuthStoreConstraints, RequiredOAuthStateConstraints {}\n\nexport const requiredAuthConstraints: RequiredAuthConstraints = {\n series: \"unique(namespace,value,purpose)\",\n challengeDigest: \"unique(tokenDigest)\",\n registrationDigest: \"unique(tokenDigest)\",\n oauthStateDigest: \"unique(stateDigest)\",\n};\n\nexport const requiredAuthStoreConstraints: RequiredAuthStoreConstraints = {\n series: \"unique(namespace,value,purpose)\",\n challengeDigest: \"unique(tokenDigest)\",\n registrationDigest: \"unique(tokenDigest)\",\n};\n\nexport const requiredOAuthStateConstraints: RequiredOAuthStateConstraints = {\n oauthStateDigest: \"unique(stateDigest)\",\n};\n\ntype ColumnKey<T extends Table> = Extract<keyof T[\"_\"][\"columns\"], string>;\n\nexport interface ChallengeRecord {\n readonly challenge: NewChallenge;\n readonly namespace: string;\n readonly failedAttempts: number;\n readonly consumed: boolean;\n}\n\nexport interface ChallengeColumns<T extends Table> {\n readonly challengeId: ColumnKey<T>;\n readonly tokenDigest: ColumnKey<T>;\n readonly namespace: ColumnKey<T>;\n readonly value: ColumnKey<T>;\n readonly purpose: ColumnKey<T>;\n readonly otpKeyId: ColumnKey<T>;\n readonly otpDigest: ColumnKey<T>;\n readonly issuedAt: ColumnKey<T>;\n readonly expiresAt: ColumnKey<T>;\n readonly attemptLimit: ColumnKey<T>;\n readonly failedAttempts: ColumnKey<T>;\n readonly consumed: ColumnKey<T>;\n}\n\n/**\n * Inputs are immutable server-created issuances. Replacements must advance\n * issuedAt; equal or older issuances fail even after consumption or expiry.\n * Instant encoding must preserve this ordering. Retain the series row as an\n * issuance watermark until every previously accepted issuance has expired;\n * current-row expiry alone is insufficient if historical lifetimes were longer.\n */\nexport interface ChallengeTableMapping<T extends Table> {\n readonly table: T;\n readonly columns: ChallengeColumns<T>;\n readonly identifierNamespace: string;\n readonly encodeInstant: (instant: DateTime.Utc) => unknown;\n readonly encodeInsert: (\n input: NewChallenge,\n state: {\n readonly namespace: string;\n readonly failedAttempts: number;\n readonly consumed: false;\n },\n ) => InferInsertModel<T>;\n readonly encodeUpdate: (\n input: NewChallenge,\n state: {\n readonly namespace: string;\n readonly failedAttempts: unknown;\n readonly consumed: false;\n },\n ) => Readonly<Record<string, unknown>>;\n readonly decode: (\n row: InferSelectModel<T>,\n ) => Effect.Effect<ChallengeRecord, PersistenceMappingError>;\n}\n\nexport interface RegistrationRecord {\n readonly registration: PendingRegistration;\n readonly consumed: boolean;\n}\n\nexport interface RegistrationColumns<T extends Table> {\n readonly registrationId: ColumnKey<T>;\n readonly tokenDigest: ColumnKey<T>;\n readonly expiresAt: ColumnKey<T>;\n readonly consumed: ColumnKey<T>;\n}\n\nexport interface RegistrationTableMapping<T extends Table> {\n readonly table: T;\n readonly columns: RegistrationColumns<T>;\n readonly encodeInstant: (instant: DateTime.Utc) => unknown;\n readonly encodeInsert: (input: NewRegistration, consumed: false) => InferInsertModel<T>;\n readonly decode: (\n row: InferSelectModel<T>,\n ) => Effect.Effect<RegistrationRecord, PersistenceMappingError>;\n}\n\nexport interface OAuthStateColumns<T extends Table> {\n readonly stateDigest: ColumnKey<T>;\n readonly expiresAt: ColumnKey<T>;\n readonly consumed: ColumnKey<T>;\n}\n\nexport interface OAuthStateTableMapping<T extends Table> {\n readonly table: T;\n readonly columns: OAuthStateColumns<T>;\n readonly encodeInstant: (instant: DateTime.Utc) => unknown;\n readonly encodeInsert: (state: OAuthState, consumed: false) => InferInsertModel<T>;\n readonly decode: (\n row: InferSelectModel<T>,\n ) => Effect.Effect<\n { readonly state: OAuthState; readonly consumed: boolean },\n PersistenceMappingError\n >;\n}\n\nexport interface AuthStoreTables<Challenge extends Table, Registration extends Table> {\n readonly constraints: RequiredAuthStoreConstraints;\n readonly challenge: ChallengeTableMapping<Challenge>;\n readonly registration: RegistrationTableMapping<Registration>;\n}\n\nexport interface OAuthStateTables<State extends Table> {\n readonly constraints: RequiredOAuthStateConstraints;\n readonly oauthState: OAuthStateTableMapping<State>;\n}\n\nexport interface AuthTables<\n Challenge extends Table,\n Registration extends Table,\n State extends Table,\n> {\n readonly constraints: RequiredAuthConstraints;\n readonly challenge: ChallengeTableMapping<Challenge>;\n readonly registration: RegistrationTableMapping<Registration>;\n readonly oauthState: OAuthStateTableMapping<State>;\n}\n\nexport interface RequiredIdentityConstraints {\n readonly identifier: \"unique(namespace,value)\";\n readonly externalIdentity: \"unique(provider,issuer,subject)\";\n readonly provisioningRequest: \"unique(requestId)\";\n readonly provisioningSubject: \"notNull(provisioningRequest.subjectId)\";\n}\n\nexport interface RequiredSubjectProvisioningConstraints {\n readonly identifier: \"unique(namespace,value)\";\n readonly provisioningRequest: \"unique(requestId)\";\n readonly provisioningSubject: \"notNull(provisioningRequest.subjectId)\";\n}\n\nexport interface RequiredExternalIdentityConstraints {\n readonly externalIdentity: \"unique(provider,issuer,subject)\";\n}\n\nexport const requiredIdentityConstraints: RequiredIdentityConstraints = {\n identifier: \"unique(namespace,value)\",\n externalIdentity: \"unique(provider,issuer,subject)\",\n provisioningRequest: \"unique(requestId)\",\n provisioningSubject: \"notNull(provisioningRequest.subjectId)\",\n};\n\nexport const requiredSubjectProvisioningConstraints: RequiredSubjectProvisioningConstraints = {\n identifier: \"unique(namespace,value)\",\n provisioningRequest: \"unique(requestId)\",\n provisioningSubject: \"notNull(provisioningRequest.subjectId)\",\n};\n\nexport const requiredExternalIdentityConstraints: RequiredExternalIdentityConstraints = {\n externalIdentity: \"unique(provider,issuer,subject)\",\n};\n\nexport interface SubjectIdCodec<NativeId> {\n readonly toNative: (id: SubjectId) => Effect.Effect<NativeId, PersistenceMappingError>;\n readonly toSubject: (id: NativeId) => Effect.Effect<SubjectId, PersistenceMappingError>;\n readonly equals: (left: NativeId, right: NativeId) => boolean;\n}\n\nexport interface SubjectProvisioningTables<\n Subject extends Table,\n Identifier extends Table,\n Request extends Table,\n NativeId,\n> {\n readonly constraints: RequiredSubjectProvisioningConstraints;\n readonly subject: {\n readonly table: Subject;\n readonly id: ColumnKey<Subject>;\n readonly status: ColumnKey<Subject>;\n readonly isActiveStatus: (value: unknown) => boolean;\n readonly encodeInsert: (\n input: SubjectProvisioningInput,\n allocatedId: NativeId | undefined,\n ) => InferInsertModel<Subject>;\n readonly allocateId?: Effect.Effect<NativeId, PersistenceMappingError>;\n /** Required instead of allocateId when a synchronous-only DO transaction preallocates IDs. */\n readonly allocateIdSync?: () => NativeId;\n /** Decodes MySQL `$returningId()` for an autoincrement/runtime-default key. */\n readonly decodeGeneratedId?: (\n rows: ReadonlyArray<unknown>,\n ) => Effect.Effect<NativeId, PersistenceMappingError>;\n };\n readonly identifier: {\n readonly table: Identifier;\n readonly namespace: ColumnKey<Identifier>;\n readonly value: ColumnKey<Identifier>;\n readonly subjectId: ColumnKey<Identifier>;\n readonly encodeInsert: (\n identifier: LoginIdentifier,\n subjectId: NativeId,\n verifiedAt: DateTime.Utc | undefined,\n ) => InferInsertModel<Identifier>;\n };\n readonly provisioningRequest: {\n readonly table: Request;\n readonly requestId: ColumnKey<Request>;\n readonly fingerprint: ColumnKey<Request>;\n readonly subjectId: ColumnKey<Request>;\n readonly encodeInsert: (\n requestId: string,\n fingerprint: string,\n subjectId: NativeId,\n ) => InferInsertModel<Request>;\n };\n readonly subjectId: SubjectIdCodec<NativeId>;\n /** Narrows only database constraint failures; every other cause is unavailable. */\n readonly isConstraintConflict: (cause: unknown) => boolean;\n}\n\nexport interface ExternalIdentityTables<Subject extends Table, External extends Table, NativeId> {\n readonly constraints: RequiredExternalIdentityConstraints;\n readonly subject: {\n readonly table: Subject;\n readonly id: ColumnKey<Subject>;\n readonly status: ColumnKey<Subject>;\n readonly isActiveStatus: (value: unknown) => boolean;\n };\n readonly externalIdentity: {\n readonly table: External;\n readonly provider: ColumnKey<External>;\n readonly issuer: ColumnKey<External>;\n readonly subject: ColumnKey<External>;\n readonly subjectId: ColumnKey<External>;\n readonly encodeInsert: (\n identity: ExternalIdentity,\n subjectId: NativeId,\n ) => InferInsertModel<External>;\n };\n readonly subjectId: SubjectIdCodec<NativeId>;\n readonly isConstraintConflict: (cause: unknown) => boolean;\n}\n\nexport interface IdentityTables<\n Subject extends Table,\n Identifier extends Table,\n External extends Table,\n Request extends Table,\n NativeId,\n> {\n readonly constraints: RequiredIdentityConstraints;\n readonly subject: SubjectProvisioningTables<Subject, Identifier, Request, NativeId>[\"subject\"];\n readonly identifier: SubjectProvisioningTables<\n Subject,\n Identifier,\n Request,\n NativeId\n >[\"identifier\"];\n readonly externalIdentity: ExternalIdentityTables<\n Subject,\n External,\n NativeId\n >[\"externalIdentity\"];\n readonly provisioningRequest: SubjectProvisioningTables<\n Subject,\n Identifier,\n Request,\n NativeId\n >[\"provisioningRequest\"];\n readonly subjectId: SubjectIdCodec<NativeId>;\n readonly isConstraintConflict: (cause: unknown) => boolean;\n}\n\n/** Extra encoders used by D1's ordered batch when the subject id is database-generated. */\nexport interface D1SubjectProvisioningMapping<\n Subject extends Table,\n Identifier extends Table,\n Request extends Table,\n NativeId,\n> extends SubjectProvisioningTables<Subject, Identifier, Request, NativeId> {\n readonly d1: {\n readonly requestInsertWithoutSubject: (\n requestId: string,\n fingerprint: string,\n ) => Partial<InferInsertModel<Request>>;\n readonly identifierInsertWithoutSubject: (\n identifier: LoginIdentifier,\n verifiedAt: DateTime.Utc | undefined,\n ) => Partial<InferInsertModel<Identifier>>;\n /** Unshadowed hidden-rowid alias; omit for WITHOUT ROWID or preallocated IDs. */\n readonly generatedRowIdAlias?: \"rowid\" | \"_rowid_\" | \"oid\";\n };\n}\n\nexport interface D1ExternalIdentityMapping<\n Subject extends Table,\n External extends Table,\n NativeId,\n> extends ExternalIdentityTables<Subject, External, NativeId> {\n readonly d1: {\n readonly activeStatusValue: unknown;\n };\n}\n\nexport interface D1GeneratedIdentityMapping<\n Subject extends Table,\n Identifier extends Table,\n External extends Table,\n Request extends Table,\n NativeId,\n> extends IdentityTables<Subject, Identifier, External, Request, NativeId> {\n readonly d1: D1SubjectProvisioningMapping<Subject, Identifier, Request, NativeId>[\"d1\"] &\n D1ExternalIdentityMapping<Subject, External, NativeId>[\"d1\"];\n}\n\nexport const provisioningFingerprint = (input: SubjectProvisioningInput): string =>\n // oxlint-disable-next-line no-restricted-properties -- stable internal provisioning fingerprint, never external JSON.\n JSON.stringify(\n input.identifier === undefined\n ? [\"v1\", null]\n : [\n \"v1\",\n input.identifier.namespace,\n input.identifier.value,\n input.verifiedAt === undefined ? null : DateTime.toEpochMillis(input.verifiedAt),\n ],\n );\n\n/**\n * Drizzle wraps Effect SQL failures before adapters observe them. Give the\n * consumer classifier each semantic wrapper in the short `cause`/`reason`\n * chain without exposing query text or bound parameters through public errors.\n */\n\nexport const column = <T extends Table>(table: T, key: ColumnKey<T>): AnyColumn =>\n getTableColumns(table)[key] as AnyColumn;\n\nexport const updateValues = <T extends Table>(\n entries: ReadonlyArray<readonly [ColumnKey<T>, unknown]>,\n): Partial<InferInsertModel<T>> => Object.fromEntries(entries) as Partial<InferInsertModel<T>>;\n\nexport type ChallengeInput = ConsumeChallenge;\n\n/** Acquire an application database in Effect and expose the auth stores as one layer. */\nexport const authServicesLayer = <E, R>(\n acquire: Effect.Effect<\n {\n readonly authStore: AuthStore[\"Service\"];\n readonly oauthStateStore: OAuthStateStore[\"Service\"];\n },\n E,\n R\n >,\n) =>\n Layer.effectContext(\n Effect.map(acquire, ({ authStore, oauthStateStore }) =>\n Context.make(AuthStore, authStore).pipe(Context.add(OAuthStateStore, oauthStateStore)),\n ),\n );\n\n/** Acquire an application database in Effect and expose the identity services as one layer. */\nexport const identityServicesLayer = <E, R>(\n acquire: Effect.Effect<\n {\n readonly subjectProvisioner: SubjectProvisioner[\"Service\"];\n readonly externalIdentityMutation: ExternalIdentityMutation[\"Service\"];\n },\n E,\n R\n >,\n) =>\n Layer.effectContext(\n Effect.map(acquire, ({ subjectProvisioner, externalIdentityMutation }) =>\n Context.make(SubjectProvisioner, subjectProvisioner).pipe(\n Context.add(ExternalIdentityMutation, externalIdentityMutation),\n ),\n ),\n );\n"],"mappings":";;;;;;;;;AAsCA,MAAa,4BACX,aAEA,OAAO,cAAc,SAAS,QAAQ,kBAAkB,CAAC,CAAC,KACxD,OAAO,QACL,OAAO,MAAM;CACX,cAAc,OAAO;CACrB,cACE,eAAe,KAAK,EAClB,SAAS,oEACX,CAAC;AACL,CAAC,CACH,CACF;AA0BF,MAAa,0BAAmD;CAC9D,QAAQ;CACR,iBAAiB;CACjB,oBAAoB;CACpB,kBAAkB;AACpB;AAEA,MAAa,+BAA6D;CACxE,QAAQ;CACR,iBAAiB;CACjB,oBAAoB;AACtB;AAEA,MAAa,gCAA+D,EAC1E,kBAAkB,sBACpB;AA2IA,MAAa,8BAA2D;CACtE,YAAY;CACZ,kBAAkB;CAClB,qBAAqB;CACrB,qBAAqB;AACvB;AAEA,MAAa,yCAAiF;CAC5F,YAAY;CACZ,qBAAqB;CACrB,qBAAqB;AACvB;AAEA,MAAa,sCAA2E,EACtF,kBAAkB,kCACpB;AA0JA,MAAa,2BAA2B,UAEtC,KAAK,UACH,MAAM,eAAe,KAAA,IACjB,CAAC,MAAM,IAAI,IACX;CACE;CACA,MAAM,WAAW;CACjB,MAAM,WAAW;CACjB,MAAM,eAAe,KAAA,IAAY,OAAO,SAAS,cAAc,MAAM,UAAU;AACjF,CACN;;;;;;AAQF,MAAa,UAA2B,OAAU,QAChD,gBAAgB,KAAK,CAAC,CAAC;AAEzB,MAAa,gBACX,YACiC,OAAO,YAAY,OAAO;;AAK7D,MAAa,qBACX,YASA,MAAM,cACJ,OAAO,IAAI,UAAU,EAAE,WAAW,sBAChC,QAAQ,KAAK,WAAW,SAAS,CAAC,CAAC,KAAK,QAAQ,IAAI,iBAAiB,eAAe,CAAC,CACvF,CACF;;AAGF,MAAa,yBACX,YASA,MAAM,cACJ,OAAO,IAAI,UAAU,EAAE,oBAAoB,+BACzC,QAAQ,KAAK,oBAAoB,kBAAkB,CAAC,CAAC,KACnD,QAAQ,IAAI,0BAA0B,wBAAwB,CAChE,CACF,CACF"}
|
|
1
|
+
{"version":3,"file":"model.mjs","names":[],"sources":["../../src/drizzle/model.ts"],"sourcesContent":["import { AuthStore } from \"@yielded/auth/AuthStore\";\nimport { AuthStoreError } from \"@yielded/auth/Errors\";\nimport {\n ExternalIdentityMutation,\n SubjectProvisioner,\n type SubjectProvisioningInput,\n type ExternalIdentity,\n type LoginIdentifier,\n} from \"@yielded/auth/Identity\";\nimport { OAuthStateStore, type OAuthState } from \"@yielded/auth/OAuth\";\nimport {\n type ConsumeChallenge,\n type NewChallenge,\n type NewRegistration,\n type PendingRegistration,\n type SubjectId,\n} from \"@yielded/auth/Schema\";\nimport {\n getTableColumns,\n type AnyColumn,\n type InferInsertModel,\n type InferSelectModel,\n type Table,\n} from \"drizzle-orm\";\nimport { Context, DateTime, Effect, Layer } from \"effect\";\nimport type * as SqlClient from \"effect/unstable/sql/SqlClient\";\n\nimport { requireStandalone } from \"../internal/standalone\";\n\nexport type CommitMode = \"interactive\" | \"synchronous\" | \"batch\";\n\n/**\n * Ordinary error-channel consumes must own their commit. Coordinated callers\n * use the decision methods inside their outer transaction and translate only\n * after that owner commits.\n */\nexport interface SqlClientTransactionDatabase {\n readonly $client: Pick<SqlClient.SqlClient, \"transactionService\">;\n}\n\nexport const requireStandaloneConsume = (\n database: SqlClientTransactionDatabase,\n): Effect.Effect<void, AuthStoreError> =>\n requireStandalone(\n () =>\n AuthStoreError.make({\n message: \"Use the decision consume API inside an outer database transaction\",\n }),\n database.$client,\n );\n\nexport type { ChallengeConsumeDecision } from \"@yielded/auth/Persistence\";\nexport type { ConsumeDecision } from \"@yielded/auth/AuthStore\";\n\nexport { PersistenceMappingError, isMappedConstraintConflict } from \"../internal/mapping-error\";\nimport type { PersistenceMappingError } from \"../internal/mapping-error\";\n\nexport interface InstantCodec<NativeInstant> {\n readonly encode: (instant: DateTime.Utc) => NativeInstant;\n readonly decode: (native: NativeInstant) => Effect.Effect<DateTime.Utc, PersistenceMappingError>;\n}\n\nexport interface RequiredAuthStoreConstraints {\n readonly series: \"unique(namespace,value,purpose)\";\n readonly challengeDigest: \"unique(tokenDigest)\";\n readonly registrationDigest: \"unique(tokenDigest)\";\n}\n\nexport interface RequiredOAuthStateConstraints {\n readonly oauthStateDigest: \"unique(stateDigest)\";\n}\n\nexport interface RequiredAuthConstraints\n extends RequiredAuthStoreConstraints, RequiredOAuthStateConstraints {}\n\nexport const requiredAuthConstraints: RequiredAuthConstraints = {\n series: \"unique(namespace,value,purpose)\",\n challengeDigest: \"unique(tokenDigest)\",\n registrationDigest: \"unique(tokenDigest)\",\n oauthStateDigest: \"unique(stateDigest)\",\n};\n\nexport const requiredAuthStoreConstraints: RequiredAuthStoreConstraints = {\n series: \"unique(namespace,value,purpose)\",\n challengeDigest: \"unique(tokenDigest)\",\n registrationDigest: \"unique(tokenDigest)\",\n};\n\nexport const requiredOAuthStateConstraints: RequiredOAuthStateConstraints = {\n oauthStateDigest: \"unique(stateDigest)\",\n};\n\ntype ColumnKey<T extends Table> = Extract<keyof T[\"_\"][\"columns\"], string>;\n\nexport interface ChallengeRecord {\n readonly challenge: NewChallenge;\n readonly namespace: string;\n readonly failedAttempts: number;\n readonly consumed: boolean;\n}\n\nexport interface ChallengeColumns<T extends Table> {\n readonly challengeId: ColumnKey<T>;\n readonly tokenDigest: ColumnKey<T>;\n readonly namespace: ColumnKey<T>;\n readonly value: ColumnKey<T>;\n readonly purpose: ColumnKey<T>;\n readonly otpKeyId: ColumnKey<T>;\n readonly otpDigest: ColumnKey<T>;\n readonly issuedAt: ColumnKey<T>;\n readonly expiresAt: ColumnKey<T>;\n readonly attemptLimit: ColumnKey<T>;\n readonly failedAttempts: ColumnKey<T>;\n readonly consumed: ColumnKey<T>;\n}\n\n/**\n * Inputs are immutable server-created issuances. Replacements must advance\n * issuedAt; equal or older issuances fail even after consumption or expiry.\n * Instant encoding must preserve this ordering. Retain the series row as an\n * issuance watermark until every previously accepted issuance has expired;\n * current-row expiry alone is insufficient if historical lifetimes were longer.\n */\nexport interface ChallengeTableMapping<T extends Table> {\n readonly table: T;\n readonly columns: ChallengeColumns<T>;\n readonly identifierNamespace: string;\n readonly encodeInstant: (instant: DateTime.Utc) => unknown;\n readonly encodeInsert: (\n input: NewChallenge,\n state: {\n readonly namespace: string;\n readonly failedAttempts: number;\n readonly consumed: false;\n },\n ) => InferInsertModel<T>;\n readonly encodeUpdate: (\n input: NewChallenge,\n state: {\n readonly namespace: string;\n readonly failedAttempts: unknown;\n readonly consumed: false;\n },\n ) => Readonly<Record<string, unknown>>;\n readonly decode: (\n row: InferSelectModel<T>,\n ) => Effect.Effect<ChallengeRecord, PersistenceMappingError>;\n}\n\nexport interface RegistrationRecord {\n readonly registration: PendingRegistration;\n readonly consumed: boolean;\n}\n\nexport interface RegistrationColumns<T extends Table> {\n readonly registrationId: ColumnKey<T>;\n readonly tokenDigest: ColumnKey<T>;\n readonly expiresAt: ColumnKey<T>;\n readonly consumed: ColumnKey<T>;\n}\n\nexport interface RegistrationTableMapping<T extends Table> {\n readonly table: T;\n readonly columns: RegistrationColumns<T>;\n readonly encodeInstant: (instant: DateTime.Utc) => unknown;\n readonly encodeInsert: (input: NewRegistration, consumed: false) => InferInsertModel<T>;\n readonly decode: (\n row: InferSelectModel<T>,\n ) => Effect.Effect<RegistrationRecord, PersistenceMappingError>;\n}\n\nexport interface OAuthStateColumns<T extends Table> {\n readonly stateDigest: ColumnKey<T>;\n readonly expiresAt: ColumnKey<T>;\n readonly consumed: ColumnKey<T>;\n}\n\nexport interface OAuthStateTableMapping<T extends Table> {\n readonly table: T;\n readonly columns: OAuthStateColumns<T>;\n readonly encodeInstant: (instant: DateTime.Utc) => unknown;\n readonly encodeInsert: (state: OAuthState, consumed: false) => InferInsertModel<T>;\n readonly decode: (\n row: InferSelectModel<T>,\n ) => Effect.Effect<\n { readonly state: OAuthState; readonly consumed: boolean },\n PersistenceMappingError\n >;\n}\n\nexport interface AuthStoreTables<Challenge extends Table, Registration extends Table> {\n readonly constraints: RequiredAuthStoreConstraints;\n readonly challenge: ChallengeTableMapping<Challenge>;\n readonly registration: RegistrationTableMapping<Registration>;\n}\n\nexport interface OAuthStateTables<State extends Table> {\n readonly constraints: RequiredOAuthStateConstraints;\n readonly oauthState: OAuthStateTableMapping<State>;\n}\n\nexport interface AuthTables<\n Challenge extends Table,\n Registration extends Table,\n State extends Table,\n> {\n readonly constraints: RequiredAuthConstraints;\n readonly challenge: ChallengeTableMapping<Challenge>;\n readonly registration: RegistrationTableMapping<Registration>;\n readonly oauthState: OAuthStateTableMapping<State>;\n}\n\nexport interface RequiredIdentityConstraints {\n readonly identifier: \"unique(namespace,value)\";\n readonly externalIdentity: \"unique(provider,issuer,subject)\";\n readonly provisioningRequest: \"unique(requestId)\";\n readonly provisioningSubject: \"notNull(provisioningRequest.subjectId)\";\n}\n\nexport interface RequiredSubjectProvisioningConstraints {\n readonly identifier: \"unique(namespace,value)\";\n readonly provisioningRequest: \"unique(requestId)\";\n readonly provisioningSubject: \"notNull(provisioningRequest.subjectId)\";\n}\n\nexport interface RequiredExternalIdentityConstraints {\n readonly externalIdentity: \"unique(provider,issuer,subject)\";\n}\n\nexport const requiredIdentityConstraints: RequiredIdentityConstraints = {\n identifier: \"unique(namespace,value)\",\n externalIdentity: \"unique(provider,issuer,subject)\",\n provisioningRequest: \"unique(requestId)\",\n provisioningSubject: \"notNull(provisioningRequest.subjectId)\",\n};\n\nexport const requiredSubjectProvisioningConstraints: RequiredSubjectProvisioningConstraints = {\n identifier: \"unique(namespace,value)\",\n provisioningRequest: \"unique(requestId)\",\n provisioningSubject: \"notNull(provisioningRequest.subjectId)\",\n};\n\nexport const requiredExternalIdentityConstraints: RequiredExternalIdentityConstraints = {\n externalIdentity: \"unique(provider,issuer,subject)\",\n};\n\nexport interface SubjectIdCodec<NativeId> {\n readonly toNative: (id: SubjectId) => Effect.Effect<NativeId, PersistenceMappingError>;\n readonly toSubject: (id: NativeId) => Effect.Effect<SubjectId, PersistenceMappingError>;\n readonly equals: (left: NativeId, right: NativeId) => boolean;\n}\n\nexport interface SubjectProvisioningTables<\n Subject extends Table,\n Identifier extends Table,\n Request extends Table,\n NativeId,\n> {\n readonly constraints: RequiredSubjectProvisioningConstraints;\n readonly subject: {\n readonly table: Subject;\n readonly id: ColumnKey<Subject>;\n readonly status: ColumnKey<Subject>;\n readonly isActiveStatus: (value: unknown) => boolean;\n readonly encodeInsert: (\n input: SubjectProvisioningInput,\n allocatedId: NativeId | undefined,\n ) => InferInsertModel<Subject>;\n readonly allocateId?: Effect.Effect<NativeId, PersistenceMappingError>;\n /** Required instead of allocateId when a synchronous-only DO transaction preallocates IDs. */\n readonly allocateIdSync?: () => NativeId;\n /** Decodes MySQL `$returningId()` for an autoincrement/runtime-default key. */\n readonly decodeGeneratedId?: (\n rows: ReadonlyArray<unknown>,\n ) => Effect.Effect<NativeId, PersistenceMappingError>;\n };\n readonly identifier: {\n readonly table: Identifier;\n readonly namespace: ColumnKey<Identifier>;\n readonly value: ColumnKey<Identifier>;\n readonly subjectId: ColumnKey<Identifier>;\n readonly encodeInsert: (\n identifier: LoginIdentifier,\n subjectId: NativeId,\n verifiedAt: DateTime.Utc | undefined,\n ) => InferInsertModel<Identifier>;\n };\n readonly provisioningRequest: {\n readonly table: Request;\n readonly requestId: ColumnKey<Request>;\n readonly fingerprint: ColumnKey<Request>;\n readonly subjectId: ColumnKey<Request>;\n readonly encodeInsert: (\n requestId: string,\n fingerprint: string,\n subjectId: NativeId,\n ) => InferInsertModel<Request>;\n };\n readonly subjectId: SubjectIdCodec<NativeId>;\n /** Narrows only database constraint failures; every other cause is unavailable. */\n readonly isConstraintConflict: (cause: unknown) => boolean;\n}\n\nexport interface ExternalIdentityTables<Subject extends Table, External extends Table, NativeId> {\n readonly constraints: RequiredExternalIdentityConstraints;\n readonly subject: {\n readonly table: Subject;\n readonly id: ColumnKey<Subject>;\n readonly status: ColumnKey<Subject>;\n readonly isActiveStatus: (value: unknown) => boolean;\n };\n readonly externalIdentity: {\n readonly table: External;\n readonly provider: ColumnKey<External>;\n readonly issuer: ColumnKey<External>;\n readonly subject: ColumnKey<External>;\n readonly subjectId: ColumnKey<External>;\n readonly encodeInsert: (\n identity: ExternalIdentity,\n subjectId: NativeId,\n ) => InferInsertModel<External>;\n };\n readonly subjectId: SubjectIdCodec<NativeId>;\n readonly isConstraintConflict: (cause: unknown) => boolean;\n}\n\nexport interface IdentityTables<\n Subject extends Table,\n Identifier extends Table,\n External extends Table,\n Request extends Table,\n NativeId,\n> {\n readonly constraints: RequiredIdentityConstraints;\n readonly subject: SubjectProvisioningTables<Subject, Identifier, Request, NativeId>[\"subject\"];\n readonly identifier: SubjectProvisioningTables<\n Subject,\n Identifier,\n Request,\n NativeId\n >[\"identifier\"];\n readonly externalIdentity: ExternalIdentityTables<\n Subject,\n External,\n NativeId\n >[\"externalIdentity\"];\n readonly provisioningRequest: SubjectProvisioningTables<\n Subject,\n Identifier,\n Request,\n NativeId\n >[\"provisioningRequest\"];\n readonly subjectId: SubjectIdCodec<NativeId>;\n readonly isConstraintConflict: (cause: unknown) => boolean;\n}\n\n/** Extra encoders used by D1's ordered batch when the subject id is database-generated. */\nexport interface D1SubjectProvisioningMapping<\n Subject extends Table,\n Identifier extends Table,\n Request extends Table,\n NativeId,\n> extends SubjectProvisioningTables<Subject, Identifier, Request, NativeId> {\n readonly d1: {\n readonly requestInsertWithoutSubject: (\n requestId: string,\n fingerprint: string,\n ) => Partial<InferInsertModel<Request>>;\n readonly identifierInsertWithoutSubject: (\n identifier: LoginIdentifier,\n verifiedAt: DateTime.Utc | undefined,\n ) => Partial<InferInsertModel<Identifier>>;\n /** Unshadowed hidden-rowid alias; omit for WITHOUT ROWID or preallocated IDs. */\n readonly generatedRowIdAlias?: \"rowid\" | \"_rowid_\" | \"oid\";\n };\n}\n\nexport interface D1ExternalIdentityMapping<\n Subject extends Table,\n External extends Table,\n NativeId,\n> extends ExternalIdentityTables<Subject, External, NativeId> {\n readonly d1: {\n readonly activeStatusValue: unknown;\n };\n}\n\nexport interface D1GeneratedIdentityMapping<\n Subject extends Table,\n Identifier extends Table,\n External extends Table,\n Request extends Table,\n NativeId,\n> extends IdentityTables<Subject, Identifier, External, Request, NativeId> {\n readonly d1: D1SubjectProvisioningMapping<Subject, Identifier, Request, NativeId>[\"d1\"] &\n D1ExternalIdentityMapping<Subject, External, NativeId>[\"d1\"];\n}\n\nexport const provisioningFingerprint = (input: SubjectProvisioningInput): string =>\n // oxlint-disable-next-line no-restricted-properties -- stable internal provisioning fingerprint, never external JSON.\n JSON.stringify(\n input.identifier === undefined\n ? [\"v1\", null]\n : [\n \"v1\",\n input.identifier.namespace,\n input.identifier.value,\n input.verifiedAt === undefined ? null : DateTime.toEpochMillis(input.verifiedAt),\n ],\n );\n\n/**\n * Drizzle wraps Effect SQL failures before adapters observe them. Give the\n * consumer classifier each semantic wrapper in the short `cause`/`reason`\n * chain without exposing query text or bound parameters through public errors.\n */\n\nexport const column = <T extends Table>(table: T, key: ColumnKey<T>): AnyColumn =>\n getTableColumns(table)[key] as AnyColumn;\n\nexport const updateValues = <T extends Table>(\n entries: ReadonlyArray<readonly [ColumnKey<T>, unknown]>,\n): Partial<InferInsertModel<T>> => Object.fromEntries(entries) as Partial<InferInsertModel<T>>;\n\nexport type ChallengeInput = ConsumeChallenge;\n\n/** Acquire an application database in Effect and expose the auth stores as one layer. */\nexport const authServicesLayer = <E, R>(\n acquire: Effect.Effect<\n {\n readonly authStore: AuthStore[\"Service\"];\n readonly oauthStateStore: OAuthStateStore[\"Service\"];\n },\n E,\n R\n >,\n) =>\n Layer.effectContext(\n Effect.map(acquire, ({ authStore, oauthStateStore }) =>\n Context.make(AuthStore, authStore).pipe(Context.add(OAuthStateStore, oauthStateStore)),\n ),\n );\n\n/** Acquire an application database in Effect and expose the identity services as one layer. */\nexport const identityServicesLayer = <E, R>(\n acquire: Effect.Effect<\n {\n readonly subjectProvisioner: SubjectProvisioner[\"Service\"];\n readonly externalIdentityMutation: ExternalIdentityMutation[\"Service\"];\n },\n E,\n R\n >,\n) =>\n Layer.effectContext(\n Effect.map(acquire, ({ subjectProvisioner, externalIdentityMutation }) =>\n Context.make(SubjectProvisioner, subjectProvisioner).pipe(\n Context.add(ExternalIdentityMutation, externalIdentityMutation),\n ),\n ),\n );\n"],"mappings":";;;;;;;;;;AAwCA,MAAa,4BACX,aAEA,wBAEI,eAAe,KAAK,EAClB,SAAS,oEACX,CAAC,GACH,SAAS,OACX;AA0BF,MAAa,0BAAmD;CAC9D,QAAQ;CACR,iBAAiB;CACjB,oBAAoB;CACpB,kBAAkB;AACpB;AAEA,MAAa,+BAA6D;CACxE,QAAQ;CACR,iBAAiB;CACjB,oBAAoB;AACtB;AAEA,MAAa,gCAA+D,EAC1E,kBAAkB,sBACpB;AA2IA,MAAa,8BAA2D;CACtE,YAAY;CACZ,kBAAkB;CAClB,qBAAqB;CACrB,qBAAqB;AACvB;AAEA,MAAa,yCAAiF;CAC5F,YAAY;CACZ,qBAAqB;CACrB,qBAAqB;AACvB;AAEA,MAAa,sCAA2E,EACtF,kBAAkB,kCACpB;AA0JA,MAAa,2BAA2B,UAEtC,KAAK,UACH,MAAM,eAAe,KAAA,IACjB,CAAC,MAAM,IAAI,IACX;CACE;CACA,MAAM,WAAW;CACjB,MAAM,WAAW;CACjB,MAAM,eAAe,KAAA,IAAY,OAAO,SAAS,cAAc,MAAM,UAAU;AACjF,CACN;;;;;;AAQF,MAAa,UAA2B,OAAU,QAChD,gBAAgB,KAAK,CAAC,CAAC;AAEzB,MAAa,gBACX,YACiC,OAAO,YAAY,OAAO;;AAK7D,MAAa,qBACX,YASA,MAAM,cACJ,OAAO,IAAI,UAAU,EAAE,WAAW,sBAChC,QAAQ,KAAK,WAAW,SAAS,CAAC,CAAC,KAAK,QAAQ,IAAI,iBAAiB,eAAe,CAAC,CACvF,CACF;;AAGF,MAAa,yBACX,YASA,MAAM,cACJ,OAAO,IAAI,UAAU,EAAE,oBAAoB,+BACzC,QAAQ,KAAK,oBAAoB,kBAAkB,CAAC,CAAC,KACnD,QAAQ,IAAI,0BAA0B,wBAAwB,CAChE,CACF,CACF"}
|
|
@@ -13,7 +13,7 @@ import { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
|
13
13
|
type Database = EffectMysql2Database<AnyRelations>;
|
|
14
14
|
type TransactionOf<D extends Database> = Parameters<Parameters<D["transaction"]>[0]>[0];
|
|
15
15
|
type ProofMapping = ProofPersistenceMapping<any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
16
|
-
declare const makeMysqlEmailSignInServices: <S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, NativeId>(database: Database, mapping: EmailSignInMapping<S, I, C, NativeId>) => Effect.Effect<{
|
|
16
|
+
export declare const makeMysqlEmailSignInServices: <S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, NativeId>(database: Database, mapping: EmailSignInMapping<S, I, C, NativeId>) => Effect.Effect<{
|
|
17
17
|
emailSignInTargets: {
|
|
18
18
|
readonly lookup: (input: {
|
|
19
19
|
readonly moduleId: string;
|
|
@@ -21,7 +21,7 @@ declare const makeMysqlEmailSignInServices: <S extends AnyMySqlTable, I extends
|
|
|
21
21
|
}) => Effect.Effect<import("effect/Option").Option<import("@yielded/auth/Email").EmailCredentialSnapshot>, EmailUnavailable>;
|
|
22
22
|
};
|
|
23
23
|
}, never, never>;
|
|
24
|
-
declare const makeMysqlEmailAddressServices: <S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, M extends AnyMySqlTable, NativeId>(database: Database, mapping: EmailAddressMapping<S, I, C, AC, M, NativeId>, proofMapping: ProofMapping) => Effect.Effect<{
|
|
24
|
+
export declare const makeMysqlEmailAddressServices: <S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, M extends AnyMySqlTable, NativeId>(database: Database, mapping: EmailAddressMapping<S, I, C, AC, M, NativeId>, proofMapping: ProofMapping) => Effect.Effect<{
|
|
25
25
|
emailAddressPersistence: {
|
|
26
26
|
readonly target: (input: {
|
|
27
27
|
readonly moduleId: string;
|
|
@@ -41,31 +41,30 @@ declare const makeMysqlEmailAddressServices: <S extends AnyMySqlTable, I extends
|
|
|
41
41
|
}, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, EmailUnavailable>;
|
|
42
42
|
};
|
|
43
43
|
}, never, LifecycleHooks>;
|
|
44
|
-
declare function coordinateMysqlEmailAddress<D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, M extends AnyMySqlTable, NativeId, Out, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
44
|
+
export declare function coordinateMysqlEmailAddress<D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, M extends AnyMySqlTable, NativeId, Out, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
45
45
|
readonly mapping: EmailAddressMapping<S, I, C, AC, M, NativeId>;
|
|
46
46
|
readonly proofMapping: ProofMapping;
|
|
47
47
|
readonly transaction?: never;
|
|
48
48
|
}, body: Effect.Effect<Out, E, R>): Effect.Effect<Out, E | EmailUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, EmailAddressPersistence> | LifecycleHooks | DatabaseRequirements>;
|
|
49
|
-
declare function coordinateMysqlEmailAddress<D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, M extends AnyMySqlTable, NativeId, Out, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
49
|
+
export declare function coordinateMysqlEmailAddress<D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, M extends AnyMySqlTable, NativeId, Out, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
50
50
|
readonly mapping: EmailAddressMapping<S, I, C, AC, M, NativeId>;
|
|
51
51
|
readonly proofMapping: ProofMapping;
|
|
52
52
|
readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
53
53
|
}, body: Effect.Effect<Out, E, R>): Effect.Effect<Out, E | EmailUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, EmailAddressPersistence | TxId> | LifecycleHooks | DatabaseRequirements>;
|
|
54
|
-
declare const makeMysqlEmailRegistrationServices: <Registration, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, Rq extends AnyMySqlTable, NativeId>(database: Database, mapping: EmailRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>, proofMapping: ProofMapping) => Effect.Effect<{
|
|
54
|
+
export declare const makeMysqlEmailRegistrationServices: <Registration, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, Rq extends AnyMySqlTable, NativeId>(database: Database, mapping: EmailRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>, proofMapping: ProofMapping) => Effect.Effect<{
|
|
55
55
|
registrationAuthority: EmailRegistrationAuthority<Registration>;
|
|
56
56
|
}, never, LifecycleHooks>;
|
|
57
|
-
declare function coordinateMysqlEmailRegistration<TargetId, Registration, D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, Rq extends AnyMySqlTable, NativeId, Out, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
57
|
+
export declare function coordinateMysqlEmailRegistration<TargetId, Registration, D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, Rq extends AnyMySqlTable, NativeId, Out, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
58
58
|
readonly mapping: EmailRegistrationMapping<NoInfer<Registration>, S, I, C, AC, Rq, NativeId>;
|
|
59
59
|
readonly proofMapping: ProofMapping;
|
|
60
60
|
readonly target: SuppliedService<TargetId, EmailRegistrationAuthority<Registration>>;
|
|
61
61
|
readonly transaction?: never;
|
|
62
62
|
}, body: Effect.Effect<Out, E, R>): Effect.Effect<Out, E | EmailUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements>;
|
|
63
|
-
declare function coordinateMysqlEmailRegistration<TargetId, Registration, D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, Rq extends AnyMySqlTable, NativeId, Out, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
63
|
+
export declare function coordinateMysqlEmailRegistration<TargetId, Registration, D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, Rq extends AnyMySqlTable, NativeId, Out, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
64
64
|
readonly mapping: EmailRegistrationMapping<NoInfer<Registration>, S, I, C, AC, Rq, NativeId>;
|
|
65
65
|
readonly proofMapping: ProofMapping;
|
|
66
66
|
readonly target: SuppliedService<TargetId, EmailRegistrationAuthority<Registration>>;
|
|
67
67
|
readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
68
68
|
}, body: Effect.Effect<Out, E, R>): Effect.Effect<Out, E | EmailUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, TargetId | TxId> | LifecycleHooks | DatabaseRequirements>;
|
|
69
69
|
//#endregion
|
|
70
|
-
export { coordinateMysqlEmailAddress, coordinateMysqlEmailRegistration, makeMysqlEmailAddressServices, makeMysqlEmailRegistrationServices, makeMysqlEmailSignInServices };
|
|
71
70
|
//# sourceMappingURL=mysql-emails.d.mts.map
|
|
@@ -7,16 +7,15 @@ import { EffectMysql2Database } from "drizzle-orm/effect-mysql2";
|
|
|
7
7
|
import { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
8
8
|
//#region src/drizzle/mysql-identity.d.ts
|
|
9
9
|
type Database = EffectMysql2Database<AnyRelations>;
|
|
10
|
-
declare const makeMysqlSubjectProvisioningServices: <Subject extends AnyMySqlTable, Identifier extends AnyMySqlTable, Request extends AnyMySqlTable, NativeId>(database: Database, mapping: SubjectProvisioningTables<Subject, Identifier, Request, NativeId>) => {
|
|
10
|
+
export declare const makeMysqlSubjectProvisioningServices: <Subject extends AnyMySqlTable, Identifier extends AnyMySqlTable, Request extends AnyMySqlTable, NativeId>(database: Database, mapping: SubjectProvisioningTables<Subject, Identifier, Request, NativeId>) => {
|
|
11
11
|
readonly subjectProvisioner: {
|
|
12
12
|
readonly provision: (input: SubjectProvisioningInput) => Effect.Effect<import("@yielded/auth/Identity").ProvisioningResult, IdentityConflict | IdentityUnavailable>;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
declare const makeMysqlExternalIdentityServices: <Subject extends AnyMySqlTable, External extends AnyMySqlTable, NativeId>(database: Database, mapping: ExternalIdentityTables<Subject, External, NativeId>) => {
|
|
15
|
+
export declare const makeMysqlExternalIdentityServices: <Subject extends AnyMySqlTable, External extends AnyMySqlTable, NativeId>(database: Database, mapping: ExternalIdentityTables<Subject, External, NativeId>) => {
|
|
16
16
|
readonly externalIdentityMutation: {
|
|
17
17
|
readonly bind: (subjectId: SubjectId, identity: ExternalIdentity) => Effect.Effect<void, IdentityConflict | IdentityUnavailable>;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
//#endregion
|
|
21
|
-
export { makeMysqlExternalIdentityServices, makeMysqlSubjectProvisioningServices };
|
|
22
21
|
//# sourceMappingURL=mysql-identity.d.mts.map
|
|
@@ -10,21 +10,20 @@ import { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
|
10
10
|
//#region src/drizzle/mysql-password-prepared.d.ts
|
|
11
11
|
type Database = EffectMysql2Database<AnyRelations>;
|
|
12
12
|
type TransactionOf<D extends Database> = Parameters<Parameters<D["transaction"]>[0]>[0];
|
|
13
|
-
declare const makeMySqlPasswordPreparedPersistenceServices: <S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, A extends AnyMySqlTable, RS extends AnyMySqlTable, CE extends AnyMySqlTable, M extends AnyMySqlTable, T extends AnyMySqlTable, B extends AnyMySqlTable, NativeId, PS extends AnyMySqlTable = AnyMySqlTable, PC extends AnyMySqlTable = AnyMySqlTable, PM extends AnyMySqlTable = AnyMySqlTable, PSub extends AnyMySqlTable = AnyMySqlTable, PI extends AnyMySqlTable = AnyMySqlTable, PCr extends AnyMySqlTable = AnyMySqlTable, PNativeId = unknown>(database: Database, mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, A, RS, CE, M, T, B, NativeId>, proofMapping?: PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>) => Effect.Effect<{
|
|
13
|
+
export declare const makeMySqlPasswordPreparedPersistenceServices: <S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, A extends AnyMySqlTable, RS extends AnyMySqlTable, CE extends AnyMySqlTable, M extends AnyMySqlTable, T extends AnyMySqlTable, B extends AnyMySqlTable, NativeId, PS extends AnyMySqlTable = AnyMySqlTable, PC extends AnyMySqlTable = AnyMySqlTable, PM extends AnyMySqlTable = AnyMySqlTable, PSub extends AnyMySqlTable = AnyMySqlTable, PI extends AnyMySqlTable = AnyMySqlTable, PCr extends AnyMySqlTable = AnyMySqlTable, PNativeId = unknown>(database: Database, mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, A, RS, CE, M, T, B, NativeId>, proofMapping?: PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>) => Effect.Effect<{
|
|
14
14
|
passwordPreparedPersistence: PasswordPreparedPersistence;
|
|
15
15
|
}, never, LifecycleHooks>;
|
|
16
|
-
declare function coordinateMySqlPasswordPreparedPersistence<TargetId, D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, A extends AnyMySqlTable, RS extends AnyMySqlTable, CE extends AnyMySqlTable, M extends AnyMySqlTable, T extends AnyMySqlTable, B extends AnyMySqlTable, NativeId, PS extends AnyMySqlTable, PC extends AnyMySqlTable, PM extends AnyMySqlTable, PSub extends AnyMySqlTable, PI extends AnyMySqlTable, PCr extends AnyMySqlTable, PNativeId, Out, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
16
|
+
export declare function coordinateMySqlPasswordPreparedPersistence<TargetId, D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, A extends AnyMySqlTable, RS extends AnyMySqlTable, CE extends AnyMySqlTable, M extends AnyMySqlTable, T extends AnyMySqlTable, B extends AnyMySqlTable, NativeId, PS extends AnyMySqlTable, PC extends AnyMySqlTable, PM extends AnyMySqlTable, PSub extends AnyMySqlTable, PI extends AnyMySqlTable, PCr extends AnyMySqlTable, PNativeId, Out, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
17
17
|
readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, A, RS, CE, M, T, B, NativeId>;
|
|
18
18
|
readonly proofMapping?: PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId> | undefined;
|
|
19
19
|
readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;
|
|
20
20
|
readonly transaction?: never;
|
|
21
21
|
}, body: Effect.Effect<Out, E, R>): Effect.Effect<Out, E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements>;
|
|
22
|
-
declare function coordinateMySqlPasswordPreparedPersistence<TargetId, D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, A extends AnyMySqlTable, RS extends AnyMySqlTable, CE extends AnyMySqlTable, M extends AnyMySqlTable, T extends AnyMySqlTable, B extends AnyMySqlTable, NativeId, PS extends AnyMySqlTable, PC extends AnyMySqlTable, PM extends AnyMySqlTable, PSub extends AnyMySqlTable, PI extends AnyMySqlTable, PCr extends AnyMySqlTable, PNativeId, Out, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
22
|
+
export declare function coordinateMySqlPasswordPreparedPersistence<TargetId, D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, A extends AnyMySqlTable, RS extends AnyMySqlTable, CE extends AnyMySqlTable, M extends AnyMySqlTable, T extends AnyMySqlTable, B extends AnyMySqlTable, NativeId, PS extends AnyMySqlTable, PC extends AnyMySqlTable, PM extends AnyMySqlTable, PSub extends AnyMySqlTable, PI extends AnyMySqlTable, PCr extends AnyMySqlTable, PNativeId, Out, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
23
23
|
readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, A, RS, CE, M, T, B, NativeId>;
|
|
24
24
|
readonly proofMapping?: PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId> | undefined;
|
|
25
25
|
readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;
|
|
26
26
|
readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
27
27
|
}, body: Effect.Effect<Out, E, R>): Effect.Effect<Out, E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, TargetId | TxId> | LifecycleHooks | DatabaseRequirements>;
|
|
28
28
|
//#endregion
|
|
29
|
-
export { coordinateMySqlPasswordPreparedPersistence, makeMySqlPasswordPreparedPersistenceServices };
|
|
30
29
|
//# sourceMappingURL=mysql-password-prepared.d.mts.map
|
|
@@ -15,7 +15,7 @@ import { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
|
15
15
|
type Database = EffectMysql2Database<AnyRelations>;
|
|
16
16
|
type TransactionOf<D extends Database> = Parameters<Parameters<D["transaction"]>[0]>[0];
|
|
17
17
|
type Mapping<S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, A extends AnyMySqlTable, RS extends AnyMySqlTable, CE extends AnyMySqlTable, M extends AnyMySqlTable, NativeId> = PasswordPersistenceMapping<S, I, C, AC, A, RS, CE, M, NativeId>;
|
|
18
|
-
declare const makeMysqlPasswordPersistenceServices: <S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, A extends AnyMySqlTable, RS extends AnyMySqlTable, CE extends AnyMySqlTable, M extends AnyMySqlTable, NativeId>(database: Database, mapping: Mapping<S, I, C, AC, A, RS, CE, M, NativeId>, proofMapping?: ProofPersistenceMapping<any, any, any, any, any, any, any, any, any, any, any, any>) => Effect.Effect<{
|
|
18
|
+
export declare const makeMysqlPasswordPersistenceServices: <S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, A extends AnyMySqlTable, RS extends AnyMySqlTable, CE extends AnyMySqlTable, M extends AnyMySqlTable, NativeId>(database: Database, mapping: Mapping<S, I, C, AC, A, RS, CE, M, NativeId>, proofMapping?: ProofPersistenceMapping<any, any, any, any, any, any, any, any, any, any, any, any>) => Effect.Effect<{
|
|
19
19
|
passwordPersistence: {
|
|
20
20
|
readonly admitAttempt: <A_1>(input: {
|
|
21
21
|
readonly moduleId: string;
|
|
@@ -58,29 +58,28 @@ declare const makeMysqlPasswordPersistenceServices: <S extends AnyMySqlTable, I
|
|
|
58
58
|
}, A_1>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A_1>, PasswordUnavailable>;
|
|
59
59
|
};
|
|
60
60
|
}, never, LifecycleHooks>;
|
|
61
|
-
declare function coordinateMysqlPasswordPersistence<D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, A extends AnyMySqlTable, RS extends AnyMySqlTable, CE extends AnyMySqlTable, M extends AnyMySqlTable, 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<D, DatabaseError, DatabaseRequirements>, options: {
|
|
61
|
+
export declare function coordinateMysqlPasswordPersistence<D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, A extends AnyMySqlTable, RS extends AnyMySqlTable, CE extends AnyMySqlTable, M extends AnyMySqlTable, 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<D, DatabaseError, DatabaseRequirements>, options: {
|
|
62
62
|
readonly mapping: Mapping<S, I, C, AC, A, RS, CE, M, NativeId>;
|
|
63
63
|
readonly proofMapping?: PM;
|
|
64
64
|
readonly transaction?: never;
|
|
65
65
|
}, body: Effect.Effect<Out, E, R>): Effect.Effect<Out, E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, PasswordPersistence> | LifecycleHooks | DatabaseRequirements>;
|
|
66
|
-
declare function coordinateMysqlPasswordPersistence<D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, A extends AnyMySqlTable, RS extends AnyMySqlTable, CE extends AnyMySqlTable, M extends AnyMySqlTable, NativeId, PM extends ProofPersistenceMapping<any, any, any, any, any, any, any, any, any, any, any, any> | undefined, Out, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
66
|
+
export declare function coordinateMysqlPasswordPersistence<D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, A extends AnyMySqlTable, RS extends AnyMySqlTable, CE extends AnyMySqlTable, M extends AnyMySqlTable, NativeId, PM extends ProofPersistenceMapping<any, any, any, any, any, any, any, any, any, any, any, any> | undefined, Out, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
67
67
|
readonly mapping: Mapping<S, I, C, AC, A, RS, CE, M, NativeId>;
|
|
68
68
|
readonly proofMapping?: PM;
|
|
69
69
|
readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
70
70
|
}, body: Effect.Effect<Out, E, R>): Effect.Effect<Out, E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, PasswordPersistence | TxId> | LifecycleHooks | DatabaseRequirements>;
|
|
71
|
-
declare const makeMysqlPasswordRegistrationServices: <Registration, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, Rq extends AnyMySqlTable, NativeId>(database: Database, mapping: PasswordRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>) => Effect.Effect<{
|
|
71
|
+
export declare const makeMysqlPasswordRegistrationServices: <Registration, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, Rq extends AnyMySqlTable, NativeId>(database: Database, mapping: PasswordRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>) => Effect.Effect<{
|
|
72
72
|
registrationAuthority: PasswordRegistrationAuthority<Registration>;
|
|
73
73
|
}, never, LifecycleHooks>;
|
|
74
|
-
declare function coordinateMysqlPasswordRegistration<TargetId, Registration, D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, Rq extends AnyMySqlTable, NativeId, Out, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
74
|
+
export declare function coordinateMysqlPasswordRegistration<TargetId, Registration, D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, Rq extends AnyMySqlTable, NativeId, Out, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
75
75
|
readonly mapping: PasswordRegistrationMapping<NoInfer<Registration>, S, I, C, AC, Rq, NativeId>;
|
|
76
76
|
readonly target: SuppliedService<TargetId, PasswordRegistrationAuthority<Registration>>;
|
|
77
77
|
readonly transaction?: never;
|
|
78
78
|
}, body: Effect.Effect<Out, E, R>): Effect.Effect<Out, E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements>;
|
|
79
|
-
declare function coordinateMysqlPasswordRegistration<TargetId, Registration, D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, Rq extends AnyMySqlTable, NativeId, Out, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
79
|
+
export declare function coordinateMysqlPasswordRegistration<TargetId, Registration, D extends Database, S extends AnyMySqlTable, I extends AnyMySqlTable, C extends AnyMySqlTable, AC extends AnyMySqlTable, Rq extends AnyMySqlTable, NativeId, Out, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
80
80
|
readonly mapping: PasswordRegistrationMapping<NoInfer<Registration>, S, I, C, AC, Rq, NativeId>;
|
|
81
81
|
readonly target: SuppliedService<TargetId, PasswordRegistrationAuthority<Registration>>;
|
|
82
82
|
readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
83
83
|
}, body: Effect.Effect<Out, E, R>): Effect.Effect<Out, E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, TargetId | TxId> | LifecycleHooks | DatabaseRequirements>;
|
|
84
84
|
//#endregion
|
|
85
|
-
export { coordinateMysqlPasswordPersistence, coordinateMysqlPasswordRegistration, makeMysqlPasswordPersistenceServices, makeMysqlPasswordRegistrationServices };
|
|
86
85
|
//# sourceMappingURL=mysql-passwords.d.mts.map
|
|
@@ -11,7 +11,7 @@ import { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
|
11
11
|
type Database = EffectMysql2Database<AnyRelations>;
|
|
12
12
|
type Transaction = Parameters<Parameters<Database["transaction"]>[0]>[0];
|
|
13
13
|
type Mapping<Rq extends AnyMySqlTable, S extends AnyMySqlTable, G extends AnyMySqlTable, Cn extends AnyMySqlTable, Rs extends AnyMySqlTable, A extends AnyMySqlTable, F extends AnyMySqlTable, C extends AnyMySqlTable, Sub extends AnyMySqlTable, I extends AnyMySqlTable, Cr extends AnyMySqlTable, NativeId> = ProofPersistenceMapping<Rq, S, G, Cn, Rs, A, F, C, Sub, I, Cr, NativeId>;
|
|
14
|
-
declare const makeMysqlProofPersistenceServices: <Rq extends AnyMySqlTable, S extends AnyMySqlTable, G extends AnyMySqlTable, Cn extends AnyMySqlTable, Rs extends AnyMySqlTable, A extends AnyMySqlTable, F extends AnyMySqlTable, C extends AnyMySqlTable, Sub extends AnyMySqlTable, I extends AnyMySqlTable, Cr extends AnyMySqlTable, NativeId>(database: Database, mapping: Mapping<Rq, S, G, Cn, Rs, A, F, C, Sub, I, Cr, NativeId>) => Effect.Effect<{
|
|
14
|
+
export declare const makeMysqlProofPersistenceServices: <Rq extends AnyMySqlTable, S extends AnyMySqlTable, G extends AnyMySqlTable, Cn extends AnyMySqlTable, Rs extends AnyMySqlTable, A extends AnyMySqlTable, F extends AnyMySqlTable, C extends AnyMySqlTable, Sub extends AnyMySqlTable, I extends AnyMySqlTable, Cr extends AnyMySqlTable, NativeId>(database: Database, mapping: Mapping<Rq, S, G, Cn, Rs, A, F, C, Sub, I, Cr, NativeId>) => Effect.Effect<{
|
|
15
15
|
proofPersistence: {
|
|
16
16
|
readonly issue: <A_1>(input: {
|
|
17
17
|
readonly record: import("@yielded/auth/Proofs").ProofRecord;
|
|
@@ -62,14 +62,13 @@ declare const makeMysqlProofPersistenceServices: <Rq extends AnyMySqlTable, S ex
|
|
|
62
62
|
}, prepare: import("@yielded/auth/Proofs").PrepareProofCommit<import("@yielded/auth/Proofs").ProofCleanupResult, A_1>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A_1>, ProofUnavailable>;
|
|
63
63
|
};
|
|
64
64
|
}, never, LifecycleHooks>;
|
|
65
|
-
declare function coordinateMysqlProofPersistence<D extends Database, Rq extends AnyMySqlTable, S extends AnyMySqlTable, G extends AnyMySqlTable, Cn extends AnyMySqlTable, Rs extends AnyMySqlTable, Aev extends AnyMySqlTable, F extends AnyMySqlTable, C extends AnyMySqlTable, Sub extends AnyMySqlTable, I extends AnyMySqlTable, Cr extends AnyMySqlTable, NativeId, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
65
|
+
export declare function coordinateMysqlProofPersistence<D extends Database, Rq extends AnyMySqlTable, S extends AnyMySqlTable, G extends AnyMySqlTable, Cn extends AnyMySqlTable, Rs extends AnyMySqlTable, Aev extends AnyMySqlTable, F extends AnyMySqlTable, C extends AnyMySqlTable, Sub extends AnyMySqlTable, I extends AnyMySqlTable, Cr extends AnyMySqlTable, NativeId, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
66
66
|
readonly mapping: Mapping<Rq, S, G, Cn, Rs, Aev, F, C, Sub, I, Cr, NativeId>;
|
|
67
67
|
readonly transaction?: never;
|
|
68
68
|
}, body: Effect.Effect<A, E, R>): Effect.Effect<A, E | ProofUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, ProofPersistence> | LifecycleHooks | DatabaseRequirements>;
|
|
69
|
-
declare function coordinateMysqlProofPersistence<D extends Database, Rq extends AnyMySqlTable, S extends AnyMySqlTable, G extends AnyMySqlTable, Cn extends AnyMySqlTable, Rs extends AnyMySqlTable, Aev extends AnyMySqlTable, F extends AnyMySqlTable, C extends AnyMySqlTable, Sub extends AnyMySqlTable, I extends AnyMySqlTable, Cr extends AnyMySqlTable, NativeId, A, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
69
|
+
export declare function coordinateMysqlProofPersistence<D extends Database, Rq extends AnyMySqlTable, S extends AnyMySqlTable, G extends AnyMySqlTable, Cn extends AnyMySqlTable, Rs extends AnyMySqlTable, Aev extends AnyMySqlTable, F extends AnyMySqlTable, C extends AnyMySqlTable, Sub extends AnyMySqlTable, I extends AnyMySqlTable, Cr extends AnyMySqlTable, NativeId, A, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
70
70
|
readonly mapping: Mapping<Rq, S, G, Cn, Rs, Aev, F, C, Sub, I, Cr, NativeId>;
|
|
71
71
|
readonly transaction: SuppliedService<TxId, NoInfer<Transaction>, TxShape>;
|
|
72
72
|
}, body: Effect.Effect<A, E, R>): Effect.Effect<A, E | ProofUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, ProofPersistence | TxId> | LifecycleHooks | DatabaseRequirements>;
|
|
73
73
|
//#endregion
|
|
74
|
-
export { coordinateMysqlProofPersistence, makeMysqlProofPersistenceServices };
|
|
75
74
|
//# sourceMappingURL=mysql-proofs.d.mts.map
|
|
@@ -11,7 +11,7 @@ import { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
|
11
11
|
//#region src/drizzle/mysql-sessions.d.ts
|
|
12
12
|
type Database = EffectMysql2Database<AnyRelations>;
|
|
13
13
|
type Transaction = Parameters<Parameters<Database["transaction"]>[0]>[0];
|
|
14
|
-
declare const makeMysqlAuthenticationAuthorityServices: <Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, F extends AnyMySqlTable, P extends AnyMySqlTable, NativeId>(database: Database, mapping: AuthenticationAuthorityMapping<Claims, S, C, F, P, NativeId>) => Effect.Effect<{
|
|
14
|
+
export declare const makeMysqlAuthenticationAuthorityServices: <Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, F extends AnyMySqlTable, P extends AnyMySqlTable, NativeId>(database: Database, mapping: AuthenticationAuthorityMapping<Claims, S, C, F, P, NativeId>) => Effect.Effect<{
|
|
15
15
|
authenticationAuthority: {
|
|
16
16
|
capture: (subjectId: string & import("effect/Brand").Brand<"effect-auth/SubjectId">, credentialIds: readonly string[]) => Effect.Effect<{
|
|
17
17
|
subjectId: string & import("effect/Brand").Brand<"effect-auth/SubjectId">;
|
|
@@ -70,7 +70,7 @@ declare const makeMysqlAuthenticationAuthorityServices: <Claims, S extends AnyMy
|
|
|
70
70
|
}, prepare: import("@yielded/auth/Sessions").PrepareSessionCommit<void, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/Sessions").PendingAuthenticationInvalid | SessionUnavailable | import("@yielded/auth/Sessions").StaleAuthentication, never>;
|
|
71
71
|
};
|
|
72
72
|
}, never, LifecycleHooks>;
|
|
73
|
-
declare const makeMysqlPendingAuthenticationServices: <Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, P extends AnyMySqlTable, F extends AnyMySqlTable, NativeId>(database: Database, mapping: PendingAuthenticationMapping<Claims, S, C, P, F, NativeId>) => Effect.Effect<{
|
|
73
|
+
export declare const makeMysqlPendingAuthenticationServices: <Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, P extends AnyMySqlTable, F extends AnyMySqlTable, NativeId>(database: Database, mapping: PendingAuthenticationMapping<Claims, S, C, P, F, NativeId>) => Effect.Effect<{
|
|
74
74
|
pendingAuthentication: {
|
|
75
75
|
create: <A>(input: Omit<import("@yielded/auth/Sessions").PendingAuthenticationRecord<Claims>, "version">, now: import("effect/DateTime").Utc, prepare: import("@yielded/auth/Sessions").PrepareSessionCommit<import("@yielded/auth/Sessions").PendingAuthenticationRecord<Claims>, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/Sessions").SessionConflict | SessionUnavailable | import("@yielded/auth/Sessions").StaleAuthentication, never>;
|
|
76
76
|
context: (input: {
|
|
@@ -103,7 +103,7 @@ declare const makeMysqlPendingAuthenticationServices: <Claims, S extends AnyMySq
|
|
|
103
103
|
}, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, SessionUnavailable, never>;
|
|
104
104
|
};
|
|
105
105
|
}, never, LifecycleHooks>;
|
|
106
|
-
declare const makeMysqlStatefulSessionServices: <Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, Session extends AnyMySqlTable, F extends AnyMySqlTable, P extends AnyMySqlTable, NativeId, NativeSessionId>(database: Database, mapping: StatefulSessionMapping<Claims, S, C, Session, F, P, NativeId, NativeSessionId>) => Effect.Effect<{
|
|
106
|
+
export declare const makeMysqlStatefulSessionServices: <Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, Session extends AnyMySqlTable, F extends AnyMySqlTable, P extends AnyMySqlTable, NativeId, NativeSessionId>(database: Database, mapping: StatefulSessionMapping<Claims, S, C, Session, F, P, NativeId, NativeSessionId>) => Effect.Effect<{
|
|
107
107
|
statefulSessionPersistence: {
|
|
108
108
|
establish: <A>(input: {
|
|
109
109
|
readonly session: Omit<import("@yielded/auth/Sessions").StatefulSessionRecord<Claims>, "sessionId" | "version">;
|
|
@@ -156,7 +156,7 @@ declare const makeMysqlStatefulSessionServices: <Claims, S extends AnyMySqlTable
|
|
|
156
156
|
}, SessionUnavailable, never>;
|
|
157
157
|
};
|
|
158
158
|
}, never, LifecycleHooks>;
|
|
159
|
-
declare const makeMysqlSignedSessionValidityServices: <S extends AnyMySqlTable, T extends AnyMySqlTable, NativeId, NativeSessionId>(database: Database, mapping: SignedSessionValidityMapping<S, T, NativeId, NativeSessionId>) => Effect.Effect<{
|
|
159
|
+
export declare const makeMysqlSignedSessionValidityServices: <S extends AnyMySqlTable, T extends AnyMySqlTable, NativeId, NativeSessionId>(database: Database, mapping: SignedSessionValidityMapping<S, T, NativeId, NativeSessionId>) => Effect.Effect<{
|
|
160
160
|
signedSessionValidity: {
|
|
161
161
|
verify: (session: {
|
|
162
162
|
readonly sessionId: string & import("effect/Brand").Brand<"effect-auth/SessionId">;
|
|
@@ -179,59 +179,58 @@ declare const makeMysqlSignedSessionValidityServices: <S extends AnyMySqlTable,
|
|
|
179
179
|
}, prepare: import("@yielded/auth/Sessions").PrepareSessionCommit<void, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, SessionUnavailable | import("@yielded/auth/Sessions").StaleAuthentication, never>;
|
|
180
180
|
};
|
|
181
181
|
}, never, LifecycleHooks>;
|
|
182
|
-
declare function coordinateMysqlAuthenticationAuthority<D extends Database, Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, F extends AnyMySqlTable, P extends AnyMySqlTable, NativeId, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
182
|
+
export declare function coordinateMysqlAuthenticationAuthority<D extends Database, Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, F extends AnyMySqlTable, P extends AnyMySqlTable, NativeId, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
183
183
|
readonly mapping: AuthenticationAuthorityMapping<Claims, S, C, F, P, NativeId>;
|
|
184
184
|
readonly transaction?: never;
|
|
185
185
|
}, body: Effect.Effect<A, E, R>): Effect.Effect<A, E | SessionUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, AuthenticationAuthority> | LifecycleHooks | DatabaseRequirements>;
|
|
186
|
-
declare function coordinateMysqlAuthenticationAuthority<D extends Database, Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, F extends AnyMySqlTable, P extends AnyMySqlTable, NativeId, A, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
186
|
+
export declare function coordinateMysqlAuthenticationAuthority<D extends Database, Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, F extends AnyMySqlTable, P extends AnyMySqlTable, NativeId, A, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
187
187
|
readonly mapping: AuthenticationAuthorityMapping<Claims, S, C, F, P, NativeId>;
|
|
188
188
|
readonly transaction: SuppliedService<TxId, NoInfer<Transaction>, TxShape>;
|
|
189
189
|
}, body: Effect.Effect<A, E, R>): Effect.Effect<A, E | SessionUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, AuthenticationAuthority | TxId> | LifecycleHooks | DatabaseRequirements>;
|
|
190
|
-
declare function coordinateMysqlPendingAuthentication<D extends Database, TargetId, Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, P extends AnyMySqlTable, F extends AnyMySqlTable, NativeId, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
190
|
+
export declare function coordinateMysqlPendingAuthentication<D extends Database, TargetId, Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, P extends AnyMySqlTable, F extends AnyMySqlTable, NativeId, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
191
191
|
readonly mapping: PendingAuthenticationMapping<NoInfer<Claims>, S, C, P, F, NativeId>;
|
|
192
192
|
readonly target: SuppliedService<TargetId, PendingAuthentication<Claims>>;
|
|
193
193
|
readonly transaction?: never;
|
|
194
194
|
}, body: Effect.Effect<A, E, R>): Effect.Effect<A, E | SessionUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements>;
|
|
195
|
-
declare function coordinateMysqlPendingAuthentication<D extends Database, TargetId, Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, P extends AnyMySqlTable, F extends AnyMySqlTable, NativeId, A, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
195
|
+
export declare function coordinateMysqlPendingAuthentication<D extends Database, TargetId, Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, P extends AnyMySqlTable, F extends AnyMySqlTable, NativeId, A, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
196
196
|
readonly mapping: PendingAuthenticationMapping<NoInfer<Claims>, S, C, P, F, NativeId>;
|
|
197
197
|
readonly target: SuppliedService<TargetId, PendingAuthentication<Claims>>;
|
|
198
198
|
readonly transaction: SuppliedService<TxId, NoInfer<Transaction>, TxShape>;
|
|
199
199
|
}, body: Effect.Effect<A, E, R>): Effect.Effect<A, E | SessionUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, TargetId | TxId> | LifecycleHooks | DatabaseRequirements>;
|
|
200
|
-
declare function coordinateMysqlStatefulSessions<D extends Database, PersistenceId, RepositoryId, Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, Session extends AnyMySqlTable, F extends AnyMySqlTable, P extends AnyMySqlTable, NativeId, NativeSessionId, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
200
|
+
export declare function coordinateMysqlStatefulSessions<D extends Database, PersistenceId, RepositoryId, Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, Session extends AnyMySqlTable, F extends AnyMySqlTable, P extends AnyMySqlTable, NativeId, NativeSessionId, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
201
201
|
readonly mapping: StatefulSessionMapping<NoInfer<Claims>, S, C, Session, F, P, NativeId, NativeSessionId>;
|
|
202
202
|
readonly persistence: SuppliedService<PersistenceId, StatefulSessionPersistence<Claims>>;
|
|
203
203
|
readonly repository: SuppliedService<RepositoryId, SessionRepository>;
|
|
204
204
|
readonly transaction?: never;
|
|
205
205
|
}, body: Effect.Effect<A, E, R>): Effect.Effect<A, E | SessionUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, PersistenceId | RepositoryId> | LifecycleHooks | DatabaseRequirements>;
|
|
206
|
-
declare function coordinateMysqlStatefulSessions<D extends Database, PersistenceId, RepositoryId, Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, Session extends AnyMySqlTable, F extends AnyMySqlTable, P extends AnyMySqlTable, NativeId, NativeSessionId, A, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
206
|
+
export declare function coordinateMysqlStatefulSessions<D extends Database, PersistenceId, RepositoryId, Claims, S extends AnyMySqlTable, C extends AnyMySqlTable, Session extends AnyMySqlTable, F extends AnyMySqlTable, P extends AnyMySqlTable, NativeId, NativeSessionId, A, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
207
207
|
readonly mapping: StatefulSessionMapping<NoInfer<Claims>, S, C, Session, F, P, NativeId, NativeSessionId>;
|
|
208
208
|
readonly persistence: SuppliedService<PersistenceId, StatefulSessionPersistence<Claims>>;
|
|
209
209
|
readonly repository: SuppliedService<RepositoryId, SessionRepository>;
|
|
210
210
|
readonly transaction: SuppliedService<TxId, NoInfer<Transaction>, TxShape>;
|
|
211
211
|
}, body: Effect.Effect<A, E, R>): Effect.Effect<A, E | SessionUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, PersistenceId | RepositoryId | TxId> | LifecycleHooks | DatabaseRequirements>;
|
|
212
|
-
declare function coordinateMysqlSignedSessionValidity<D extends Database, TargetId, S extends AnyMySqlTable, T extends AnyMySqlTable, NativeId, NativeSessionId, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
212
|
+
export declare function coordinateMysqlSignedSessionValidity<D extends Database, TargetId, S extends AnyMySqlTable, T extends AnyMySqlTable, NativeId, NativeSessionId, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
213
213
|
readonly mapping: SignedSessionValidityMapping<S, T, NativeId, NativeSessionId>;
|
|
214
214
|
readonly target: SuppliedService<TargetId, SignedSessionValidity>;
|
|
215
215
|
readonly transaction?: never;
|
|
216
216
|
}, body: Effect.Effect<A, E, R>): Effect.Effect<A, E | SessionUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements>;
|
|
217
|
-
declare function coordinateMysqlSignedSessionValidity<D extends Database, TargetId, S extends AnyMySqlTable, T extends AnyMySqlTable, NativeId, NativeSessionId, A, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
217
|
+
export declare function coordinateMysqlSignedSessionValidity<D extends Database, TargetId, S extends AnyMySqlTable, T extends AnyMySqlTable, NativeId, NativeSessionId, A, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
218
218
|
readonly mapping: SignedSessionValidityMapping<S, T, NativeId, NativeSessionId>;
|
|
219
219
|
readonly target: SuppliedService<TargetId, SignedSessionValidity>;
|
|
220
220
|
readonly transaction: SuppliedService<TxId, NoInfer<Transaction>, TxShape>;
|
|
221
221
|
}, body: Effect.Effect<A, E, R>): Effect.Effect<A, E | SessionUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, TargetId | TxId> | LifecycleHooks | DatabaseRequirements>;
|
|
222
|
-
declare const makeMysqlSessionStepUpServices: <Claims, Id, S extends AnyMySqlTable, C extends AnyMySqlTable, I extends AnyMySqlTable, Session extends AnyMySqlTable, T extends AnyMySqlTable, NativeId, NativeSessionId>(database: Database, mapping: SessionStepUpMapping<NoInfer<Claims>, S, C, I, Session, T, NativeId, NativeSessionId>, target: Context.Service<Id, SessionStepUpPersistence<Claims>>) => Effect.Effect<{
|
|
222
|
+
export declare const makeMysqlSessionStepUpServices: <Claims, Id, S extends AnyMySqlTable, C extends AnyMySqlTable, I extends AnyMySqlTable, Session extends AnyMySqlTable, T extends AnyMySqlTable, NativeId, NativeSessionId>(database: Database, mapping: SessionStepUpMapping<NoInfer<Claims>, S, C, I, Session, T, NativeId, NativeSessionId>, target: Context.Service<Id, SessionStepUpPersistence<Claims>>) => Effect.Effect<{
|
|
223
223
|
sessionStepUpPersistence: SessionStepUpPersistence<Claims>;
|
|
224
224
|
}, never, LifecycleHooks>;
|
|
225
|
-
declare function coordinateMysqlSessionStepUp<Claims, Id, S extends AnyMySqlTable, C extends AnyMySqlTable, I extends AnyMySqlTable, Session extends AnyMySqlTable, T extends AnyMySqlTable, NativeId, NativeSessionId, D extends Database, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
225
|
+
export declare function coordinateMysqlSessionStepUp<Claims, Id, S extends AnyMySqlTable, C extends AnyMySqlTable, I extends AnyMySqlTable, Session extends AnyMySqlTable, T extends AnyMySqlTable, NativeId, NativeSessionId, D extends Database, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
226
226
|
readonly mapping: SessionStepUpMapping<NoInfer<Claims>, S, C, I, Session, T, NativeId, NativeSessionId>;
|
|
227
227
|
readonly target: SuppliedService<Id, SessionStepUpPersistence<Claims>>;
|
|
228
228
|
readonly transaction?: never;
|
|
229
229
|
}, body: Effect.Effect<A, E, R>): Effect.Effect<A, E | SessionUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, Id> | LifecycleHooks | DatabaseRequirements>;
|
|
230
|
-
declare function coordinateMysqlSessionStepUp<Claims, Id, S extends AnyMySqlTable, C extends AnyMySqlTable, I extends AnyMySqlTable, Session extends AnyMySqlTable, T extends AnyMySqlTable, NativeId, NativeSessionId, D extends Database, A, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
230
|
+
export declare function coordinateMysqlSessionStepUp<Claims, Id, S extends AnyMySqlTable, C extends AnyMySqlTable, I extends AnyMySqlTable, Session extends AnyMySqlTable, T extends AnyMySqlTable, NativeId, NativeSessionId, D extends Database, A, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
231
231
|
readonly mapping: SessionStepUpMapping<NoInfer<Claims>, S, C, I, Session, T, NativeId, NativeSessionId>;
|
|
232
232
|
readonly target: SuppliedService<Id, SessionStepUpPersistence<Claims>>;
|
|
233
233
|
readonly transaction: SuppliedService<TxId, NoInfer<Parameters<Parameters<D["transaction"]>[0]>[0]>, TxShape>;
|
|
234
234
|
}, body: Effect.Effect<A, E, R>): Effect.Effect<A, E | SessionUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, Id | TxId> | LifecycleHooks | DatabaseRequirements>;
|
|
235
235
|
//#endregion
|
|
236
|
-
export { coordinateMysqlAuthenticationAuthority, coordinateMysqlPendingAuthentication, coordinateMysqlSessionStepUp, coordinateMysqlSignedSessionValidity, coordinateMysqlStatefulSessions, makeMysqlAuthenticationAuthorityServices, makeMysqlPendingAuthenticationServices, makeMysqlSessionStepUpServices, makeMysqlSignedSessionValidityServices, makeMysqlStatefulSessionServices };
|
|
237
236
|
//# sourceMappingURL=mysql-sessions.d.mts.map
|
package/dist/drizzle/mysql.d.mts
CHANGED
|
@@ -3,9 +3,9 @@ import { SuppliedService } from "./SuppliedService.mjs";
|
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
import { AuthStoreDecisions } from "@yielded/auth/Persistence";
|
|
5
5
|
import { ConsumeChallenge, ConsumeRegistration, NewChallenge, NewRegistration, TokenDigest, VerifiedEmail } from "@yielded/auth/Schema";
|
|
6
|
+
import { InvalidOAuthState, OAuthState, OAuthStateDecisions } from "@yielded/auth/OAuth";
|
|
6
7
|
import { EmailOtpRejected } from "@yielded/auth/AuthStore";
|
|
7
8
|
import { AuthStoreError, InvalidRegistration } from "@yielded/auth/Errors";
|
|
8
|
-
import { InvalidOAuthState, OAuthState, OAuthStateDecisions } from "@yielded/auth/OAuth";
|
|
9
9
|
import { AnyRelations } from "drizzle-orm";
|
|
10
10
|
import { EffectMysql2Database } from "drizzle-orm/effect-mysql2";
|
|
11
11
|
import { SqlError } from "effect/unstable/sql/SqlError";
|
|
@@ -14,7 +14,7 @@ import { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
|
14
14
|
type Database = EffectMysql2Database<AnyRelations>;
|
|
15
15
|
type TransactionOf<D extends Database> = Parameters<Parameters<D["transaction"]>[0]>[0];
|
|
16
16
|
/** MySQL/InnoDB implementation. Multi-step decisions stay values until commit. */
|
|
17
|
-
declare const makeMysqlAuthStoreServices: <C extends AnyMySqlTable, R extends AnyMySqlTable>(database: Database, mapping: AuthStoreTables<C, R>) => {
|
|
17
|
+
export declare const makeMysqlAuthStoreServices: <C extends AnyMySqlTable, R extends AnyMySqlTable>(database: Database, mapping: AuthStoreTables<C, R>) => {
|
|
18
18
|
readonly authStore: {
|
|
19
19
|
readonly issueChallenge: (input: NewChallenge) => Effect.Effect<void, import("@yielded/auth/AuthStore").IssueChallengeError>;
|
|
20
20
|
readonly consumeChallenge: (input: ConsumeChallenge) => Effect.Effect<VerifiedEmail, EmailOtpRejected | AuthStoreError>;
|
|
@@ -27,7 +27,7 @@ declare const makeMysqlAuthStoreServices: <C extends AnyMySqlTable, R extends An
|
|
|
27
27
|
readonly consumeRegistration: (input: ConsumeRegistration) => Effect.Effect<ConsumeDecision<void>, AuthStoreError, never>;
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
-
declare const makeMysqlOAuthStateServices: <S extends AnyMySqlTable>(database: Database, mapping: OAuthStateTables<S>) => {
|
|
30
|
+
export declare const makeMysqlOAuthStateServices: <S extends AnyMySqlTable>(database: Database, mapping: OAuthStateTables<S>) => {
|
|
31
31
|
readonly oauthStateStore: {
|
|
32
32
|
readonly issue: (state: OAuthState) => Effect.Effect<void, AuthStoreError>;
|
|
33
33
|
readonly consume: (stateDigest: TokenDigest) => Effect.Effect<OAuthState, InvalidOAuthState | AuthStoreError>;
|
|
@@ -41,30 +41,29 @@ declare const makeMysqlOAuthStateServices: <S extends AnyMySqlTable>(database: D
|
|
|
41
41
|
* owner; interruption before commit rolls back. This adapter never retries a
|
|
42
42
|
* deadlock inside the caller's transaction.
|
|
43
43
|
*/
|
|
44
|
-
declare function coordinateMysqlAuthStoreTransaction<D extends Database, C extends AnyMySqlTable, R extends AnyMySqlTable, A, E, Requirements, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
44
|
+
export declare function coordinateMysqlAuthStoreTransaction<D extends Database, C extends AnyMySqlTable, R extends AnyMySqlTable, A, E, Requirements, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
45
45
|
readonly mapping: AuthStoreTables<C, R>;
|
|
46
46
|
readonly transaction?: never;
|
|
47
47
|
}, body: Effect.Effect<A, E, Requirements>): Effect.Effect<A, E | DatabaseError | SqlError, Exclude<Requirements, AuthStoreDecisions> | DatabaseRequirements>;
|
|
48
|
-
declare function coordinateMysqlAuthStoreTransaction<D extends Database, C extends AnyMySqlTable, R extends AnyMySqlTable, A, E, Requirements, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
48
|
+
export declare function coordinateMysqlAuthStoreTransaction<D extends Database, C extends AnyMySqlTable, R extends AnyMySqlTable, A, E, Requirements, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
49
49
|
readonly mapping: AuthStoreTables<C, R>;
|
|
50
50
|
readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
51
51
|
}, body: Effect.Effect<A, E, Requirements>): Effect.Effect<A, E | DatabaseError | SqlError, Exclude<Requirements, AuthStoreDecisions | TxId> | DatabaseRequirements>;
|
|
52
|
-
declare function coordinateMysqlOAuthStateTransaction<D extends Database, S extends AnyMySqlTable, A, E, Requirements, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
52
|
+
export declare function coordinateMysqlOAuthStateTransaction<D extends Database, S extends AnyMySqlTable, A, E, Requirements, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
53
53
|
readonly mapping: OAuthStateTables<S>;
|
|
54
54
|
readonly transaction?: never;
|
|
55
55
|
}, body: Effect.Effect<A, E, Requirements>): Effect.Effect<A, E | DatabaseError | SqlError, Exclude<Requirements, OAuthStateDecisions> | DatabaseRequirements>;
|
|
56
|
-
declare function coordinateMysqlOAuthStateTransaction<D extends Database, S extends AnyMySqlTable, A, E, Requirements, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
56
|
+
export declare function coordinateMysqlOAuthStateTransaction<D extends Database, S extends AnyMySqlTable, A, E, Requirements, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
57
57
|
readonly mapping: OAuthStateTables<S>;
|
|
58
58
|
readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
59
59
|
}, body: Effect.Effect<A, E, Requirements>): Effect.Effect<A, E | DatabaseError | SqlError, Exclude<Requirements, OAuthStateDecisions | TxId> | DatabaseRequirements>;
|
|
60
|
-
declare function coordinateMysqlAuthTransaction<D extends Database, C extends AnyMySqlTable, R extends AnyMySqlTable, S extends AnyMySqlTable, A, E, Requirements, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
60
|
+
export declare function coordinateMysqlAuthTransaction<D extends Database, C extends AnyMySqlTable, R extends AnyMySqlTable, S extends AnyMySqlTable, A, E, Requirements, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
61
61
|
readonly mapping: AuthTables<C, R, S>;
|
|
62
62
|
readonly transaction?: never;
|
|
63
63
|
}, body: Effect.Effect<A, E, Requirements>): Effect.Effect<A, E | DatabaseError | SqlError, Exclude<Requirements, AuthStoreDecisions | OAuthStateDecisions> | DatabaseRequirements>;
|
|
64
|
-
declare function coordinateMysqlAuthTransaction<D extends Database, C extends AnyMySqlTable, R extends AnyMySqlTable, S extends AnyMySqlTable, A, E, Requirements, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
64
|
+
export declare function coordinateMysqlAuthTransaction<D extends Database, C extends AnyMySqlTable, R extends AnyMySqlTable, S extends AnyMySqlTable, A, E, Requirements, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
|
|
65
65
|
readonly mapping: AuthTables<C, R, S>;
|
|
66
66
|
readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
|
|
67
67
|
}, body: Effect.Effect<A, E, Requirements>): Effect.Effect<A, E | DatabaseError | SqlError, Exclude<Requirements, AuthStoreDecisions | OAuthStateDecisions | TxId> | DatabaseRequirements>;
|
|
68
68
|
//#endregion
|
|
69
|
-
export { coordinateMysqlAuthStoreTransaction, coordinateMysqlAuthTransaction, coordinateMysqlOAuthStateTransaction, makeMysqlAuthStoreServices, makeMysqlOAuthStateServices };
|
|
70
69
|
//# sourceMappingURL=mysql.d.mts.map
|
package/dist/drizzle/mysql.mjs
CHANGED
|
@@ -2,9 +2,9 @@ import { column, requireStandaloneConsume, updateValues } from "./model.mjs";
|
|
|
2
2
|
import { Cause, Context, DateTime, Duration, Effect, Schema } from "effect";
|
|
3
3
|
import { AuthStoreDecisions, reportPersistenceFailure } from "@yielded/auth/Persistence";
|
|
4
4
|
import { VerifiedEmail, timingSafeStringEqual } from "@yielded/auth/Schema";
|
|
5
|
+
import { InvalidOAuthState, OAuthStateDecisions, OAuthStateStore } from "@yielded/auth/OAuth";
|
|
5
6
|
import { AuthStore, EmailOtpRejected } from "@yielded/auth/AuthStore";
|
|
6
7
|
import { AuthRateLimited, AuthStoreError, InvalidRegistration } from "@yielded/auth/Errors";
|
|
7
|
-
import { InvalidOAuthState, OAuthStateDecisions, OAuthStateStore } from "@yielded/auth/OAuth";
|
|
8
8
|
import { and, eq, gt, sql } from "drizzle-orm";
|
|
9
9
|
//#region src/drizzle/mysql.ts
|
|
10
10
|
const selected = (row) => row;
|