@yielded/auth-persistence-drizzle 0.1.0-beta.22 → 0.1.0-beta.24

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.
Files changed (200) hide show
  1. package/README.md +3 -0
  2. package/dist/D1.d.mts +11 -11
  3. package/dist/D1.mjs +2 -1
  4. package/dist/D1.mjs.map +1 -1
  5. package/dist/Libsql.d.mts +40 -56
  6. package/dist/Libsql.mjs +2 -1
  7. package/dist/Libsql.mjs.map +1 -1
  8. package/dist/Mysql2.d.mts +16 -17
  9. package/dist/Pglite.d.mts +18 -18
  10. package/dist/Pglite.mjs +2 -1
  11. package/dist/Pglite.mjs.map +1 -1
  12. package/dist/Postgres.d.mts +24 -24
  13. package/dist/Postgres.mjs +2 -1
  14. package/dist/Postgres.mjs.map +1 -1
  15. package/dist/SqliteBun.d.mts +39 -55
  16. package/dist/SqliteBun.mjs +2 -1
  17. package/dist/SqliteBun.mjs.map +1 -1
  18. package/dist/SqliteDo.d.mts +48 -64
  19. package/dist/SqliteDo.mjs +2 -1
  20. package/dist/SqliteDo.mjs.map +1 -1
  21. package/dist/SqliteNode.d.mts +45 -61
  22. package/dist/SqliteNode.mjs +2 -1
  23. package/dist/SqliteNode.mjs.map +1 -1
  24. package/dist/SqliteWasm.d.mts +48 -64
  25. package/dist/SqliteWasm.mjs +2 -1
  26. package/dist/SqliteWasm.mjs.map +1 -1
  27. package/dist/drizzle/crypto.mjs +1 -1
  28. package/dist/drizzle/d1-emails.d.mts +1 -1
  29. package/dist/drizzle/d1-oauth.d.mts +14 -14
  30. package/dist/drizzle/d1-passkey.d.mts +1 -1
  31. package/dist/drizzle/d1-password-prepared.d.mts +4 -4
  32. package/dist/drizzle/d1-password-prepared.mjs.map +1 -1
  33. package/dist/drizzle/d1-passwords.d.mts +18 -35
  34. package/dist/drizzle/d1-passwords.mjs +78 -290
  35. package/dist/drizzle/d1-passwords.mjs.map +1 -1
  36. package/dist/drizzle/d1-phone.d.mts +1 -1
  37. package/dist/drizzle/d1-proofs.d.mts +2 -2
  38. package/dist/drizzle/d1-sessions.d.mts +3 -3
  39. package/dist/drizzle/d1-sessions.mjs +11 -6
  40. package/dist/drizzle/d1-sessions.mjs.map +1 -1
  41. package/dist/drizzle/d1-totp.d.mts +1 -1
  42. package/dist/drizzle/mysql-password-prepared.d.mts +5 -5
  43. package/dist/drizzle/mysql-password-prepared.mjs.map +1 -1
  44. package/dist/drizzle/mysql-passwords.d.mts +16 -32
  45. package/dist/drizzle/mysql-passwords.mjs.map +1 -1
  46. package/dist/drizzle/mysql-sessions.d.mts +1 -1
  47. package/dist/drizzle/native-sql-table.mjs +135 -0
  48. package/dist/drizzle/native-sql-table.mjs.map +1 -0
  49. package/dist/drizzle/oauth-connected-model.d.mts +20 -281
  50. package/dist/drizzle/oauth-connected-model.mjs +3 -17
  51. package/dist/drizzle/oauth-connected-model.mjs.map +1 -1
  52. package/dist/drizzle/oauth-connected-reference.d.mts +1 -3
  53. package/dist/drizzle/oauth-connected-reference.mjs +4 -53
  54. package/dist/drizzle/oauth-connected-reference.mjs.map +1 -1
  55. package/dist/drizzle/oauth-connected-target.d.mts +3 -990
  56. package/dist/drizzle/oauth-connected-target.mjs +8 -92
  57. package/dist/drizzle/oauth-connected-target.mjs.map +1 -1
  58. package/dist/drizzle/oauth-kernel.mjs +11 -0
  59. package/dist/drizzle/oauth-kernel.mjs.map +1 -0
  60. package/dist/drizzle/oauth-model.d.mts +35 -438
  61. package/dist/drizzle/oauth-model.mjs +6 -44
  62. package/dist/drizzle/oauth-model.mjs.map +1 -1
  63. package/dist/drizzle/oauth-mysql.mjs +2 -2
  64. package/dist/drizzle/oauth-mysql.mjs.map +1 -1
  65. package/dist/drizzle/oauth-proxy.d.mts +10 -0
  66. package/dist/drizzle/oauth-proxy.mjs +54 -0
  67. package/dist/drizzle/oauth-proxy.mjs.map +1 -0
  68. package/dist/drizzle/oauth-target.d.mts +6 -107
  69. package/dist/drizzle/oauth-target.mjs +15 -245
  70. package/dist/drizzle/oauth-target.mjs.map +1 -1
  71. package/dist/drizzle/password-model.d.mts +5 -8
  72. package/dist/drizzle/password-prepared-model.d.mts +5 -5
  73. package/dist/drizzle/password-prepared-model.mjs.map +1 -1
  74. package/dist/drizzle/password-prepared-state.mjs +1 -1
  75. package/dist/drizzle/password-sql.mjs +2 -1
  76. package/dist/drizzle/password-sql.mjs.map +1 -1
  77. package/dist/drizzle/password-target.mjs +13 -2
  78. package/dist/drizzle/password-target.mjs.map +1 -1
  79. package/dist/drizzle/pg-password-prepared.d.mts +5 -5
  80. package/dist/drizzle/pg-password-prepared.mjs.map +1 -1
  81. package/dist/drizzle/pg-passwords.d.mts +16 -32
  82. package/dist/drizzle/pg-passwords.mjs.map +1 -1
  83. package/dist/drizzle/pg-sessions.d.mts +1 -1
  84. package/dist/drizzle/phone-target.d.mts +2 -2
  85. package/dist/drizzle/phone-target.mjs +1 -1
  86. package/dist/drizzle/query-operations.mjs +3 -1
  87. package/dist/drizzle/query-operations.mjs.map +1 -1
  88. package/dist/drizzle/session-sql.mjs +2 -1
  89. package/dist/drizzle/session-sql.mjs.map +1 -1
  90. package/dist/drizzle/sqlite-password-prepared.mjs.map +1 -1
  91. package/dist/drizzle/sqlite-passwords.mjs.map +1 -1
  92. package/dist/drizzle/storage-validation.mjs +10 -198
  93. package/dist/drizzle/storage-validation.mjs.map +1 -1
  94. package/dist/drizzle/totp-target.d.mts +3 -3
  95. package/dist/drizzle/totp-target.mjs +2 -2
  96. package/dist/drizzle/transaction-execution.d.mts +2 -2
  97. package/dist/drizzle/transaction-owner.d.mts +1 -2
  98. package/dist/index.d.mts +3 -2
  99. package/dist/internal/drizzle-postgres-oauth-proxy.d.mts +138 -0
  100. package/dist/internal/drizzle-postgres-oauth-proxy.mjs +29 -0
  101. package/dist/internal/drizzle-postgres-oauth-proxy.mjs.map +1 -0
  102. package/dist/internal/drizzle-postgres.mjs +2 -0
  103. package/dist/internal/drizzle-postgres.mjs.map +1 -1
  104. package/dist/internal/drizzle-sqlite-oauth-proxy.d.mts +146 -0
  105. package/dist/internal/drizzle-sqlite-oauth-proxy.mjs +29 -0
  106. package/dist/internal/drizzle-sqlite-oauth-proxy.mjs.map +1 -0
  107. package/dist/internal/drizzle-sqlite.mjs +2 -0
  108. package/dist/internal/drizzle-sqlite.mjs.map +1 -1
  109. package/package.json +1 -1
  110. package/src/D1.ts +2 -0
  111. package/src/Libsql.ts +2 -0
  112. package/src/Pglite.ts +2 -0
  113. package/src/Postgres.ts +2 -0
  114. package/src/SqliteBun.ts +2 -0
  115. package/src/SqliteDo.ts +2 -0
  116. package/src/SqliteNode.ts +2 -0
  117. package/src/SqliteWasm.ts +2 -0
  118. package/src/drizzle/d1-password-prepared.ts +2 -23
  119. package/src/drizzle/d1-passwords.ts +158 -780
  120. package/src/drizzle/d1-sessions.ts +21 -6
  121. package/src/drizzle/mysql-password-prepared.ts +4 -16
  122. package/src/drizzle/mysql-passwords.ts +5 -20
  123. package/src/drizzle/native-sql-table.ts +259 -0
  124. package/src/drizzle/oauth-connected-model.ts +97 -315
  125. package/src/drizzle/oauth-connected-reference.ts +13 -93
  126. package/src/drizzle/oauth-connected-target.ts +14 -271
  127. package/src/drizzle/oauth-kernel.ts +10 -0
  128. package/src/drizzle/oauth-model.ts +188 -541
  129. package/src/drizzle/oauth-mysql.ts +2 -2
  130. package/src/drizzle/oauth-proxy.ts +101 -0
  131. package/src/drizzle/oauth-target.ts +33 -737
  132. package/src/drizzle/password-model.ts +0 -33
  133. package/src/drizzle/password-prepared-model.ts +0 -18
  134. package/src/drizzle/password-sql.ts +3 -0
  135. package/src/drizzle/password-target.ts +41 -4
  136. package/src/drizzle/pg-password-prepared.ts +4 -16
  137. package/src/drizzle/pg-passwords.ts +5 -20
  138. package/src/drizzle/query-operations.ts +4 -0
  139. package/src/drizzle/session-sql.ts +2 -1
  140. package/src/drizzle/sqlite-password-prepared.ts +4 -52
  141. package/src/drizzle/sqlite-passwords.ts +7 -28
  142. package/src/drizzle/storage-validation.ts +13 -222
  143. package/src/index.ts +2 -8
  144. package/src/internal/drizzle-postgres-oauth-proxy.ts +37 -0
  145. package/src/internal/drizzle-postgres.ts +2 -0
  146. package/src/internal/drizzle-sqlite-oauth-proxy.ts +44 -0
  147. package/src/internal/drizzle-sqlite.ts +2 -0
  148. package/dist/_virtual/_rolldown/runtime.mjs +0 -13
  149. package/dist/drizzle/oauth-accounts.mjs +0 -359
  150. package/dist/drizzle/oauth-accounts.mjs.map +0 -1
  151. package/dist/drizzle/oauth-connected-access.mjs +0 -212
  152. package/dist/drizzle/oauth-connected-access.mjs.map +0 -1
  153. package/dist/drizzle/oauth-connected-collection.mjs +0 -202
  154. package/dist/drizzle/oauth-connected-collection.mjs.map +0 -1
  155. package/dist/drizzle/oauth-connected-custody.mjs +0 -147
  156. package/dist/drizzle/oauth-connected-custody.mjs.map +0 -1
  157. package/dist/drizzle/oauth-connected-flow.mjs +0 -297
  158. package/dist/drizzle/oauth-connected-flow.mjs.map +0 -1
  159. package/dist/drizzle/oauth-connected-input.mjs +0 -122
  160. package/dist/drizzle/oauth-connected-input.mjs.map +0 -1
  161. package/dist/drizzle/oauth-connected-maintenance.mjs +0 -214
  162. package/dist/drizzle/oauth-connected-maintenance.mjs.map +0 -1
  163. package/dist/drizzle/oauth-connected-management.mjs +0 -229
  164. package/dist/drizzle/oauth-connected-management.mjs.map +0 -1
  165. package/dist/drizzle/oauth-connected-settlement.mjs +0 -128
  166. package/dist/drizzle/oauth-connected-settlement.mjs.map +0 -1
  167. package/dist/drizzle/oauth-connected-sign-in.mjs +0 -265
  168. package/dist/drizzle/oauth-connected-sign-in.mjs.map +0 -1
  169. package/dist/drizzle/oauth-connected-state.d.mts +0 -2062
  170. package/dist/drizzle/oauth-connected-state.mjs +0 -430
  171. package/dist/drizzle/oauth-connected-state.mjs.map +0 -1
  172. package/dist/drizzle/oauth-flow.d.mts +0 -22
  173. package/dist/drizzle/oauth-flow.mjs +0 -253
  174. package/dist/drizzle/oauth-flow.mjs.map +0 -1
  175. package/dist/drizzle/oauth-input.mjs +0 -127
  176. package/dist/drizzle/oauth-input.mjs.map +0 -1
  177. package/dist/drizzle/oauth-owner.d.mts +0 -10
  178. package/dist/drizzle/oauth-owner.mjs +0 -10
  179. package/dist/drizzle/oauth-owner.mjs.map +0 -1
  180. package/dist/drizzle/oauth-registration.d.mts +0 -5
  181. package/dist/drizzle/oauth-registration.mjs +0 -374
  182. package/dist/drizzle/oauth-registration.mjs.map +0 -1
  183. package/dist/drizzle/oauth-state.mjs +0 -107
  184. package/dist/drizzle/oauth-state.mjs.map +0 -1
  185. package/src/drizzle/oauth-accounts.ts +0 -805
  186. package/src/drizzle/oauth-connected-access.ts +0 -361
  187. package/src/drizzle/oauth-connected-collection.ts +0 -324
  188. package/src/drizzle/oauth-connected-custody.ts +0 -279
  189. package/src/drizzle/oauth-connected-flow.ts +0 -529
  190. package/src/drizzle/oauth-connected-input.ts +0 -147
  191. package/src/drizzle/oauth-connected-maintenance.ts +0 -346
  192. package/src/drizzle/oauth-connected-management.ts +0 -365
  193. package/src/drizzle/oauth-connected-settlement.ts +0 -251
  194. package/src/drizzle/oauth-connected-sign-in.ts +0 -443
  195. package/src/drizzle/oauth-connected-state.ts +0 -872
  196. package/src/drizzle/oauth-flow.ts +0 -462
  197. package/src/drizzle/oauth-input.ts +0 -201
  198. package/src/drizzle/oauth-owner.ts +0 -29
  199. package/src/drizzle/oauth-registration.ts +0 -640
  200. package/src/drizzle/oauth-state.ts +0 -218
@@ -63,8 +63,8 @@ export declare const requiredPasswordPreparedConstraints: {
63
63
  readonly digest: "unique(intent.digest)";
64
64
  };
65
65
  export type RequiredPasswordPreparedConstraints = typeof requiredPasswordPreparedConstraints;
66
- export interface PasswordPreparedPersistenceMapping<Subject extends Table, Identifier extends Table, Credential extends Table, AuthorityCredential extends Table, Attempt extends Table, RateScope extends Table, Charge extends Table, Command extends Table, Intent extends Table, Admission extends Table, NativeSubjectId> {
67
- readonly password: PasswordPersistenceMapping<Subject, Identifier, Credential, AuthorityCredential, Attempt, RateScope, Charge, Command, NativeSubjectId>;
66
+ export interface PasswordPreparedPersistenceMapping<Subject extends Table, Identifier extends Table, Credential extends Table, AuthorityCredential extends Table, Command extends Table, Intent extends Table, Admission extends Table, NativeSubjectId> {
67
+ readonly password: PasswordPersistenceMapping<Subject, Identifier, Credential, AuthorityCredential, Command, NativeSubjectId>;
68
68
  readonly intent: PasswordPreparedIntentTable<Intent, NativeSubjectId>;
69
69
  readonly admission: PasswordPreparedAdmissionTable<Admission>;
70
70
  readonly constraints: RequiredPasswordPreparedConstraints;
@@ -72,12 +72,12 @@ export interface PasswordPreparedPersistenceMapping<Subject extends Table, Ident
72
72
  /** Required by synchronous owners, invoked inside their actual transactionSync. */
73
73
  readonly allocateVersionSync?: () => PasswordPreparedVersion;
74
74
  }
75
- export type D1PasswordPreparedPersistenceMapping<Subject extends Table, Identifier extends Table, Credential extends Table, AuthorityCredential extends Table, Attempt extends Table, RateScope extends Table, Charge extends Table, Command extends Table, Intent extends Table, Admission extends Table, NativeSubjectId> = PasswordPreparedPersistenceMapping<Subject, Identifier, Credential, AuthorityCredential, Attempt, RateScope, Charge, Command, Intent, Admission, NativeSubjectId> & {
75
+ export type D1PasswordPreparedPersistenceMapping<Subject extends Table, Identifier extends Table, Credential extends Table, AuthorityCredential extends Table, Command extends Table, Intent extends Table, Admission extends Table, NativeSubjectId> = PasswordPreparedPersistenceMapping<Subject, Identifier, Credential, AuthorityCredential, Command, Intent, Admission, NativeSubjectId> & {
76
76
  /** Convert a stored native instant to epoch milliseconds in the same SQL engine. */
77
77
  readonly admissionClock: {
78
78
  readonly toMillis: (instant: SQL) => SQL;
79
79
  };
80
- readonly password: D1PasswordPersistenceMapping<Subject, Identifier, Credential, AuthorityCredential, Attempt, RateScope, Charge, Command, NativeSubjectId>;
80
+ readonly password: D1PasswordPersistenceMapping<Subject, Identifier, Credential, AuthorityCredential, Command, NativeSubjectId>;
81
81
  };
82
82
  /** Optional real proof completion authority. Request/delivery/abuse capabilities
83
83
  * are not required to complete the original continuation. */
@@ -87,6 +87,6 @@ export type PasswordPreparedProofMapping<Series extends Table, Continuation exte
87
87
  export type D1PasswordPreparedProofMapping<Series extends Table, Continuation extends Table, Command extends Table, Subject extends Table, Identifier extends Table, Credential extends Table, NativeSubjectId> = Pick<D1ProofPersistenceMapping<Table, Series, Table, Continuation, Table, Table, Table, Command, Subject, Identifier, Credential, NativeSubjectId>, Exclude<keyof PasswordPreparedProofMapping<Series, Continuation, Command, Subject, Identifier, Credential, NativeSubjectId>, "constraints">> & {
88
88
  readonly constraints: PasswordPreparedProofMapping<Series, Continuation, Command, Subject, Identifier, Credential, NativeSubjectId>["constraints"];
89
89
  };
90
- export type AnyPasswordPreparedPersistenceMapping = PasswordPreparedPersistenceMapping<Table, Table, Table, Table, Table, Table, Table, Table, Table, Table, unknown>;
90
+ export type AnyPasswordPreparedPersistenceMapping = PasswordPreparedPersistenceMapping<Table, Table, Table, Table, Table, Table, Table, unknown>;
91
91
  //#endregion
92
92
  //# sourceMappingURL=password-prepared-model.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"password-prepared-model.mjs","names":[],"sources":["../../src/drizzle/password-prepared-model.ts"],"sourcesContent":["import type {\n PasswordPreparedReady,\n PasswordPreparedReservation,\n PasswordPreparedVersion,\n} from \"@yielded/auth/Password\";\nimport type { InferInsertModel, InferSelectModel, SQL, Table } from \"drizzle-orm\";\nimport type { Effect } from \"effect\";\n\nimport type { PersistenceMappingError } from \"./model\";\nimport type { D1PasswordPersistenceMapping, PasswordPersistenceMapping } from \"./password-model\";\nimport type {\n D1ProofPersistenceMapping,\n ProofPersistenceMapping,\n RequiredProofConstraints,\n} from \"./proof-model\";\n\ntype ColumnKey<T extends Table> = Extract<keyof T[\"_\"][\"columns\"], string>;\nexport type PasswordPreparedState = \"Preparing\" | \"Ready\" | \"Consumed\" | \"Cancelled\" | \"Expired\";\n\n/** The retained intent is also its nonrefundable admission charge. Scalar identity,\n * scope and timing columns survive sensitive snapshot/digest erasure. */\nexport interface PasswordPreparedIntentTable<Intent extends Table, NativeSubjectId> {\n readonly table: Intent;\n readonly moduleId: ColumnKey<Intent>;\n readonly intentId: ColumnKey<Intent>;\n readonly commandId: ColumnKey<Intent>;\n readonly subjectId: ColumnKey<Intent>;\n readonly action: ColumnKey<Intent>;\n readonly generation: ColumnKey<Intent>;\n readonly version: ColumnKey<Intent>;\n readonly state: ColumnKey<Intent>;\n readonly digest: ColumnKey<Intent>;\n readonly snapshot: ColumnKey<Intent>;\n readonly identifierScope: ColumnKey<Intent>;\n readonly createdAt: ColumnKey<Intent>;\n readonly admittedAt: ColumnKey<Intent>;\n readonly admissionRetainUntil: ColumnKey<Intent>;\n readonly preparationExpiresAt: ColumnKey<Intent>;\n readonly expiresAt: ColumnKey<Intent>;\n readonly retainUntil: ColumnKey<Intent>;\n readonly states: Readonly<\n Record<PasswordPreparedState, InferSelectModel<Intent>[ColumnKey<Intent>]>\n >;\n readonly encodeInsert: (input: {\n readonly reservation: PasswordPreparedReservation;\n readonly nativeSubjectId: NativeSubjectId;\n readonly identifierScope: string;\n readonly admittedAtMillis: number;\n readonly admissionRetainUntilMillis: number;\n /** Bounded private core codec output; contains a salted verifier for Change/Reset. */\n readonly snapshot: string;\n }) => InferInsertModel<Intent>;\n readonly encodeReady: (input: {\n readonly ready: PasswordPreparedReady;\n readonly snapshot: string;\n }) => Partial<InferInsertModel<Intent>>;\n /** Erase snapshot and digest, preserving every identity/scope/time column. */\n readonly encodeTerminal: (\n state: Exclude<PasswordPreparedState, \"Preparing\" | \"Ready\">,\n ) => Partial<InferInsertModel<Intent>>;\n}\n\n/** One permanent row per configured module; never one row per attacker input.\n * Native owners lock this before subject → identifier → sorted credentials → intent.\n * It serializes admission and maintenance without process-local locks. */\nexport interface PasswordPreparedAdmissionTable<Admission extends Table> {\n readonly table: Admission;\n readonly moduleId: ColumnKey<Admission>;\n readonly intentId: ColumnKey<Admission>;\n readonly admittedAt: ColumnKey<Admission>;\n readonly admissionRetainUntil: ColumnKey<Admission>;\n readonly encodeInsert: (moduleId: string) => InferInsertModel<Admission>;\n}\n\nexport const requiredPasswordPreparedConstraints = {\n admission: \"unique(admission.moduleId)\",\n intent: \"unique(intent.moduleId,intent.intentId)\",\n command: \"unique(intent.moduleId,intent.commandId)\",\n digest: \"unique(intent.digest)\",\n} as const;\n\nexport type RequiredPasswordPreparedConstraints = typeof requiredPasswordPreparedConstraints;\n\nexport interface PasswordPreparedPersistenceMapping<\n Subject extends Table,\n Identifier extends Table,\n Credential extends Table,\n AuthorityCredential extends Table,\n Attempt extends Table,\n RateScope extends Table,\n Charge extends Table,\n Command extends Table,\n Intent extends Table,\n Admission extends Table,\n NativeSubjectId,\n> {\n readonly password: PasswordPersistenceMapping<\n Subject,\n Identifier,\n Credential,\n AuthorityCredential,\n Attempt,\n RateScope,\n Charge,\n Command,\n NativeSubjectId\n >;\n readonly intent: PasswordPreparedIntentTable<Intent, NativeSubjectId>;\n readonly admission: PasswordPreparedAdmissionTable<Admission>;\n readonly constraints: RequiredPasswordPreparedConstraints;\n readonly allocateVersion?: Effect.Effect<PasswordPreparedVersion, PersistenceMappingError>;\n /** Required by synchronous owners, invoked inside their actual transactionSync. */\n readonly allocateVersionSync?: () => PasswordPreparedVersion;\n}\n\nexport type D1PasswordPreparedPersistenceMapping<\n Subject extends Table,\n Identifier extends Table,\n Credential extends Table,\n AuthorityCredential extends Table,\n Attempt extends Table,\n RateScope extends Table,\n Charge extends Table,\n Command extends Table,\n Intent extends Table,\n Admission extends Table,\n NativeSubjectId,\n> = PasswordPreparedPersistenceMapping<\n Subject,\n Identifier,\n Credential,\n AuthorityCredential,\n Attempt,\n RateScope,\n Charge,\n Command,\n Intent,\n Admission,\n NativeSubjectId\n> & {\n /** Convert a stored native instant to epoch milliseconds in the same SQL engine. */\n readonly admissionClock: { readonly toMillis: (instant: SQL) => SQL };\n readonly password: D1PasswordPersistenceMapping<\n Subject,\n Identifier,\n Credential,\n AuthorityCredential,\n Attempt,\n RateScope,\n Charge,\n Command,\n NativeSubjectId\n >;\n};\n\n/** Optional real proof completion authority. Request/delivery/abuse capabilities\n * are not required to complete the original continuation. */\nexport type PasswordPreparedProofMapping<\n Series extends Table,\n Continuation extends Table,\n Command extends Table,\n Subject extends Table,\n Identifier extends Table,\n Credential extends Table,\n NativeSubjectId,\n> = Pick<\n ProofPersistenceMapping<\n Table,\n Series,\n Table,\n Continuation,\n Table,\n Table,\n Table,\n Command,\n Subject,\n Identifier,\n Credential,\n NativeSubjectId\n >,\n | \"series\"\n | \"continuation\"\n | \"command\"\n | \"authority\"\n | \"scopeKeys\"\n | \"encodeInstant\"\n | \"decodeInstant\"\n | \"allocateVersion\"\n | \"allocateVersionSync\"\n | \"isSeriesConflict\"\n | \"isCommandConflict\"\n | \"d1\"\n> & {\n readonly constraints: Pick<\n RequiredProofConstraints,\n \"series\" | \"continuationId\" | \"continuationDigest\" | \"command\"\n >;\n};\n\nexport type D1PasswordPreparedProofMapping<\n Series extends Table,\n Continuation extends Table,\n Command extends Table,\n Subject extends Table,\n Identifier extends Table,\n Credential extends Table,\n NativeSubjectId,\n> = Pick<\n D1ProofPersistenceMapping<\n Table,\n Series,\n Table,\n Continuation,\n Table,\n Table,\n Table,\n Command,\n Subject,\n Identifier,\n Credential,\n NativeSubjectId\n >,\n Exclude<\n keyof PasswordPreparedProofMapping<\n Series,\n Continuation,\n Command,\n Subject,\n Identifier,\n Credential,\n NativeSubjectId\n >,\n \"constraints\"\n >\n> & {\n readonly constraints: PasswordPreparedProofMapping<\n Series,\n Continuation,\n Command,\n Subject,\n Identifier,\n Credential,\n NativeSubjectId\n >[\"constraints\"];\n};\n\nexport type AnyPasswordPreparedPersistenceMapping = PasswordPreparedPersistenceMapping<\n Table,\n Table,\n Table,\n Table,\n Table,\n Table,\n Table,\n Table,\n Table,\n Table,\n unknown\n>;\n"],"mappings":";AA0EA,MAAa,sCAAsC;CACjD,WAAW;CACX,QAAQ;CACR,SAAS;CACT,QAAQ;AACV"}
1
+ {"version":3,"file":"password-prepared-model.mjs","names":[],"sources":["../../src/drizzle/password-prepared-model.ts"],"sourcesContent":["import type {\n PasswordPreparedReady,\n PasswordPreparedReservation,\n PasswordPreparedVersion,\n} from \"@yielded/auth/Password\";\nimport type { InferInsertModel, InferSelectModel, SQL, Table } from \"drizzle-orm\";\nimport type { Effect } from \"effect\";\n\nimport type { PersistenceMappingError } from \"./model\";\nimport type { D1PasswordPersistenceMapping, PasswordPersistenceMapping } from \"./password-model\";\nimport type {\n D1ProofPersistenceMapping,\n ProofPersistenceMapping,\n RequiredProofConstraints,\n} from \"./proof-model\";\n\ntype ColumnKey<T extends Table> = Extract<keyof T[\"_\"][\"columns\"], string>;\nexport type PasswordPreparedState = \"Preparing\" | \"Ready\" | \"Consumed\" | \"Cancelled\" | \"Expired\";\n\n/** The retained intent is also its nonrefundable admission charge. Scalar identity,\n * scope and timing columns survive sensitive snapshot/digest erasure. */\nexport interface PasswordPreparedIntentTable<Intent extends Table, NativeSubjectId> {\n readonly table: Intent;\n readonly moduleId: ColumnKey<Intent>;\n readonly intentId: ColumnKey<Intent>;\n readonly commandId: ColumnKey<Intent>;\n readonly subjectId: ColumnKey<Intent>;\n readonly action: ColumnKey<Intent>;\n readonly generation: ColumnKey<Intent>;\n readonly version: ColumnKey<Intent>;\n readonly state: ColumnKey<Intent>;\n readonly digest: ColumnKey<Intent>;\n readonly snapshot: ColumnKey<Intent>;\n readonly identifierScope: ColumnKey<Intent>;\n readonly createdAt: ColumnKey<Intent>;\n readonly admittedAt: ColumnKey<Intent>;\n readonly admissionRetainUntil: ColumnKey<Intent>;\n readonly preparationExpiresAt: ColumnKey<Intent>;\n readonly expiresAt: ColumnKey<Intent>;\n readonly retainUntil: ColumnKey<Intent>;\n readonly states: Readonly<\n Record<PasswordPreparedState, InferSelectModel<Intent>[ColumnKey<Intent>]>\n >;\n readonly encodeInsert: (input: {\n readonly reservation: PasswordPreparedReservation;\n readonly nativeSubjectId: NativeSubjectId;\n readonly identifierScope: string;\n readonly admittedAtMillis: number;\n readonly admissionRetainUntilMillis: number;\n /** Bounded private core codec output; contains a salted verifier for Change/Reset. */\n readonly snapshot: string;\n }) => InferInsertModel<Intent>;\n readonly encodeReady: (input: {\n readonly ready: PasswordPreparedReady;\n readonly snapshot: string;\n }) => Partial<InferInsertModel<Intent>>;\n /** Erase snapshot and digest, preserving every identity/scope/time column. */\n readonly encodeTerminal: (\n state: Exclude<PasswordPreparedState, \"Preparing\" | \"Ready\">,\n ) => Partial<InferInsertModel<Intent>>;\n}\n\n/** One permanent row per configured module; never one row per attacker input.\n * Native owners lock this before subject → identifier → sorted credentials → intent.\n * It serializes admission and maintenance without process-local locks. */\nexport interface PasswordPreparedAdmissionTable<Admission extends Table> {\n readonly table: Admission;\n readonly moduleId: ColumnKey<Admission>;\n readonly intentId: ColumnKey<Admission>;\n readonly admittedAt: ColumnKey<Admission>;\n readonly admissionRetainUntil: ColumnKey<Admission>;\n readonly encodeInsert: (moduleId: string) => InferInsertModel<Admission>;\n}\n\nexport const requiredPasswordPreparedConstraints = {\n admission: \"unique(admission.moduleId)\",\n intent: \"unique(intent.moduleId,intent.intentId)\",\n command: \"unique(intent.moduleId,intent.commandId)\",\n digest: \"unique(intent.digest)\",\n} as const;\n\nexport type RequiredPasswordPreparedConstraints = typeof requiredPasswordPreparedConstraints;\n\nexport interface PasswordPreparedPersistenceMapping<\n Subject extends Table,\n Identifier extends Table,\n Credential extends Table,\n AuthorityCredential extends Table,\n Command extends Table,\n Intent extends Table,\n Admission extends Table,\n NativeSubjectId,\n> {\n readonly password: PasswordPersistenceMapping<\n Subject,\n Identifier,\n Credential,\n AuthorityCredential,\n Command,\n NativeSubjectId\n >;\n readonly intent: PasswordPreparedIntentTable<Intent, NativeSubjectId>;\n readonly admission: PasswordPreparedAdmissionTable<Admission>;\n readonly constraints: RequiredPasswordPreparedConstraints;\n readonly allocateVersion?: Effect.Effect<PasswordPreparedVersion, PersistenceMappingError>;\n /** Required by synchronous owners, invoked inside their actual transactionSync. */\n readonly allocateVersionSync?: () => PasswordPreparedVersion;\n}\n\nexport type D1PasswordPreparedPersistenceMapping<\n Subject extends Table,\n Identifier extends Table,\n Credential extends Table,\n AuthorityCredential extends Table,\n Command extends Table,\n Intent extends Table,\n Admission extends Table,\n NativeSubjectId,\n> = PasswordPreparedPersistenceMapping<\n Subject,\n Identifier,\n Credential,\n AuthorityCredential,\n Command,\n Intent,\n Admission,\n NativeSubjectId\n> & {\n /** Convert a stored native instant to epoch milliseconds in the same SQL engine. */\n readonly admissionClock: { readonly toMillis: (instant: SQL) => SQL };\n readonly password: D1PasswordPersistenceMapping<\n Subject,\n Identifier,\n Credential,\n AuthorityCredential,\n Command,\n NativeSubjectId\n >;\n};\n\n/** Optional real proof completion authority. Request/delivery/abuse capabilities\n * are not required to complete the original continuation. */\nexport type PasswordPreparedProofMapping<\n Series extends Table,\n Continuation extends Table,\n Command extends Table,\n Subject extends Table,\n Identifier extends Table,\n Credential extends Table,\n NativeSubjectId,\n> = Pick<\n ProofPersistenceMapping<\n Table,\n Series,\n Table,\n Continuation,\n Table,\n Table,\n Table,\n Command,\n Subject,\n Identifier,\n Credential,\n NativeSubjectId\n >,\n | \"series\"\n | \"continuation\"\n | \"command\"\n | \"authority\"\n | \"scopeKeys\"\n | \"encodeInstant\"\n | \"decodeInstant\"\n | \"allocateVersion\"\n | \"allocateVersionSync\"\n | \"isSeriesConflict\"\n | \"isCommandConflict\"\n | \"d1\"\n> & {\n readonly constraints: Pick<\n RequiredProofConstraints,\n \"series\" | \"continuationId\" | \"continuationDigest\" | \"command\"\n >;\n};\n\nexport type D1PasswordPreparedProofMapping<\n Series extends Table,\n Continuation extends Table,\n Command extends Table,\n Subject extends Table,\n Identifier extends Table,\n Credential extends Table,\n NativeSubjectId,\n> = Pick<\n D1ProofPersistenceMapping<\n Table,\n Series,\n Table,\n Continuation,\n Table,\n Table,\n Table,\n Command,\n Subject,\n Identifier,\n Credential,\n NativeSubjectId\n >,\n Exclude<\n keyof PasswordPreparedProofMapping<\n Series,\n Continuation,\n Command,\n Subject,\n Identifier,\n Credential,\n NativeSubjectId\n >,\n \"constraints\"\n >\n> & {\n readonly constraints: PasswordPreparedProofMapping<\n Series,\n Continuation,\n Command,\n Subject,\n Identifier,\n Credential,\n NativeSubjectId\n >[\"constraints\"];\n};\n\nexport type AnyPasswordPreparedPersistenceMapping = PasswordPreparedPersistenceMapping<\n Table,\n Table,\n Table,\n Table,\n Table,\n Table,\n Table,\n unknown\n>;\n"],"mappings":";AA0EA,MAAa,sCAAsC;CACjD,WAAW;CACX,QAAQ;CACR,SAAS;CACT,QAAQ;AACV"}
@@ -2,8 +2,8 @@ import { passwordSqlKernel } from "./password-sql.mjs";
2
2
  import { DateTime, Effect, Redacted, Schema } from "effect";
3
3
  import { AuthenticationProof, AuthenticationRequirement, SessionInvalidationWindow } from "@yielded/auth/Sessions";
4
4
  import { ProofBinding, ProofContinuationId, ProofPurpose } from "@yielded/auth/Proofs";
5
- import { SubjectId, TokenDigest } from "@yielded/auth/Schema";
6
5
  import { PasswordAction, PasswordCommandId, PasswordCredentialSnapshot, PasswordPreparedConfiguration, PasswordPreparedIntentId, PasswordPreparedRequirement, PasswordPreparedReservation, PasswordPreparedReset, PasswordUnavailable, encodePasswordPreparedReady, snapshotPasswordPreparedReady, snapshotPasswordPreparedReservation } from "@yielded/auth/Password";
6
+ import { SubjectId, TokenDigest } from "@yielded/auth/Schema";
7
7
  //#region src/drizzle/password-prepared-state.ts
8
8
  const unavailable = () => PasswordUnavailable.make({});
9
9
  const Instant = Schema.Int.check(Schema.isBetween({
@@ -1,8 +1,9 @@
1
+ import { makeDrizzleSqlTables } from "./native-sql-table.mjs";
1
2
  import { drizzleQueryOperations } from "./query-operations.mjs";
2
3
  import { completeProofPlanIn } from "./proof-sql.mjs";
3
4
  import { CurrentPasswordSql, makePasswordKernel } from "@yielded/auth-persistence/Adapter";
4
5
  //#region src/drizzle/password-sql.ts
5
- const { makeSqlPasswordPersistence, passwordSqlKernel } = makePasswordKernel(drizzleQueryOperations, { completeProofPlanIn });
6
+ const { makeSqlPasswordPersistence, passwordSqlKernel } = makePasswordKernel(drizzleQueryOperations, { completeProofPlanIn }, makeDrizzleSqlTables);
6
7
  //#endregion
7
8
  export { CurrentPasswordSql, makeSqlPasswordPersistence, passwordSqlKernel };
8
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"password-sql.mjs","names":[],"sources":["../../src/drizzle/password-sql.ts"],"sourcesContent":["import { makePasswordKernel } from \"@yielded/auth-persistence/Adapter\";\n\nimport { completeProofPlanIn } from \"./proof-sql\";\nimport { drizzleQueryOperations } from \"./query-operations\";\nexport type { PasswordSqlQuery } from \"@yielded/auth-persistence/Adapter\";\nexport type { PasswordSqlDatabase } from \"@yielded/auth-persistence/Adapter\";\nexport { CurrentPasswordSql } from \"@yielded/auth-persistence/Adapter\";\nexport type { PasswordSqlConfiguration } from \"@yielded/auth-persistence/Adapter\";\n\nexport const { makeSqlPasswordPersistence, passwordSqlKernel } = makePasswordKernel(\n drizzleQueryOperations,\n { completeProofPlanIn },\n);\n"],"mappings":";;;;AASA,MAAa,EAAE,4BAA4B,sBAAsB,mBAC/D,wBACA,EAAE,oBAAoB,CACxB"}
1
+ {"version":3,"file":"password-sql.mjs","names":[],"sources":["../../src/drizzle/password-sql.ts"],"sourcesContent":["import { makePasswordKernel } from \"@yielded/auth-persistence/Adapter\";\n\nimport { makeDrizzleSqlTables } from \"./native-sql-table\";\nimport { completeProofPlanIn } from \"./proof-sql\";\nimport { drizzleQueryOperations } from \"./query-operations\";\nexport type { PasswordSqlQuery } from \"@yielded/auth-persistence/Adapter\";\nexport type { PasswordSqlDatabase } from \"@yielded/auth-persistence/Adapter\";\nexport { CurrentPasswordSql } from \"@yielded/auth-persistence/Adapter\";\n\nexport type { PasswordSqlConfiguration } from \"@yielded/auth-persistence/Adapter\";\n\nexport const { makeSqlPasswordPersistence, passwordSqlKernel } = makePasswordKernel(\n drizzleQueryOperations,\n { completeProofPlanIn },\n makeDrizzleSqlTables,\n);\n"],"mappings":";;;;;AAWA,MAAa,EAAE,4BAA4B,sBAAsB,mBAC/D,wBACA,EAAE,oBAAoB,GACtB,oBACF"}
@@ -2,7 +2,8 @@ import { validateDrizzleStorage } from "./storage-validation.mjs";
2
2
  import { sqlClientStandaloneGuard } from "./standalone-guard.mjs";
3
3
  import { CurrentPasswordSql, makeSqlPasswordPersistence } from "./password-sql.mjs";
4
4
  import { makeSqlPasswordRegistrationAuthority } from "./password-registration.mjs";
5
- import { Effect, Layer } from "effect";
5
+ import { CurrentPasswordPreparedTransaction, PasswordPreparedPostconditions } from "@yielded/auth-persistence/Adapter";
6
+ import { Cause, Effect, Layer } from "effect";
6
7
  import { LifecycleHooks, coordinateCommit, hasCommitScope } from "@yielded/auth/Hooks";
7
8
  import { PasswordPersistence, PasswordUnavailable } from "@yielded/auth/Password";
8
9
  //#region src/drizzle/password-target.ts
@@ -47,7 +48,17 @@ const coordinateTargetPasswordPersistence = (database, mapping, configuration, p
47
48
  proof: proofMapping
48
49
  }).pipe(Effect.mapError(() => PasswordUnavailable.make({})));
49
50
  return (yield* coordinateCommit(() => database.transaction((transaction) => Effect.gen(function* () {
50
- return yield* owner(transaction, { passwordPersistence: yield* makeSqlPasswordPersistence(mapping, passwordOptions(configuration, proofMapping, true)).pipe(Effect.provideService(CurrentPasswordSql, transaction)) });
51
+ const postconditions = [];
52
+ let acceptingPostconditions = true;
53
+ const value = yield* owner(transaction, { passwordPersistence: yield* makeSqlPasswordPersistence(mapping, passwordOptions(configuration, proofMapping, true)).pipe(Effect.provideService(CurrentPasswordSql, transaction)) }).pipe(Effect.provideService(PasswordPreparedPostconditions, { register: (check) => {
54
+ if (!acceptingPostconditions) return false;
55
+ postconditions.push(check);
56
+ return true;
57
+ } }), Effect.ensuring(Effect.sync(() => {
58
+ acceptingPostconditions = false;
59
+ })));
60
+ for (const check of postconditions) yield* check.pipe(Effect.provideService(CurrentPasswordPreparedTransaction, transaction), Effect.catchCause((cause) => Effect.failCause(Cause.map(cause, () => PasswordUnavailable.make({})))));
61
+ return value;
51
62
  })), { mode: configuration.mode }).pipe(Effect.provideService(LifecycleHooks, hooks))).value;
52
63
  });
53
64
  const coordinateTargetPasswordRegistration = (database, mapping, configuration, owner) => Effect.gen(function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"password-target.mjs","names":[],"sources":["../../src/drizzle/password-target.ts"],"sourcesContent":["import type { NativeDatabase } from \"@yielded/auth-persistence/Adapter\";\nimport {\n coordinateCommit,\n hasCommitScope,\n LifecycleHooks,\n type HookConfigurationError,\n} from \"@yielded/auth/Hooks\";\nimport { PasswordUnavailable, PasswordPersistence } from \"@yielded/auth/Password\";\n/* oxlint-disable no-explicit-any -- public driver wrappers restore concrete Drizzle generics. */\nimport { type Context, Effect, Layer } from \"effect\";\nimport type * as SqlError from \"effect/sql/SqlError\";\n\nimport {\n makeSqlPasswordRegistrationAuthority,\n type PasswordRegistrationAuthority,\n type PasswordRegistrationConfiguration,\n} from \"./password-registration\";\nimport {\n CurrentPasswordSql,\n makeSqlPasswordPersistence,\n type PasswordSqlConfiguration,\n type PasswordSqlDatabase,\n type PasswordSqlQuery,\n} from \"./password-sql\";\nimport type { ProofTargetConfiguration } from \"./proof-target\";\nimport { sqlClientStandaloneGuard, type TransactionService } from \"./standalone-guard\";\nimport { validateDrizzleStorage } from \"./storage-validation\";\n\nexport interface PasswordTargetConfiguration {\n readonly mode: \"interactive\" | \"synchronous\";\n readonly locking: boolean;\n readonly standaloneGuard: Effect.Effect<void, PasswordUnavailable>;\n readonly coordinatorGuard?: Effect.Effect<void, PasswordUnavailable>;\n readonly insertIfAbsent: (\n query: PasswordSqlQuery,\n selfKey: string,\n selfValue: unknown,\n ) => PasswordSqlQuery;\n readonly generatedSubjectRows: (query: PasswordSqlQuery) => PasswordSqlQuery;\n readonly proof: ProofTargetConfiguration;\n}\n\ninterface TransactionOwner<Transaction> {\n readonly transaction: <A, E, R>(\n body: (transaction: Transaction) => Effect.Effect<A, E, R>,\n ) => Effect.Effect<A, E | SqlError.SqlError, R>;\n}\n\nexport type PasswordCoordinatorError<E> =\n | E\n | PasswordUnavailable\n | HookConfigurationError\n | SqlError.SqlError;\n\nexport const sqlClientPasswordStandaloneGuard = (\n service: TransactionService | undefined,\n): Effect.Effect<void, PasswordUnavailable> =>\n sqlClientStandaloneGuard(service, () => PasswordUnavailable.make({}));\n\nexport const passwordOptions = (\n configuration: PasswordTargetConfiguration,\n proofMapping?: any,\n coordinated = false,\n): PasswordSqlConfiguration => ({\n mode: configuration.mode,\n locking: configuration.locking,\n\n standaloneGuard: !coordinated ? configuration.standaloneGuard : Effect.void,\n insertIfAbsent: configuration.insertIfAbsent,\n coordinated,\n ...(proofMapping === undefined\n ? {}\n : {\n proof: {\n mapping: proofMapping,\n configuration: {\n mode: configuration.proof.mode,\n locking: configuration.proof.locking,\n\n standaloneGuard: Effect.void,\n\n coordinated,\n insertIfAbsent: configuration.proof.insertIfAbsent,\n },\n },\n }),\n});\n\nconst registrationOptions = (\n configuration: PasswordTargetConfiguration,\n coordinated = false,\n): PasswordRegistrationConfiguration => ({\n mode: configuration.mode,\n locking: configuration.locking,\n\n standaloneGuard: !coordinated ? configuration.standaloneGuard : Effect.void,\n generatedSubjectRows: configuration.generatedSubjectRows,\n coordinated,\n});\n\nexport const makeTargetPasswordPersistenceServices = (\n mapping: any,\n configuration: PasswordTargetConfiguration,\n proofMapping?: any,\n) =>\n Effect.gen(function* () {\n return {\n passwordPersistence: yield* makeSqlPasswordPersistence(\n mapping,\n passwordOptions(configuration, proofMapping),\n ),\n };\n });\n\nexport const makeTargetPasswordRegistrationServices = <Registration>(\n mapping: any,\n configuration: PasswordTargetConfiguration,\n) =>\n Effect.gen(function* () {\n return {\n registrationAuthority: yield* makeSqlPasswordRegistrationAuthority<Registration>(\n mapping,\n registrationOptions(configuration),\n ),\n };\n });\n\n/** Native transaction acquisition exposes SqlError; caller errors propagate unchanged. */\nexport const coordinateTargetPasswordPersistence = <Transaction, A, E, R>(\n database: TransactionOwner<Transaction>,\n mapping: any,\n configuration: PasswordTargetConfiguration,\n proofMapping: any | undefined,\n owner: (\n transaction: Transaction,\n services: { readonly passwordPersistence: PasswordPersistence[\"Service\"] },\n ) => Effect.Effect<A, E, R>,\n): Effect.Effect<A, PasswordCoordinatorError<E>, R | LifecycleHooks | NativeDatabase> =>\n Effect.gen(function* (): Effect.fn.Return<\n A,\n PasswordCoordinatorError<E>,\n R | LifecycleHooks | NativeDatabase\n > {\n const hooks = yield* LifecycleHooks;\n\n if (yield* hasCommitScope) return yield* PasswordUnavailable.make({});\n yield* configuration.coordinatorGuard ?? configuration.standaloneGuard;\n\n yield* validateDrizzleStorage({ ...mapping, proof: proofMapping }).pipe(\n Effect.mapError(() => PasswordUnavailable.make({})),\n );\n\n const result = yield* coordinateCommit(\n () =>\n database.transaction((transaction) =>\n Effect.gen(function* () {\n return yield* owner(transaction, {\n passwordPersistence: yield* makeSqlPasswordPersistence(\n mapping,\n passwordOptions(configuration, proofMapping, true),\n ).pipe(\n Effect.provideService(\n CurrentPasswordSql,\n transaction as unknown as PasswordSqlDatabase,\n ),\n ),\n });\n }),\n ),\n { mode: configuration.mode },\n ).pipe(Effect.provideService(LifecycleHooks, hooks));\n\n return result.value;\n });\n\nexport const coordinateTargetPasswordRegistration = <Registration, Transaction, A, E, R>(\n database: TransactionOwner<Transaction>,\n mapping: any,\n configuration: PasswordTargetConfiguration,\n owner: (\n transaction: Transaction,\n services: {\n readonly registrationAuthority: PasswordRegistrationAuthority<Registration>;\n },\n ) => Effect.Effect<A, E, R>,\n): Effect.Effect<A, PasswordCoordinatorError<E>, R | LifecycleHooks | NativeDatabase> =>\n Effect.gen(function* (): Effect.fn.Return<\n A,\n PasswordCoordinatorError<E>,\n R | LifecycleHooks | NativeDatabase\n > {\n const hooks = yield* LifecycleHooks;\n\n if (yield* hasCommitScope) return yield* PasswordUnavailable.make({});\n yield* configuration.coordinatorGuard ?? configuration.standaloneGuard;\n\n yield* validateDrizzleStorage(mapping).pipe(\n Effect.mapError(() => PasswordUnavailable.make({})),\n );\n\n const result = yield* coordinateCommit(\n () =>\n database.transaction((transaction) =>\n Effect.gen(function* () {\n return yield* owner(transaction, {\n registrationAuthority: yield* makeSqlPasswordRegistrationAuthority<Registration>(\n mapping,\n registrationOptions(configuration, true),\n ).pipe(\n Effect.provideService(\n CurrentPasswordSql,\n transaction as unknown as PasswordSqlDatabase,\n ),\n ),\n });\n }),\n ),\n { mode: configuration.mode },\n ).pipe(Effect.provideService(LifecycleHooks, hooks));\n\n return result.value;\n });\n\nexport const passwordPersistenceLayer = <E, R>(\n services: Effect.Effect<{ readonly passwordPersistence: PasswordPersistence[\"Service\"] }, E, R>,\n) =>\n Layer.effect(\n PasswordPersistence,\n Effect.map(services, (value) => value.passwordPersistence),\n );\n\nexport const passwordRegistrationLayer = <Id, Registration, E, R>(\n tag: Context.Key<Id, PasswordRegistrationAuthority<Registration>>,\n services: Effect.Effect<\n { readonly registrationAuthority: PasswordRegistrationAuthority<Registration> },\n E,\n R\n >,\n) =>\n Layer.effect(\n tag,\n Effect.map(services, (value) => value.registrationAuthority),\n );\n"],"mappings":";;;;;;;;AAsDA,MAAa,oCACX,YAEA,yBAAyB,eAAe,oBAAoB,KAAK,CAAC,CAAC,CAAC;AAEtE,MAAa,mBACX,eACA,cACA,cAAc,WACgB;CAC9B,MAAM,cAAc;CACpB,SAAS,cAAc;CAEvB,iBAAiB,CAAC,cAAc,cAAc,kBAAkB,OAAO;CACvE,gBAAgB,cAAc;CAC9B;CACA,GAAI,iBAAiB,KAAA,IACjB,CAAC,IACD,EACE,OAAO;EACL,SAAS;EACT,eAAe;GACb,MAAM,cAAc,MAAM;GAC1B,SAAS,cAAc,MAAM;GAE7B,iBAAiB,OAAO;GAExB;GACA,gBAAgB,cAAc,MAAM;EACtC;CACF,EACF;AACN;AAEA,MAAM,uBACJ,eACA,cAAc,WACyB;CACvC,MAAM,cAAc;CACpB,SAAS,cAAc;CAEvB,iBAAiB,CAAC,cAAc,cAAc,kBAAkB,OAAO;CACvE,sBAAsB,cAAc;CACpC;AACF;AAEA,MAAa,yCACX,SACA,eACA,iBAEA,OAAO,IAAI,aAAa;CACtB,OAAO,EACL,qBAAqB,OAAO,2BAC1B,SACA,gBAAgB,eAAe,YAAY,CAC7C,EACF;AACF,CAAC;AAEH,MAAa,0CACX,SACA,kBAEA,OAAO,IAAI,aAAa;CACtB,OAAO,EACL,uBAAuB,OAAO,qCAC5B,SACA,oBAAoB,aAAa,CACnC,EACF;AACF,CAAC;;AAGH,MAAa,uCACX,UACA,SACA,eACA,cACA,UAKA,OAAO,IAAI,aAIT;CACA,MAAM,QAAQ,OAAO;CAErB,IAAI,OAAO,gBAAgB,OAAO,OAAO,oBAAoB,KAAK,CAAC,CAAC;CACpE,OAAO,cAAc,oBAAoB,cAAc;CAEvD,OAAO,uBAAuB;EAAE,GAAG;EAAS,OAAO;CAAa,CAAC,CAAC,CAAC,KACjE,OAAO,eAAe,oBAAoB,KAAK,CAAC,CAAC,CAAC,CACpD;CAsBA,QAAO,OApBe,uBAElB,SAAS,aAAa,gBACpB,OAAO,IAAI,aAAa;EACtB,OAAO,OAAO,MAAM,aAAa,EAC/B,qBAAqB,OAAO,2BAC1B,SACA,gBAAgB,eAAe,cAAc,IAAI,CACnD,CAAC,CAAC,KACA,OAAO,eACL,oBACA,WACF,CACF,EACF,CAAC;CACH,CAAC,CACH,GACF,EAAE,MAAM,cAAc,KAAK,CAC7B,CAAC,CAAC,KAAK,OAAO,eAAe,gBAAgB,KAAK,CAAC,EAAA,CAErC;AAChB,CAAC;AAEH,MAAa,wCACX,UACA,SACA,eACA,UAOA,OAAO,IAAI,aAIT;CACA,MAAM,QAAQ,OAAO;CAErB,IAAI,OAAO,gBAAgB,OAAO,OAAO,oBAAoB,KAAK,CAAC,CAAC;CACpE,OAAO,cAAc,oBAAoB,cAAc;CAEvD,OAAO,uBAAuB,OAAO,CAAC,CAAC,KACrC,OAAO,eAAe,oBAAoB,KAAK,CAAC,CAAC,CAAC,CACpD;CAsBA,QAAO,OApBe,uBAElB,SAAS,aAAa,gBACpB,OAAO,IAAI,aAAa;EACtB,OAAO,OAAO,MAAM,aAAa,EAC/B,uBAAuB,OAAO,qCAC5B,SACA,oBAAoB,eAAe,IAAI,CACzC,CAAC,CAAC,KACA,OAAO,eACL,oBACA,WACF,CACF,EACF,CAAC;CACH,CAAC,CACH,GACF,EAAE,MAAM,cAAc,KAAK,CAC7B,CAAC,CAAC,KAAK,OAAO,eAAe,gBAAgB,KAAK,CAAC,EAAA,CAErC;AAChB,CAAC;AAEH,MAAa,4BACX,aAEA,MAAM,OACJ,qBACA,OAAO,IAAI,WAAW,UAAU,MAAM,mBAAmB,CAC3D;AAEF,MAAa,6BACX,KACA,aAMA,MAAM,OACJ,KACA,OAAO,IAAI,WAAW,UAAU,MAAM,qBAAqB,CAC7D"}
1
+ {"version":3,"file":"password-target.mjs","names":[],"sources":["../../src/drizzle/password-target.ts"],"sourcesContent":["import {\n CurrentPasswordPreparedTransaction,\n type NativeDatabase,\n type PasswordPreparedPostcondition,\n PasswordPreparedPostconditions,\n} from \"@yielded/auth-persistence/Adapter\";\nimport {\n coordinateCommit,\n hasCommitScope,\n LifecycleHooks,\n type HookConfigurationError,\n} from \"@yielded/auth/Hooks\";\nimport { PasswordUnavailable, PasswordPersistence } from \"@yielded/auth/Password\";\n/* oxlint-disable no-explicit-any -- public driver wrappers restore concrete Drizzle generics. */\nimport { Cause, type Context, Effect, Layer } from \"effect\";\nimport type * as SqlError from \"effect/sql/SqlError\";\n\nimport {\n makeSqlPasswordRegistrationAuthority,\n type PasswordRegistrationAuthority,\n type PasswordRegistrationConfiguration,\n} from \"./password-registration\";\nimport {\n CurrentPasswordSql,\n makeSqlPasswordPersistence,\n type PasswordSqlConfiguration,\n type PasswordSqlDatabase,\n type PasswordSqlQuery,\n} from \"./password-sql\";\nimport type { ProofTargetConfiguration } from \"./proof-target\";\nimport { sqlClientStandaloneGuard, type TransactionService } from \"./standalone-guard\";\nimport { validateDrizzleStorage } from \"./storage-validation\";\n\nexport interface PasswordTargetConfiguration {\n readonly mode: \"interactive\" | \"synchronous\";\n readonly locking: boolean;\n readonly standaloneGuard: Effect.Effect<void, PasswordUnavailable>;\n readonly coordinatorGuard?: Effect.Effect<void, PasswordUnavailable>;\n readonly insertIfAbsent: (\n query: PasswordSqlQuery,\n selfKey: string,\n selfValue: unknown,\n ) => PasswordSqlQuery;\n readonly generatedSubjectRows: (query: PasswordSqlQuery) => PasswordSqlQuery;\n readonly proof: ProofTargetConfiguration;\n}\n\ninterface TransactionOwner<Transaction> {\n readonly transaction: <A, E, R>(\n body: (transaction: Transaction) => Effect.Effect<A, E, R>,\n ) => Effect.Effect<A, E | SqlError.SqlError, R>;\n}\n\nexport type PasswordCoordinatorError<E> =\n | E\n | PasswordUnavailable\n | HookConfigurationError\n | SqlError.SqlError;\n\nexport const sqlClientPasswordStandaloneGuard = (\n service: TransactionService | undefined,\n): Effect.Effect<void, PasswordUnavailable> =>\n sqlClientStandaloneGuard(service, () => PasswordUnavailable.make({}));\n\nexport const passwordOptions = (\n configuration: PasswordTargetConfiguration,\n proofMapping?: any,\n coordinated = false,\n): PasswordSqlConfiguration => ({\n mode: configuration.mode,\n locking: configuration.locking,\n\n standaloneGuard: !coordinated ? configuration.standaloneGuard : Effect.void,\n insertIfAbsent: configuration.insertIfAbsent,\n coordinated,\n ...(proofMapping === undefined\n ? {}\n : {\n proof: {\n mapping: proofMapping,\n configuration: {\n mode: configuration.proof.mode,\n locking: configuration.proof.locking,\n\n standaloneGuard: Effect.void,\n\n coordinated,\n insertIfAbsent: configuration.proof.insertIfAbsent,\n },\n },\n }),\n});\n\nconst registrationOptions = (\n configuration: PasswordTargetConfiguration,\n coordinated = false,\n): PasswordRegistrationConfiguration => ({\n mode: configuration.mode,\n locking: configuration.locking,\n\n standaloneGuard: !coordinated ? configuration.standaloneGuard : Effect.void,\n generatedSubjectRows: configuration.generatedSubjectRows,\n coordinated,\n});\n\nexport const makeTargetPasswordPersistenceServices = (\n mapping: any,\n configuration: PasswordTargetConfiguration,\n proofMapping?: any,\n) =>\n Effect.gen(function* () {\n return {\n passwordPersistence: yield* makeSqlPasswordPersistence(\n mapping,\n passwordOptions(configuration, proofMapping),\n ),\n };\n });\n\nexport const makeTargetPasswordRegistrationServices = <Registration>(\n mapping: any,\n configuration: PasswordTargetConfiguration,\n) =>\n Effect.gen(function* () {\n return {\n registrationAuthority: yield* makeSqlPasswordRegistrationAuthority<Registration>(\n mapping,\n registrationOptions(configuration),\n ),\n };\n });\n\n/** Native transaction acquisition exposes SqlError; caller errors propagate unchanged. */\nexport const coordinateTargetPasswordPersistence = <Transaction, A, E, R>(\n database: TransactionOwner<Transaction>,\n mapping: any,\n configuration: PasswordTargetConfiguration,\n proofMapping: any | undefined,\n owner: (\n transaction: Transaction,\n services: { readonly passwordPersistence: PasswordPersistence[\"Service\"] },\n ) => Effect.Effect<A, E, R>,\n): Effect.Effect<A, PasswordCoordinatorError<E>, R | LifecycleHooks | NativeDatabase> =>\n Effect.gen(function* (): Effect.fn.Return<\n A,\n PasswordCoordinatorError<E>,\n R | LifecycleHooks | NativeDatabase\n > {\n const hooks = yield* LifecycleHooks;\n\n if (yield* hasCommitScope) return yield* PasswordUnavailable.make({});\n yield* configuration.coordinatorGuard ?? configuration.standaloneGuard;\n\n yield* validateDrizzleStorage({ ...mapping, proof: proofMapping }).pipe(\n Effect.mapError(() => PasswordUnavailable.make({})),\n );\n\n const result = yield* coordinateCommit(\n () =>\n database.transaction((transaction) =>\n Effect.gen(function* () {\n const postconditions: Array<PasswordPreparedPostcondition> = [];\n let acceptingPostconditions = true;\n\n const value = yield* owner(transaction, {\n passwordPersistence: yield* makeSqlPasswordPersistence(\n mapping,\n passwordOptions(configuration, proofMapping, true),\n ).pipe(\n Effect.provideService(\n CurrentPasswordSql,\n transaction as unknown as PasswordSqlDatabase,\n ),\n ),\n }).pipe(\n Effect.provideService(PasswordPreparedPostconditions, {\n register: (check) => {\n if (!acceptingPostconditions) return false;\n postconditions.push(check);\n\n return true;\n },\n }),\n Effect.ensuring(\n Effect.sync(() => {\n acceptingPostconditions = false;\n }),\n ),\n );\n\n // Application work in this transaction must not change what the\n // password mutations committed to; a failure here rolls back both.\n for (const check of postconditions)\n yield* check.pipe(\n Effect.provideService(\n CurrentPasswordPreparedTransaction,\n transaction as unknown as PasswordSqlDatabase,\n ),\n Effect.catchCause((cause) =>\n Effect.failCause(Cause.map(cause, () => PasswordUnavailable.make({}))),\n ),\n );\n\n return value;\n }),\n ),\n { mode: configuration.mode },\n ).pipe(Effect.provideService(LifecycleHooks, hooks));\n\n return result.value;\n });\n\nexport const coordinateTargetPasswordRegistration = <Registration, Transaction, A, E, R>(\n database: TransactionOwner<Transaction>,\n mapping: any,\n configuration: PasswordTargetConfiguration,\n owner: (\n transaction: Transaction,\n services: {\n readonly registrationAuthority: PasswordRegistrationAuthority<Registration>;\n },\n ) => Effect.Effect<A, E, R>,\n): Effect.Effect<A, PasswordCoordinatorError<E>, R | LifecycleHooks | NativeDatabase> =>\n Effect.gen(function* (): Effect.fn.Return<\n A,\n PasswordCoordinatorError<E>,\n R | LifecycleHooks | NativeDatabase\n > {\n const hooks = yield* LifecycleHooks;\n\n if (yield* hasCommitScope) return yield* PasswordUnavailable.make({});\n yield* configuration.coordinatorGuard ?? configuration.standaloneGuard;\n\n yield* validateDrizzleStorage(mapping).pipe(\n Effect.mapError(() => PasswordUnavailable.make({})),\n );\n\n const result = yield* coordinateCommit(\n () =>\n database.transaction((transaction) =>\n Effect.gen(function* () {\n return yield* owner(transaction, {\n registrationAuthority: yield* makeSqlPasswordRegistrationAuthority<Registration>(\n mapping,\n registrationOptions(configuration, true),\n ).pipe(\n Effect.provideService(\n CurrentPasswordSql,\n transaction as unknown as PasswordSqlDatabase,\n ),\n ),\n });\n }),\n ),\n { mode: configuration.mode },\n ).pipe(Effect.provideService(LifecycleHooks, hooks));\n\n return result.value;\n });\n\nexport const passwordPersistenceLayer = <E, R>(\n services: Effect.Effect<{ readonly passwordPersistence: PasswordPersistence[\"Service\"] }, E, R>,\n) =>\n Layer.effect(\n PasswordPersistence,\n Effect.map(services, (value) => value.passwordPersistence),\n );\n\nexport const passwordRegistrationLayer = <Id, Registration, E, R>(\n tag: Context.Key<Id, PasswordRegistrationAuthority<Registration>>,\n services: Effect.Effect<\n { readonly registrationAuthority: PasswordRegistrationAuthority<Registration> },\n E,\n R\n >,\n) =>\n Layer.effect(\n tag,\n Effect.map(services, (value) => value.registrationAuthority),\n );\n"],"mappings":";;;;;;;;;AA2DA,MAAa,oCACX,YAEA,yBAAyB,eAAe,oBAAoB,KAAK,CAAC,CAAC,CAAC;AAEtE,MAAa,mBACX,eACA,cACA,cAAc,WACgB;CAC9B,MAAM,cAAc;CACpB,SAAS,cAAc;CAEvB,iBAAiB,CAAC,cAAc,cAAc,kBAAkB,OAAO;CACvE,gBAAgB,cAAc;CAC9B;CACA,GAAI,iBAAiB,KAAA,IACjB,CAAC,IACD,EACE,OAAO;EACL,SAAS;EACT,eAAe;GACb,MAAM,cAAc,MAAM;GAC1B,SAAS,cAAc,MAAM;GAE7B,iBAAiB,OAAO;GAExB;GACA,gBAAgB,cAAc,MAAM;EACtC;CACF,EACF;AACN;AAEA,MAAM,uBACJ,eACA,cAAc,WACyB;CACvC,MAAM,cAAc;CACpB,SAAS,cAAc;CAEvB,iBAAiB,CAAC,cAAc,cAAc,kBAAkB,OAAO;CACvE,sBAAsB,cAAc;CACpC;AACF;AAEA,MAAa,yCACX,SACA,eACA,iBAEA,OAAO,IAAI,aAAa;CACtB,OAAO,EACL,qBAAqB,OAAO,2BAC1B,SACA,gBAAgB,eAAe,YAAY,CAC7C,EACF;AACF,CAAC;AAEH,MAAa,0CACX,SACA,kBAEA,OAAO,IAAI,aAAa;CACtB,OAAO,EACL,uBAAuB,OAAO,qCAC5B,SACA,oBAAoB,aAAa,CACnC,EACF;AACF,CAAC;;AAGH,MAAa,uCACX,UACA,SACA,eACA,cACA,UAKA,OAAO,IAAI,aAIT;CACA,MAAM,QAAQ,OAAO;CAErB,IAAI,OAAO,gBAAgB,OAAO,OAAO,oBAAoB,KAAK,CAAC,CAAC;CACpE,OAAO,cAAc,oBAAoB,cAAc;CAEvD,OAAO,uBAAuB;EAAE,GAAG;EAAS,OAAO;CAAa,CAAC,CAAC,CAAC,KACjE,OAAO,eAAe,oBAAoB,KAAK,CAAC,CAAC,CAAC,CACpD;CAsDA,QAAO,OApDe,uBAElB,SAAS,aAAa,gBACpB,OAAO,IAAI,aAAa;EACtB,MAAM,iBAAuD,CAAC;EAC9D,IAAI,0BAA0B;EAE9B,MAAM,QAAQ,OAAO,MAAM,aAAa,EACtC,qBAAqB,OAAO,2BAC1B,SACA,gBAAgB,eAAe,cAAc,IAAI,CACnD,CAAC,CAAC,KACA,OAAO,eACL,oBACA,WACF,CACF,EACF,CAAC,CAAC,CAAC,KACD,OAAO,eAAe,gCAAgC,EACpD,WAAW,UAAU;GACnB,IAAI,CAAC,yBAAyB,OAAO;GACrC,eAAe,KAAK,KAAK;GAEzB,OAAO;EACT,EACF,CAAC,GACD,OAAO,SACL,OAAO,WAAW;GAChB,0BAA0B;EAC5B,CAAC,CACH,CACF;EAIA,KAAK,MAAM,SAAS,gBAClB,OAAO,MAAM,KACX,OAAO,eACL,oCACA,WACF,GACA,OAAO,YAAY,UACjB,OAAO,UAAU,MAAM,IAAI,aAAa,oBAAoB,KAAK,CAAC,CAAC,CAAC,CAAC,CACvE,CACF;EAEF,OAAO;CACT,CAAC,CACH,GACF,EAAE,MAAM,cAAc,KAAK,CAC7B,CAAC,CAAC,KAAK,OAAO,eAAe,gBAAgB,KAAK,CAAC,EAAA,CAErC;AAChB,CAAC;AAEH,MAAa,wCACX,UACA,SACA,eACA,UAOA,OAAO,IAAI,aAIT;CACA,MAAM,QAAQ,OAAO;CAErB,IAAI,OAAO,gBAAgB,OAAO,OAAO,oBAAoB,KAAK,CAAC,CAAC;CACpE,OAAO,cAAc,oBAAoB,cAAc;CAEvD,OAAO,uBAAuB,OAAO,CAAC,CAAC,KACrC,OAAO,eAAe,oBAAoB,KAAK,CAAC,CAAC,CAAC,CACpD;CAsBA,QAAO,OApBe,uBAElB,SAAS,aAAa,gBACpB,OAAO,IAAI,aAAa;EACtB,OAAO,OAAO,MAAM,aAAa,EAC/B,uBAAuB,OAAO,qCAC5B,SACA,oBAAoB,eAAe,IAAI,CACzC,CAAC,CAAC,KACA,OAAO,eACL,oBACA,WACF,CACF,EACF,CAAC;CACH,CAAC,CACH,GACF,EAAE,MAAM,cAAc,KAAK,CAC7B,CAAC,CAAC,KAAK,OAAO,eAAe,gBAAgB,KAAK,CAAC,EAAA,CAErC;AAChB,CAAC;AAEH,MAAa,4BACX,aAEA,MAAM,OACJ,qBACA,OAAO,IAAI,WAAW,UAAU,MAAM,mBAAmB,CAC3D;AAEF,MAAa,6BACX,KACA,aAMA,MAAM,OACJ,KACA,OAAO,IAAI,WAAW,UAAU,MAAM,qBAAqB,CAC7D"}
@@ -12,17 +12,17 @@ import { SqlError } from "effect/sql/SqlError";
12
12
  //#region src/drizzle/pg-password-prepared.d.ts
13
13
  type Database = EffectPgDatabase$1<AnyRelations> | EffectPgDatabase<AnyRelations>;
14
14
  type TransactionOf<D extends Database> = Parameters<Parameters<D["transaction"]>[0]>[0];
15
- export declare const makePgPasswordPreparedPersistenceServices: <S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, A extends AnyPgTable, RS extends AnyPgTable, CE extends AnyPgTable, M extends AnyPgTable, T extends AnyPgTable, B extends AnyPgTable, NativeId, PS extends AnyPgTable = AnyPgTable, PC extends AnyPgTable = AnyPgTable, PM extends AnyPgTable = AnyPgTable, PSub extends AnyPgTable = AnyPgTable, PI extends AnyPgTable = AnyPgTable, PCr extends AnyPgTable = AnyPgTable, PNativeId = unknown>(mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, A, RS, CE, M, T, B, NativeId>, proofMapping?: PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>) => Effect.Effect<{
15
+ export declare const makePgPasswordPreparedPersistenceServices: <S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, M extends AnyPgTable, T extends AnyPgTable, B extends AnyPgTable, NativeId, PS extends AnyPgTable = AnyPgTable, PC extends AnyPgTable = AnyPgTable, PM extends AnyPgTable = AnyPgTable, PSub extends AnyPgTable = AnyPgTable, PI extends AnyPgTable = AnyPgTable, PCr extends AnyPgTable = AnyPgTable, PNativeId = unknown>(mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, M, T, B, NativeId>, proofMapping?: PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>) => Effect.Effect<{
16
16
  passwordPreparedPersistence: PasswordPreparedPersistence;
17
17
  }, PasswordUnavailable, Database$1 | LifecycleHooks>;
18
- export declare function coordinatePgPasswordPreparedPersistence<TargetId, D extends Database, S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, A extends AnyPgTable, RS extends AnyPgTable, CE extends AnyPgTable, M extends AnyPgTable, T extends AnyPgTable, B extends AnyPgTable, NativeId, PS extends AnyPgTable, PC extends AnyPgTable, PM extends AnyPgTable, PSub extends AnyPgTable, PI extends AnyPgTable, PCr extends AnyPgTable, PNativeId, Out, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
19
- readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, A, RS, CE, M, T, B, NativeId>;
18
+ export declare function coordinatePgPasswordPreparedPersistence<TargetId, D extends Database, S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, M extends AnyPgTable, T extends AnyPgTable, B extends AnyPgTable, NativeId, PS extends AnyPgTable, PC extends AnyPgTable, PM extends AnyPgTable, PSub extends AnyPgTable, PI extends AnyPgTable, PCr extends AnyPgTable, PNativeId, Out, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
19
+ readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, M, T, B, NativeId>;
20
20
  readonly proofMapping?: PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId> | undefined;
21
21
  readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;
22
22
  readonly transaction?: never;
23
23
  }, body: Effect.Effect<Out, E, R>): Effect.Effect<Out, E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements>;
24
- export declare function coordinatePgPasswordPreparedPersistence<TargetId, D extends Database, S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, A extends AnyPgTable, RS extends AnyPgTable, CE extends AnyPgTable, M extends AnyPgTable, T extends AnyPgTable, B extends AnyPgTable, NativeId, PS extends AnyPgTable, PC extends AnyPgTable, PM extends AnyPgTable, PSub extends AnyPgTable, PI extends AnyPgTable, PCr extends AnyPgTable, PNativeId, Out, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
25
- readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, A, RS, CE, M, T, B, NativeId>;
24
+ export declare function coordinatePgPasswordPreparedPersistence<TargetId, D extends Database, S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, M extends AnyPgTable, T extends AnyPgTable, B extends AnyPgTable, NativeId, PS extends AnyPgTable, PC extends AnyPgTable, PM extends AnyPgTable, PSub extends AnyPgTable, PI extends AnyPgTable, PCr extends AnyPgTable, PNativeId, Out, E, R, DatabaseError, DatabaseRequirements, TxId, TxShape>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
25
+ readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, M, T, B, NativeId>;
26
26
  readonly proofMapping?: PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId> | undefined;
27
27
  readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;
28
28
  readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
@@ -1 +1 @@
1
- {"version":3,"file":"pg-password-prepared.mjs","names":["DatabaseService"],"sources":["../../src/drizzle/pg-password-prepared.ts"],"sourcesContent":["import { NativeDatabase } from \"@yielded/auth-persistence/Adapter\";\nimport type { LifecycleHooks, HookConfigurationError } from \"@yielded/auth/Hooks\";\nimport type { PasswordUnavailable, PasswordPreparedPersistence } from \"@yielded/auth/Password\";\nimport type { AnyRelations } from \"drizzle-orm\";\nimport type { EffectPgDatabase as PgliteDatabase } from \"drizzle-orm/effect-pglite\";\nimport type { EffectPgDatabase as PostgresDatabase } from \"drizzle-orm/effect-postgres\";\nimport type { AnyPgTable } from \"drizzle-orm/pg-core\";\nimport { Effect, Context } from \"effect\";\nimport type { SqlError } from \"effect/sql/SqlError\";\n\nimport { nativeDatabase } from \"./native-database\";\nimport type {\n PasswordPreparedPersistenceMapping,\n PasswordPreparedProofMapping,\n} from \"./password-prepared-model\";\nimport {\n makeTargetPasswordPreparedPersistenceServices,\n coordinateTargetPasswordPreparedPersistence,\n} from \"./password-prepared-target\";\nimport { CurrentPasswordSql } from \"./password-sql\";\nimport { Database as DatabaseService } from \"./pg-database\";\nimport { pgPasswordConfiguration as configuration } from \"./pg-passwords\";\nimport { acquireTransactionService, transactionService } from \"./standalone-guard\";\nimport type { SuppliedService } from \"./SuppliedService\";\ntype Database = PostgresDatabase<AnyRelations> | PgliteDatabase<AnyRelations>;\ntype TransactionOf<D extends Database> = Parameters<Parameters<D[\"transaction\"]>[0]>[0];\n\nexport const makePgPasswordPreparedPersistenceServices = <\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n A extends AnyPgTable,\n RS extends AnyPgTable,\n CE extends AnyPgTable,\n M extends AnyPgTable,\n T extends AnyPgTable,\n B extends AnyPgTable,\n NativeId,\n PS extends AnyPgTable = AnyPgTable,\n PC extends AnyPgTable = AnyPgTable,\n PM extends AnyPgTable = AnyPgTable,\n PSub extends AnyPgTable = AnyPgTable,\n PI extends AnyPgTable = AnyPgTable,\n PCr extends AnyPgTable = AnyPgTable,\n PNativeId = unknown,\n>(\n mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, A, RS, CE, M, T, B, NativeId>,\n proofMapping?: PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>,\n) =>\n Effect.flatMap(\n Effect.map(acquireTransactionService(DatabaseService), configuration),\n (configuration) =>\n makeTargetPasswordPreparedPersistenceServices(mapping, configuration, proofMapping),\n ).pipe(\n Effect.provideServiceEffect(CurrentPasswordSql, nativeDatabase(DatabaseService)),\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(DatabaseService)),\n );\n\nexport function coordinatePgPasswordPreparedPersistence<\n TargetId,\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n A extends AnyPgTable,\n RS extends AnyPgTable,\n CE extends AnyPgTable,\n M extends AnyPgTable,\n T extends AnyPgTable,\n B extends AnyPgTable,\n NativeId,\n PS extends AnyPgTable,\n PC extends AnyPgTable,\n PM extends AnyPgTable,\n PSub extends AnyPgTable,\n PI extends AnyPgTable,\n PCr extends AnyPgTable,\n PNativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, A, RS, CE, M, T, B, NativeId>;\n readonly proofMapping?:\n | PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>\n | undefined;\n readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;\n readonly transaction?: never;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements\n>;\n\nexport function coordinatePgPasswordPreparedPersistence<\n TargetId,\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n A extends AnyPgTable,\n RS extends AnyPgTable,\n CE extends AnyPgTable,\n M extends AnyPgTable,\n T extends AnyPgTable,\n B extends AnyPgTable,\n NativeId,\n PS extends AnyPgTable,\n PC extends AnyPgTable,\n PM extends AnyPgTable,\n PSub extends AnyPgTable,\n PI extends AnyPgTable,\n PCr extends AnyPgTable,\n PNativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, A, RS, CE, M, T, B, NativeId>;\n readonly proofMapping?:\n | PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>\n | undefined;\n readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;\n readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, TargetId | TxId> | LifecycleHooks | DatabaseRequirements\n>;\n\nexport function coordinatePgPasswordPreparedPersistence<\n TargetId,\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n A extends AnyPgTable,\n RS extends AnyPgTable,\n CE extends AnyPgTable,\n M extends AnyPgTable,\n T extends AnyPgTable,\n B extends AnyPgTable,\n NativeId,\n PS extends AnyPgTable,\n PC extends AnyPgTable,\n PM extends AnyPgTable,\n PSub extends AnyPgTable,\n PI extends AnyPgTable,\n PCr extends AnyPgTable,\n PNativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, A, RS, CE, M, T, B, NativeId>;\n readonly proofMapping?:\n | PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>\n | undefined;\n readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;\n readonly transaction?: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements\n> {\n return Effect.flatMap(nativeDatabase(acquire), (database) =>\n coordinateTargetPasswordPreparedPersistence<TransactionOf<D>, Out, E, Exclude<R, TargetId>>(\n database,\n options.mapping,\n configuration(transactionService(database)),\n options.proofMapping,\n (\n transaction: TransactionOf<D>,\n services: { readonly passwordPreparedPersistence: PasswordPreparedPersistence },\n ) => {\n const provided = Context.make(options.target, services.passwordPreparedPersistence);\n const work = Effect.provideContext(body, provided);\n\n return options.transaction === undefined\n ? work\n : Effect.provideService(work, options.transaction, options.transaction.of(transaction));\n },\n ).pipe(Effect.provideService(NativeDatabase, database)),\n );\n}\n"],"mappings":";;;;;;;;;AA2BA,MAAa,6CAoBX,SACA,iBAEA,OAAO,QACL,OAAO,IAAI,0BAA0BA,QAAe,GAAG,aAAa,IACnE,kBACC,8CAA8C,SAAS,eAAe,YAAY,CACtF,CAAC,CAAC,KACA,OAAO,qBAAqB,oBAAoB,eAAeA,QAAe,CAAC,GAC/E,OAAO,qBAAqB,gBAAgB,eAAeA,QAAe,CAAC,CAC7E;AA0FF,SAAgB,wCA6Bd,SACA,SAQA,MAKA;CACA,OAAO,OAAO,QAAQ,eAAe,OAAO,IAAI,aAC9C,4CACE,UACA,QAAQ,SACR,cAAc,mBAAmB,QAAQ,CAAC,GAC1C,QAAQ,eAEN,aACA,aACG;EACH,MAAM,WAAW,QAAQ,KAAK,QAAQ,QAAQ,SAAS,2BAA2B;EAClF,MAAM,OAAO,OAAO,eAAe,MAAM,QAAQ;EAEjD,OAAO,QAAQ,gBAAgB,KAAA,IAC3B,OACA,OAAO,eAAe,MAAM,QAAQ,aAAa,QAAQ,YAAY,GAAG,WAAW,CAAC;CAC1F,CACF,CAAC,CAAC,KAAK,OAAO,eAAe,gBAAgB,QAAQ,CAAC,CACxD;AACF"}
1
+ {"version":3,"file":"pg-password-prepared.mjs","names":["DatabaseService"],"sources":["../../src/drizzle/pg-password-prepared.ts"],"sourcesContent":["import { NativeDatabase } from \"@yielded/auth-persistence/Adapter\";\nimport type { LifecycleHooks, HookConfigurationError } from \"@yielded/auth/Hooks\";\nimport type { PasswordUnavailable, PasswordPreparedPersistence } from \"@yielded/auth/Password\";\nimport type { AnyRelations } from \"drizzle-orm\";\nimport type { EffectPgDatabase as PgliteDatabase } from \"drizzle-orm/effect-pglite\";\nimport type { EffectPgDatabase as PostgresDatabase } from \"drizzle-orm/effect-postgres\";\nimport type { AnyPgTable } from \"drizzle-orm/pg-core\";\nimport { Effect, Context } from \"effect\";\nimport type { SqlError } from \"effect/sql/SqlError\";\n\nimport { nativeDatabase } from \"./native-database\";\nimport type {\n PasswordPreparedPersistenceMapping,\n PasswordPreparedProofMapping,\n} from \"./password-prepared-model\";\nimport {\n makeTargetPasswordPreparedPersistenceServices,\n coordinateTargetPasswordPreparedPersistence,\n} from \"./password-prepared-target\";\nimport { CurrentPasswordSql } from \"./password-sql\";\nimport { Database as DatabaseService } from \"./pg-database\";\nimport { pgPasswordConfiguration as configuration } from \"./pg-passwords\";\nimport { acquireTransactionService, transactionService } from \"./standalone-guard\";\nimport type { SuppliedService } from \"./SuppliedService\";\ntype Database = PostgresDatabase<AnyRelations> | PgliteDatabase<AnyRelations>;\ntype TransactionOf<D extends Database> = Parameters<Parameters<D[\"transaction\"]>[0]>[0];\n\nexport const makePgPasswordPreparedPersistenceServices = <\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n M extends AnyPgTable,\n T extends AnyPgTable,\n B extends AnyPgTable,\n NativeId,\n PS extends AnyPgTable = AnyPgTable,\n PC extends AnyPgTable = AnyPgTable,\n PM extends AnyPgTable = AnyPgTable,\n PSub extends AnyPgTable = AnyPgTable,\n PI extends AnyPgTable = AnyPgTable,\n PCr extends AnyPgTable = AnyPgTable,\n PNativeId = unknown,\n>(\n mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, M, T, B, NativeId>,\n proofMapping?: PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>,\n) =>\n Effect.flatMap(\n Effect.map(acquireTransactionService(DatabaseService), configuration),\n (configuration) =>\n makeTargetPasswordPreparedPersistenceServices(mapping, configuration, proofMapping),\n ).pipe(\n Effect.provideServiceEffect(CurrentPasswordSql, nativeDatabase(DatabaseService)),\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(DatabaseService)),\n );\n\nexport function coordinatePgPasswordPreparedPersistence<\n TargetId,\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n M extends AnyPgTable,\n T extends AnyPgTable,\n B extends AnyPgTable,\n NativeId,\n PS extends AnyPgTable,\n PC extends AnyPgTable,\n PM extends AnyPgTable,\n PSub extends AnyPgTable,\n PI extends AnyPgTable,\n PCr extends AnyPgTable,\n PNativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, M, T, B, NativeId>;\n readonly proofMapping?:\n | PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>\n | undefined;\n readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;\n readonly transaction?: never;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements\n>;\n\nexport function coordinatePgPasswordPreparedPersistence<\n TargetId,\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n M extends AnyPgTable,\n T extends AnyPgTable,\n B extends AnyPgTable,\n NativeId,\n PS extends AnyPgTable,\n PC extends AnyPgTable,\n PM extends AnyPgTable,\n PSub extends AnyPgTable,\n PI extends AnyPgTable,\n PCr extends AnyPgTable,\n PNativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, M, T, B, NativeId>;\n readonly proofMapping?:\n | PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>\n | undefined;\n readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;\n readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, TargetId | TxId> | LifecycleHooks | DatabaseRequirements\n>;\n\nexport function coordinatePgPasswordPreparedPersistence<\n TargetId,\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n M extends AnyPgTable,\n T extends AnyPgTable,\n B extends AnyPgTable,\n NativeId,\n PS extends AnyPgTable,\n PC extends AnyPgTable,\n PM extends AnyPgTable,\n PSub extends AnyPgTable,\n PI extends AnyPgTable,\n PCr extends AnyPgTable,\n PNativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, M, T, B, NativeId>;\n readonly proofMapping?:\n | PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>\n | undefined;\n readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;\n readonly transaction?: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements\n> {\n return Effect.flatMap(nativeDatabase(acquire), (database) =>\n coordinateTargetPasswordPreparedPersistence<TransactionOf<D>, Out, E, Exclude<R, TargetId>>(\n database,\n options.mapping,\n configuration(transactionService(database)),\n options.proofMapping,\n (\n transaction: TransactionOf<D>,\n services: { readonly passwordPreparedPersistence: PasswordPreparedPersistence },\n ) => {\n const provided = Context.make(options.target, services.passwordPreparedPersistence);\n const work = Effect.provideContext(body, provided);\n\n return options.transaction === undefined\n ? work\n : Effect.provideService(work, options.transaction, options.transaction.of(transaction));\n },\n ).pipe(Effect.provideService(NativeDatabase, database)),\n );\n}\n"],"mappings":";;;;;;;;;AA2BA,MAAa,6CAiBX,SACA,iBAEA,OAAO,QACL,OAAO,IAAI,0BAA0BA,QAAe,GAAG,aAAa,IACnE,kBACC,8CAA8C,SAAS,eAAe,YAAY,CACtF,CAAC,CAAC,KACA,OAAO,qBAAqB,oBAAoB,eAAeA,QAAe,CAAC,GAC/E,OAAO,qBAAqB,gBAAgB,eAAeA,QAAe,CAAC,CAC7E;AAoFF,SAAgB,wCA0Bd,SACA,SAQA,MAKA;CACA,OAAO,OAAO,QAAQ,eAAe,OAAO,IAAI,aAC9C,4CACE,UACA,QAAQ,SACR,cAAc,mBAAmB,QAAQ,CAAC,GAC1C,QAAQ,eAEN,aACA,aACG;EACH,MAAM,WAAW,QAAQ,KAAK,QAAQ,QAAQ,SAAS,2BAA2B;EAClF,MAAM,OAAO,OAAO,eAAe,MAAM,QAAQ;EAEjD,OAAO,QAAQ,gBAAgB,KAAA,IAC3B,OACA,OAAO,eAAe,MAAM,QAAQ,aAAa,QAAQ,YAAY,GAAG,WAAW,CAAC;CAC1F,CACF,CAAC,CAAC,KAAK,OAAO,eAAe,gBAAgB,QAAQ,CAAC,CACxD;AACF"}
@@ -17,27 +17,18 @@ import { SqlError } from "effect/sql/SqlError";
17
17
  //#region src/drizzle/pg-passwords.d.ts
18
18
  type Database = EffectPgDatabase$1<AnyRelations> | EffectPgDatabase<AnyRelations>;
19
19
  type TransactionOf<D extends Database> = Parameters<Parameters<D["transaction"]>[0]>[0];
20
- type PasswordMapping<S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, A extends AnyPgTable, RS extends AnyPgTable, CE extends AnyPgTable, M extends AnyPgTable, NativeId> = PasswordPersistenceMapping<S, I, C, AC, A, RS, CE, M, NativeId>;
21
- export declare const makePgPasswordPersistenceServices: <S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, A extends AnyPgTable, RS extends AnyPgTable, CE extends AnyPgTable, M extends AnyPgTable, NativeId>(mapping: PasswordMapping<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<{
20
+ type PasswordMapping<S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, M extends AnyPgTable, NativeId> = PasswordPersistenceMapping<S, I, C, AC, M, NativeId>;
21
+ export declare const makePgPasswordPersistenceServices: <S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, M extends AnyPgTable, NativeId>(mapping: PasswordMapping<S, I, C, AC, M, NativeId>, proofMapping?: ProofPersistenceMapping<any, any, any, any, any, any, any, any, any, any, any, any>) => Effect.Effect<{
22
22
  passwordPersistence: {
23
- readonly admitAttempt: <A_1>(input: {
23
+ readonly findCredential: (input: {
24
24
  readonly moduleId: string;
25
- readonly action: "sign-in" | "change";
26
25
  readonly identifier: import("@yielded/auth/Identity").LoginIdentifier;
27
26
  readonly subjectId?: import("@yielded/auth/Schema").SubjectId;
28
- readonly policy: import("@yielded/auth/Password").PasswordAttemptPolicy;
29
- }, prepare: import("@yielded/auth/Password").PreparePasswordCommit<import("@yielded/auth/Password").PasswordAttemptAdmission, A_1>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A_1>, PasswordUnavailable>;
30
- readonly settleAttempt: <A_1>(input: {
31
- readonly moduleId: string;
32
- readonly attemptId: import("@yielded/auth/Password").PasswordAttemptId;
33
- readonly captured?: import("@yielded/auth/Password").PasswordCredentialSnapshot;
34
- readonly outcome: import("@yielded/auth/Password").PasswordAttemptDecision;
35
- readonly rehash?: {
36
- readonly expectedVersion: import("@yielded/auth/Sessions").SecurityRevision;
37
- readonly expectedVerifier: import("effect/Redacted").Redacted<import("@yielded/auth/Password").EncodedPasswordHash>;
38
- readonly nextVerifier: import("effect/Redacted").Redacted<import("@yielded/auth/Password").EncodedPasswordHash>;
39
- };
40
- }, prepare: import("@yielded/auth/Password").PreparePasswordCommit<import("@yielded/auth/Password").PasswordAttemptDecision, A_1>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A_1>, PasswordUnavailable>;
27
+ }) => Effect.Effect<import("effect/Option").Option<import("@yielded/auth/Password").PasswordCredentialSnapshot>, PasswordUnavailable>;
28
+ readonly rehashIfCurrent: (input: {
29
+ readonly credential: import("@yielded/auth/Password").PasswordCredentialSnapshot;
30
+ readonly nextVerifier: import("effect/Redacted").Redacted<import("@yielded/auth/Password").EncodedPasswordHash>;
31
+ }) => Effect.Effect<void, PasswordUnavailable>;
41
32
  readonly readForSubject: (input: {
42
33
  readonly moduleId: string;
43
34
  readonly subjectId: import("@yielded/auth/Schema").SubjectId;
@@ -46,28 +37,21 @@ export declare const makePgPasswordPersistenceServices: <S extends AnyPgTable, I
46
37
  readonly moduleId: string;
47
38
  readonly identifier: import("@yielded/auth/Identity").LoginIdentifier;
48
39
  }) => Effect.Effect<import("effect/Option").Option<import("@yielded/auth/Password").PasswordCredentialSnapshot>, PasswordUnavailable>;
49
- readonly addIfAbsent: <A_1>(input: import("@yielded/auth/Password").PasswordMutationInput, prepare: import("@yielded/auth/Password").PreparePasswordCommit<import("@yielded/auth/Password").PasswordMutationDecision, A_1>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A_1>, PasswordUnavailable>;
50
- readonly replaceIfCurrent: <A_1>(input: import("@yielded/auth/Password").PasswordMutationInput, prepare: import("@yielded/auth/Password").PreparePasswordCommit<import("@yielded/auth/Password").PasswordMutationDecision, A_1>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A_1>, PasswordUnavailable>;
40
+ readonly addIfAbsent: <A>(input: import("@yielded/auth/Password").PasswordMutationInput, prepare: import("@yielded/auth/Password").PreparePasswordCommit<import("@yielded/auth/Password").PasswordMutationDecision, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, PasswordUnavailable>;
41
+ readonly replaceIfCurrent: <A>(input: import("@yielded/auth/Password").PasswordMutationInput, prepare: import("@yielded/auth/Password").PreparePasswordCommit<import("@yielded/auth/Password").PasswordMutationDecision, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, PasswordUnavailable>;
51
42
  readonly checkReset: (input: import("@yielded/auth/Proofs").ProofCompletionInput) => Effect.Effect<boolean, PasswordUnavailable>;
52
- readonly resetWithProof: <A_1>(input: import("@yielded/auth/Password").PasswordMutationInput & {
43
+ readonly resetWithProof: <A>(input: import("@yielded/auth/Password").PasswordMutationInput & {
53
44
  readonly completion: import("@yielded/auth/Proofs").ProofCompletionPlan;
54
- }, prepare: import("@yielded/auth/Password").PreparePasswordCommit<import("@yielded/auth/Password").PasswordMutationDecision, A_1>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A_1>, PasswordUnavailable>;
55
- readonly cleanupAttempts: <A_1>(input: {
56
- readonly moduleId: string;
57
- readonly limit: number;
58
- }, prepare: import("@yielded/auth/Password").PreparePasswordCommit<{
59
- readonly removed: number;
60
- readonly hasMore: boolean;
61
- }, A_1>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A_1>, PasswordUnavailable>;
45
+ }, prepare: import("@yielded/auth/Password").PreparePasswordCommit<import("@yielded/auth/Password").PasswordMutationDecision, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, PasswordUnavailable>;
62
46
  };
63
47
  }, PasswordUnavailable, Database$1 | LifecycleHooks>;
64
- export declare function coordinatePgPasswordPersistence<D extends Database, S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, A extends AnyPgTable, RS extends AnyPgTable, CE extends AnyPgTable, M extends AnyPgTable, 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: {
65
- readonly mapping: PasswordMapping<S, I, C, AC, A, RS, CE, M, NativeId>;
48
+ export declare function coordinatePgPasswordPersistence<D extends Database, S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, M extends AnyPgTable, 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: {
49
+ readonly mapping: PasswordMapping<S, I, C, AC, M, NativeId>;
66
50
  readonly proofMapping?: PM;
67
51
  readonly transaction?: never;
68
52
  }, body: Effect.Effect<Out, E, R>): Effect.Effect<Out, E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, PasswordPersistence> | LifecycleHooks | DatabaseRequirements>;
69
- export declare function coordinatePgPasswordPersistence<D extends Database, S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, A extends AnyPgTable, RS extends AnyPgTable, CE extends AnyPgTable, M extends AnyPgTable, 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: {
70
- readonly mapping: PasswordMapping<S, I, C, AC, A, RS, CE, M, NativeId>;
53
+ export declare function coordinatePgPasswordPersistence<D extends Database, S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, M extends AnyPgTable, 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: {
54
+ readonly mapping: PasswordMapping<S, I, C, AC, M, NativeId>;
71
55
  readonly proofMapping?: PM;
72
56
  readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;
73
57
  }, body: Effect.Effect<Out, E, R>): Effect.Effect<Out, E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError, Exclude<R, PasswordPersistence | TxId> | LifecycleHooks | DatabaseRequirements>;
@@ -1 +1 @@
1
- {"version":3,"file":"pg-passwords.mjs","names":["DatabaseService"],"sources":["../../src/drizzle/pg-passwords.ts"],"sourcesContent":["import { NativeDatabase } from \"@yielded/auth-persistence/Adapter\";\nimport type { LifecycleHooks, HookConfigurationError } from \"@yielded/auth/Hooks\";\nimport { type PasswordUnavailable, PasswordPersistence } from \"@yielded/auth/Password\";\n/* oxlint-disable no-explicit-any -- proof mapping tables are independently typed by the proof owner; this driver forwards them unchanged to the shared target. */\nimport type { AnyRelations } from \"drizzle-orm\";\nimport type { EffectPgDatabase as PgliteDatabase } from \"drizzle-orm/effect-pglite\";\nimport type { EffectPgDatabase as PostgresDatabase } from \"drizzle-orm/effect-postgres\";\nimport type { AnyPgTable } from \"drizzle-orm/pg-core\";\nimport { Effect, Context } from \"effect\";\nimport type { SqlError } from \"effect/sql/SqlError\";\n\nimport { nativeDatabase } from \"./native-database\";\nimport type { PasswordPersistenceMapping, PasswordRegistrationMapping } from \"./password-model\";\nimport type { PasswordRegistrationAuthority } from \"./password-registration\";\nimport { CurrentPasswordSql } from \"./password-sql\";\nimport type { PasswordSqlQuery } from \"./password-sql\";\nimport {\n coordinateTargetPasswordPersistence,\n coordinateTargetPasswordRegistration,\n makeTargetPasswordPersistenceServices,\n makeTargetPasswordRegistrationServices,\n sqlClientPasswordStandaloneGuard,\n} from \"./password-target\";\nimport { Database as DatabaseService } from \"./pg-database\";\nimport type { ProofPersistenceMapping } from \"./proof-model\";\nimport type { ProofSqlQuery } from \"./proof-sql\";\nimport { sqlClientProofStandaloneGuard } from \"./proof-target\";\nimport {\n type TransactionService,\n acquireTransactionService,\n transactionService,\n} from \"./standalone-guard\";\nimport type { SuppliedService } from \"./SuppliedService\";\n\ntype Database = PostgresDatabase<AnyRelations> | PgliteDatabase<AnyRelations>;\ntype TransactionOf<D extends Database> = Parameters<Parameters<D[\"transaction\"]>[0]>[0];\n\nconst configuration = (service: TransactionService | undefined) => ({\n mode: \"interactive\" as const,\n locking: true,\n standaloneGuard: sqlClientPasswordStandaloneGuard(service),\n insertIfAbsent: (query: PasswordSqlQuery) => query.onConflictDoNothing(),\n generatedSubjectRows: (query: PasswordSqlQuery) => query.returning(),\n proof: {\n mode: \"interactive\" as const,\n locking: true,\n standaloneGuard: sqlClientProofStandaloneGuard(service),\n insertIfAbsent: (query: ProofSqlQuery) => query.onConflictDoNothing(),\n },\n});\n\ntype PasswordMapping<\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n A extends AnyPgTable,\n RS extends AnyPgTable,\n CE extends AnyPgTable,\n M extends AnyPgTable,\n NativeId,\n> = PasswordPersistenceMapping<S, I, C, AC, A, RS, CE, M, NativeId>;\n\nexport const makePgPasswordPersistenceServices = <\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n A extends AnyPgTable,\n RS extends AnyPgTable,\n CE extends AnyPgTable,\n M extends AnyPgTable,\n NativeId,\n>(\n mapping: PasswordMapping<S, I, C, AC, A, RS, CE, M, NativeId>,\n proofMapping?: ProofPersistenceMapping<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n >,\n) =>\n Effect.flatMap(\n Effect.map(acquireTransactionService(DatabaseService), configuration),\n (configuration) => makeTargetPasswordPersistenceServices(mapping, configuration, proofMapping),\n ).pipe(\n Effect.provideServiceEffect(CurrentPasswordSql, nativeDatabase(DatabaseService)),\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(DatabaseService)),\n );\n\nexport function coordinatePgPasswordPersistence<\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n A extends AnyPgTable,\n RS extends AnyPgTable,\n CE extends AnyPgTable,\n M extends AnyPgTable,\n NativeId,\n PM extends\n | ProofPersistenceMapping<any, any, any, any, any, any, any, any, any, any, any, any>\n | undefined,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordMapping<S, I, C, AC, A, RS, CE, M, NativeId>;\n readonly proofMapping?: PM;\n readonly transaction?: never;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, PasswordPersistence> | LifecycleHooks | DatabaseRequirements\n>;\n\nexport function coordinatePgPasswordPersistence<\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n A extends AnyPgTable,\n RS extends AnyPgTable,\n CE extends AnyPgTable,\n M extends AnyPgTable,\n NativeId,\n PM extends\n | ProofPersistenceMapping<any, any, any, any, any, any, any, any, any, any, any, any>\n | undefined,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordMapping<S, I, C, AC, A, RS, CE, M, NativeId>;\n readonly proofMapping?: PM;\n readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, PasswordPersistence | TxId> | LifecycleHooks | DatabaseRequirements\n>;\n\nexport function coordinatePgPasswordPersistence<\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n A extends AnyPgTable,\n RS extends AnyPgTable,\n CE extends AnyPgTable,\n M extends AnyPgTable,\n NativeId,\n PM extends\n | ProofPersistenceMapping<any, any, any, any, any, any, any, any, any, any, any, any>\n | undefined,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordMapping<S, I, C, AC, A, RS, CE, M, NativeId>;\n readonly proofMapping?: PM;\n readonly transaction?: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, PasswordPersistence> | LifecycleHooks | DatabaseRequirements\n> {\n return Effect.flatMap(nativeDatabase(acquire), (database) =>\n coordinateTargetPasswordPersistence<TransactionOf<D>, Out, E, Exclude<R, PasswordPersistence>>(\n database,\n options.mapping,\n configuration(transactionService(database)),\n options.proofMapping,\n (\n transaction: TransactionOf<D>,\n services: { readonly passwordPersistence: PasswordPersistence[\"Service\"] },\n ) => {\n const provided = Context.make(PasswordPersistence, services.passwordPersistence);\n const work = Effect.provideContext(body, provided);\n\n return options.transaction === undefined\n ? work\n : Effect.provideService(work, options.transaction, options.transaction.of(transaction));\n },\n ).pipe(Effect.provideService(NativeDatabase, database)),\n );\n}\n\nexport const makePgPasswordRegistrationServices = <\n Registration,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n Rq extends AnyPgTable,\n NativeId,\n>(\n mapping: PasswordRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>,\n) =>\n Effect.flatMap(\n Effect.map(acquireTransactionService(DatabaseService), configuration),\n (configuration) => makeTargetPasswordRegistrationServices<Registration>(mapping, configuration),\n ).pipe(\n Effect.provideServiceEffect(CurrentPasswordSql, nativeDatabase(DatabaseService)),\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(DatabaseService)),\n );\n\nexport function coordinatePgPasswordRegistration<\n TargetId,\n Registration,\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n Rq extends AnyPgTable,\n NativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordRegistrationMapping<NoInfer<Registration>, S, I, C, AC, Rq, NativeId>;\n readonly target: SuppliedService<TargetId, PasswordRegistrationAuthority<Registration>>;\n readonly transaction?: never;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements\n>;\n\nexport function coordinatePgPasswordRegistration<\n TargetId,\n Registration,\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n Rq extends AnyPgTable,\n NativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordRegistrationMapping<NoInfer<Registration>, S, I, C, AC, Rq, NativeId>;\n readonly target: SuppliedService<TargetId, PasswordRegistrationAuthority<Registration>>;\n readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, TargetId | TxId> | LifecycleHooks | DatabaseRequirements\n>;\n\nexport function coordinatePgPasswordRegistration<\n TargetId,\n Registration,\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n Rq extends AnyPgTable,\n NativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordRegistrationMapping<NoInfer<Registration>, S, I, C, AC, Rq, NativeId>;\n readonly target: SuppliedService<TargetId, PasswordRegistrationAuthority<Registration>>;\n readonly transaction?: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements\n> {\n return Effect.flatMap(nativeDatabase(acquire), (database) =>\n coordinateTargetPasswordRegistration<\n Registration,\n TransactionOf<D>,\n Out,\n E,\n Exclude<R, TargetId>\n >(\n database,\n options.mapping,\n configuration(transactionService(database)),\n (\n transaction: TransactionOf<D>,\n services: { readonly registrationAuthority: PasswordRegistrationAuthority<Registration> },\n ) => {\n const provided = Context.make(options.target, services.registrationAuthority);\n const work = Effect.provideContext(body, provided);\n\n return options.transaction === undefined\n ? work\n : Effect.provideService(work, options.transaction, options.transaction.of(transaction));\n },\n ).pipe(Effect.provideService(NativeDatabase, database)),\n );\n}\n\nexport { configuration as pgPasswordConfiguration };\n"],"mappings":";;;;;;;;;;AAqCA,MAAM,iBAAiB,aAA6C;CAClE,MAAM;CACN,SAAS;CACT,iBAAiB,iCAAiC,OAAO;CACzD,iBAAiB,UAA4B,MAAM,oBAAoB;CACvE,uBAAuB,UAA4B,MAAM,UAAU;CACnE,OAAO;EACL,MAAM;EACN,SAAS;EACT,iBAAiB,8BAA8B,OAAO;EACtD,iBAAiB,UAAyB,MAAM,oBAAoB;CACtE;AACF;AAcA,MAAa,qCAWX,SACA,iBAeA,OAAO,QACL,OAAO,IAAI,0BAA0BA,QAAe,GAAG,aAAa,IACnE,kBAAkB,sCAAsC,SAAS,eAAe,YAAY,CAC/F,CAAC,CAAC,KACA,OAAO,qBAAqB,oBAAoB,eAAeA,QAAe,CAAC,GAC/E,OAAO,qBAAqB,gBAAgB,eAAeA,QAAe,CAAC,CAC7E;AAsEF,SAAgB,gCAsBd,SACA,SAKA,MAKA;CACA,OAAO,OAAO,QAAQ,eAAe,OAAO,IAAI,aAC9C,oCACE,UACA,QAAQ,SACR,cAAc,mBAAmB,QAAQ,CAAC,GAC1C,QAAQ,eAEN,aACA,aACG;EACH,MAAM,WAAW,QAAQ,KAAK,qBAAqB,SAAS,mBAAmB;EAC/E,MAAM,OAAO,OAAO,eAAe,MAAM,QAAQ;EAEjD,OAAO,QAAQ,gBAAgB,KAAA,IAC3B,OACA,OAAO,eAAe,MAAM,QAAQ,aAAa,QAAQ,YAAY,GAAG,WAAW,CAAC;CAC1F,CACF,CAAC,CAAC,KAAK,OAAO,eAAe,gBAAgB,QAAQ,CAAC,CACxD;AACF;AAEA,MAAa,sCASX,YAEA,OAAO,QACL,OAAO,IAAI,0BAA0BA,QAAe,GAAG,aAAa,IACnE,kBAAkB,uCAAqD,SAAS,aAAa,CAChG,CAAC,CAAC,KACA,OAAO,qBAAqB,oBAAoB,eAAeA,QAAe,CAAC,GAC/E,OAAO,qBAAqB,gBAAgB,eAAeA,QAAe,CAAC,CAC7E;AA8DF,SAAgB,iCAkBd,SACA,SAKA,MAKA;CACA,OAAO,OAAO,QAAQ,eAAe,OAAO,IAAI,aAC9C,qCAOE,UACA,QAAQ,SACR,cAAc,mBAAmB,QAAQ,CAAC,IAExC,aACA,aACG;EACH,MAAM,WAAW,QAAQ,KAAK,QAAQ,QAAQ,SAAS,qBAAqB;EAC5E,MAAM,OAAO,OAAO,eAAe,MAAM,QAAQ;EAEjD,OAAO,QAAQ,gBAAgB,KAAA,IAC3B,OACA,OAAO,eAAe,MAAM,QAAQ,aAAa,QAAQ,YAAY,GAAG,WAAW,CAAC;CAC1F,CACF,CAAC,CAAC,KAAK,OAAO,eAAe,gBAAgB,QAAQ,CAAC,CACxD;AACF"}
1
+ {"version":3,"file":"pg-passwords.mjs","names":["DatabaseService"],"sources":["../../src/drizzle/pg-passwords.ts"],"sourcesContent":["import { NativeDatabase } from \"@yielded/auth-persistence/Adapter\";\nimport type { LifecycleHooks, HookConfigurationError } from \"@yielded/auth/Hooks\";\nimport { type PasswordUnavailable, PasswordPersistence } from \"@yielded/auth/Password\";\n/* oxlint-disable no-explicit-any -- proof mapping tables are independently typed by the proof owner; this driver forwards them unchanged to the shared target. */\nimport type { AnyRelations } from \"drizzle-orm\";\nimport type { EffectPgDatabase as PgliteDatabase } from \"drizzle-orm/effect-pglite\";\nimport type { EffectPgDatabase as PostgresDatabase } from \"drizzle-orm/effect-postgres\";\nimport type { AnyPgTable } from \"drizzle-orm/pg-core\";\nimport { Effect, Context } from \"effect\";\nimport type { SqlError } from \"effect/sql/SqlError\";\n\nimport { nativeDatabase } from \"./native-database\";\nimport type { PasswordPersistenceMapping, PasswordRegistrationMapping } from \"./password-model\";\nimport type { PasswordRegistrationAuthority } from \"./password-registration\";\nimport { CurrentPasswordSql } from \"./password-sql\";\nimport type { PasswordSqlQuery } from \"./password-sql\";\nimport {\n coordinateTargetPasswordPersistence,\n coordinateTargetPasswordRegistration,\n makeTargetPasswordPersistenceServices,\n makeTargetPasswordRegistrationServices,\n sqlClientPasswordStandaloneGuard,\n} from \"./password-target\";\nimport { Database as DatabaseService } from \"./pg-database\";\nimport type { ProofPersistenceMapping } from \"./proof-model\";\nimport type { ProofSqlQuery } from \"./proof-sql\";\nimport { sqlClientProofStandaloneGuard } from \"./proof-target\";\nimport {\n type TransactionService,\n acquireTransactionService,\n transactionService,\n} from \"./standalone-guard\";\nimport type { SuppliedService } from \"./SuppliedService\";\n\ntype Database = PostgresDatabase<AnyRelations> | PgliteDatabase<AnyRelations>;\ntype TransactionOf<D extends Database> = Parameters<Parameters<D[\"transaction\"]>[0]>[0];\n\nconst configuration = (service: TransactionService | undefined) => ({\n mode: \"interactive\" as const,\n locking: true,\n standaloneGuard: sqlClientPasswordStandaloneGuard(service),\n insertIfAbsent: (query: PasswordSqlQuery) => query.onConflictDoNothing(),\n generatedSubjectRows: (query: PasswordSqlQuery) => query.returning(),\n proof: {\n mode: \"interactive\" as const,\n locking: true,\n standaloneGuard: sqlClientProofStandaloneGuard(service),\n insertIfAbsent: (query: ProofSqlQuery) => query.onConflictDoNothing(),\n },\n});\n\ntype PasswordMapping<\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n M extends AnyPgTable,\n NativeId,\n> = PasswordPersistenceMapping<S, I, C, AC, M, NativeId>;\n\nexport const makePgPasswordPersistenceServices = <\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n M extends AnyPgTable,\n NativeId,\n>(\n mapping: PasswordMapping<S, I, C, AC, M, NativeId>,\n proofMapping?: ProofPersistenceMapping<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n >,\n) =>\n Effect.flatMap(\n Effect.map(acquireTransactionService(DatabaseService), configuration),\n (configuration) => makeTargetPasswordPersistenceServices(mapping, configuration, proofMapping),\n ).pipe(\n Effect.provideServiceEffect(CurrentPasswordSql, nativeDatabase(DatabaseService)),\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(DatabaseService)),\n );\n\nexport function coordinatePgPasswordPersistence<\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n M extends AnyPgTable,\n NativeId,\n PM extends\n | ProofPersistenceMapping<any, any, any, any, any, any, any, any, any, any, any, any>\n | undefined,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordMapping<S, I, C, AC, M, NativeId>;\n readonly proofMapping?: PM;\n readonly transaction?: never;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, PasswordPersistence> | LifecycleHooks | DatabaseRequirements\n>;\n\nexport function coordinatePgPasswordPersistence<\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n M extends AnyPgTable,\n NativeId,\n PM extends\n | ProofPersistenceMapping<any, any, any, any, any, any, any, any, any, any, any, any>\n | undefined,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordMapping<S, I, C, AC, M, NativeId>;\n readonly proofMapping?: PM;\n readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, PasswordPersistence | TxId> | LifecycleHooks | DatabaseRequirements\n>;\n\nexport function coordinatePgPasswordPersistence<\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n M extends AnyPgTable,\n NativeId,\n PM extends\n | ProofPersistenceMapping<any, any, any, any, any, any, any, any, any, any, any, any>\n | undefined,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordMapping<S, I, C, AC, M, NativeId>;\n readonly proofMapping?: PM;\n readonly transaction?: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, PasswordPersistence> | LifecycleHooks | DatabaseRequirements\n> {\n return Effect.flatMap(nativeDatabase(acquire), (database) =>\n coordinateTargetPasswordPersistence<TransactionOf<D>, Out, E, Exclude<R, PasswordPersistence>>(\n database,\n options.mapping,\n configuration(transactionService(database)),\n options.proofMapping,\n (\n transaction: TransactionOf<D>,\n services: { readonly passwordPersistence: PasswordPersistence[\"Service\"] },\n ) => {\n const provided = Context.make(PasswordPersistence, services.passwordPersistence);\n const work = Effect.provideContext(body, provided);\n\n return options.transaction === undefined\n ? work\n : Effect.provideService(work, options.transaction, options.transaction.of(transaction));\n },\n ).pipe(Effect.provideService(NativeDatabase, database)),\n );\n}\n\nexport const makePgPasswordRegistrationServices = <\n Registration,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n Rq extends AnyPgTable,\n NativeId,\n>(\n mapping: PasswordRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>,\n) =>\n Effect.flatMap(\n Effect.map(acquireTransactionService(DatabaseService), configuration),\n (configuration) => makeTargetPasswordRegistrationServices<Registration>(mapping, configuration),\n ).pipe(\n Effect.provideServiceEffect(CurrentPasswordSql, nativeDatabase(DatabaseService)),\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(DatabaseService)),\n );\n\nexport function coordinatePgPasswordRegistration<\n TargetId,\n Registration,\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n Rq extends AnyPgTable,\n NativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordRegistrationMapping<NoInfer<Registration>, S, I, C, AC, Rq, NativeId>;\n readonly target: SuppliedService<TargetId, PasswordRegistrationAuthority<Registration>>;\n readonly transaction?: never;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements\n>;\n\nexport function coordinatePgPasswordRegistration<\n TargetId,\n Registration,\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n Rq extends AnyPgTable,\n NativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordRegistrationMapping<NoInfer<Registration>, S, I, C, AC, Rq, NativeId>;\n readonly target: SuppliedService<TargetId, PasswordRegistrationAuthority<Registration>>;\n readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, TargetId | TxId> | LifecycleHooks | DatabaseRequirements\n>;\n\nexport function coordinatePgPasswordRegistration<\n TargetId,\n Registration,\n D extends Database,\n S extends AnyPgTable,\n I extends AnyPgTable,\n C extends AnyPgTable,\n AC extends AnyPgTable,\n Rq extends AnyPgTable,\n NativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n>(\n acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordRegistrationMapping<NoInfer<Registration>, S, I, C, AC, Rq, NativeId>;\n readonly target: SuppliedService<TargetId, PasswordRegistrationAuthority<Registration>>;\n readonly transaction?: SuppliedService<TxId, NoInfer<TransactionOf<D>>, TxShape>;\n },\n body: Effect.Effect<Out, E, R>,\n): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements\n> {\n return Effect.flatMap(nativeDatabase(acquire), (database) =>\n coordinateTargetPasswordRegistration<\n Registration,\n TransactionOf<D>,\n Out,\n E,\n Exclude<R, TargetId>\n >(\n database,\n options.mapping,\n configuration(transactionService(database)),\n (\n transaction: TransactionOf<D>,\n services: { readonly registrationAuthority: PasswordRegistrationAuthority<Registration> },\n ) => {\n const provided = Context.make(options.target, services.registrationAuthority);\n const work = Effect.provideContext(body, provided);\n\n return options.transaction === undefined\n ? work\n : Effect.provideService(work, options.transaction, options.transaction.of(transaction));\n },\n ).pipe(Effect.provideService(NativeDatabase, database)),\n );\n}\n\nexport { configuration as pgPasswordConfiguration };\n"],"mappings":";;;;;;;;;;AAqCA,MAAM,iBAAiB,aAA6C;CAClE,MAAM;CACN,SAAS;CACT,iBAAiB,iCAAiC,OAAO;CACzD,iBAAiB,UAA4B,MAAM,oBAAoB;CACvE,uBAAuB,UAA4B,MAAM,UAAU;CACnE,OAAO;EACL,MAAM;EACN,SAAS;EACT,iBAAiB,8BAA8B,OAAO;EACtD,iBAAiB,UAAyB,MAAM,oBAAoB;CACtE;AACF;AAWA,MAAa,qCAQX,SACA,iBAeA,OAAO,QACL,OAAO,IAAI,0BAA0BA,QAAe,GAAG,aAAa,IACnE,kBAAkB,sCAAsC,SAAS,eAAe,YAAY,CAC/F,CAAC,CAAC,KACA,OAAO,qBAAqB,oBAAoB,eAAeA,QAAe,CAAC,GAC/E,OAAO,qBAAqB,gBAAgB,eAAeA,QAAe,CAAC,CAC7E;AAgEF,SAAgB,gCAmBd,SACA,SAKA,MAKA;CACA,OAAO,OAAO,QAAQ,eAAe,OAAO,IAAI,aAC9C,oCACE,UACA,QAAQ,SACR,cAAc,mBAAmB,QAAQ,CAAC,GAC1C,QAAQ,eAEN,aACA,aACG;EACH,MAAM,WAAW,QAAQ,KAAK,qBAAqB,SAAS,mBAAmB;EAC/E,MAAM,OAAO,OAAO,eAAe,MAAM,QAAQ;EAEjD,OAAO,QAAQ,gBAAgB,KAAA,IAC3B,OACA,OAAO,eAAe,MAAM,QAAQ,aAAa,QAAQ,YAAY,GAAG,WAAW,CAAC;CAC1F,CACF,CAAC,CAAC,KAAK,OAAO,eAAe,gBAAgB,QAAQ,CAAC,CACxD;AACF;AAEA,MAAa,sCASX,YAEA,OAAO,QACL,OAAO,IAAI,0BAA0BA,QAAe,GAAG,aAAa,IACnE,kBAAkB,uCAAqD,SAAS,aAAa,CAChG,CAAC,CAAC,KACA,OAAO,qBAAqB,oBAAoB,eAAeA,QAAe,CAAC,GAC/E,OAAO,qBAAqB,gBAAgB,eAAeA,QAAe,CAAC,CAC7E;AA8DF,SAAgB,iCAkBd,SACA,SAKA,MAKA;CACA,OAAO,OAAO,QAAQ,eAAe,OAAO,IAAI,aAC9C,qCAOE,UACA,QAAQ,SACR,cAAc,mBAAmB,QAAQ,CAAC,IAExC,aACA,aACG;EACH,MAAM,WAAW,QAAQ,KAAK,QAAQ,QAAQ,SAAS,qBAAqB;EAC5E,MAAM,OAAO,OAAO,eAAe,MAAM,QAAQ;EAEjD,OAAO,QAAQ,gBAAgB,KAAA,IAC3B,OACA,OAAO,eAAe,MAAM,QAAQ,aAAa,QAAQ,YAAY,GAAG,WAAW,CAAC;CAC1F,CACF,CAAC,CAAC,KAAK,OAAO,eAAe,gBAAgB,QAAQ,CAAC,CACxD;AACF"}
@@ -15,7 +15,7 @@ type Database = EffectPgDatabase$1<AnyRelations> | EffectPgDatabase<AnyRelations
15
15
  type TransactionOf<D extends Database> = Parameters<Parameters<D["transaction"]>[0]>[0];
16
16
  export declare const makePgAuthenticationAuthorityServices: <Claims, Subject extends AnyPgTable, Credential extends AnyPgTable, Flow extends AnyPgTable, Pending extends AnyPgTable, NativeSubjectId>(mapping: AuthenticationAuthorityMapping<Claims, Subject, Credential, Flow, Pending, NativeSubjectId>) => Effect.Effect<{
17
17
  authenticationAuthority: {
18
- readonly capture: (subjectId: import("@yielded/auth/Schema").SubjectId, credentialIds: ReadonlyArray<string>) => Effect.Effect<import("@yielded/auth/Sessions").AuthenticationRevision, import("@yielded/auth/Sessions").StaleAuthentication | SessionUnavailable>;
18
+ readonly capture: (subjectId: import("@yielded/auth/Schema").SubjectId, credentialIds: ReadonlyArray<string>) => Effect.Effect<import("@yielded/auth/Sessions").AuthenticationCapture, import("@yielded/auth/Sessions").StaleAuthentication | SessionUnavailable>;
19
19
  readonly requirements: (evidence: import("@yielded/auth/Sessions").AuthenticationEvidence) => Effect.Effect<import("@yielded/auth/Sessions").AuthenticationRequirement, import("@yielded/auth/Sessions").StaleAuthentication | SessionUnavailable>;
20
20
  readonly approve: <A>(input: {
21
21
  readonly evidence: import("@yielded/auth/Sessions").AuthenticationEvidence;
@@ -1,14 +1,14 @@
1
1
  import { PersistenceMappingError as PersistenceMappingError$1 } from "./model.mjs";
2
2
  import "./transaction-owner.mjs";
3
- import { TransactionCoordinatorError } from "./transaction-execution.mjs";
4
3
  import "./phone-model.mjs";
5
4
  import "./SuppliedService.mjs";
5
+ import { TransactionCoordinatorError } from "./transaction-execution.mjs";
6
6
  import { NativeDatabase } from "@yielded/auth-persistence/Adapter";
7
7
  import { Table } from "drizzle-orm";
8
8
  import { Context, Crypto, Effect } from "effect";
9
9
  import { LifecycleHooks } from "@yielded/auth/Hooks";
10
- import { PhoneAdmission, PhoneConfigurationError, PhoneOtpUnavailable, PhonePersistence, PhoneSignInTargets } from "@yielded/auth/PhoneOtp";
11
10
  import { Statement } from "effect/sql/Statement";
11
+ import { PhoneAdmission, PhoneConfigurationError, PhoneOtpUnavailable, PhonePersistence, PhoneSignInTargets } from "@yielded/auth/PhoneOtp";
12
12
  //#region src/drizzle/phone-target.d.ts
13
13
  export type PhoneCoordinatorError<E> = TransactionCoordinatorError<E, PhoneOtpUnavailable> | PhoneConfigurationError | PersistenceMappingError$1;
14
14
  //#endregion
@@ -2,10 +2,10 @@ import { requiredProofConstraints } from "./proof-model.mjs";
2
2
  import { validateDrizzleStorage } from "./storage-validation.mjs";
3
3
  import { CurrentProofSql, completeProofPlanIn } from "./proof-sql.mjs";
4
4
  import { randomId } from "./crypto.mjs";
5
- import { coordinateTransactionOwner, makeTransactionExecution, sqlClientTransactionStandaloneGuard } from "./transaction-execution.mjs";
6
5
  import { phoneProofs, requiredPhoneConstraints } from "./phone-model.mjs";
7
6
  import { CurrentD1PlanningDatabase } from "./d1-planning.mjs";
8
7
  import { nativeDatabase } from "./native-database.mjs";
8
+ import { coordinateTransactionOwner, makeTransactionExecution, sqlClientTransactionStandaloneGuard } from "./transaction-execution.mjs";
9
9
  import { compileD1ProofCompletionPlan } from "./d1-proofs.mjs";
10
10
  import { CurrentPhoneTransaction, admitPhone, capturePhone, cleanupPhoneAdmission, equal, invariant, lookupPhone, preparePhoneMutation, unavailable } from "./phone-state.mjs";
11
11
  import { NativeDatabase } from "@yielded/auth-persistence/Adapter";
@@ -1,7 +1,7 @@
1
1
  import { column, updateValues } from "./model.mjs";
2
2
  import { balancedD1And, compactD1GeneratedStatement } from "./d1-generated-statement.mjs";
3
3
  import { validateDrizzleStorage } from "./storage-validation.mjs";
4
- import { and, asc, eq, getTableColumns, gt, gte, inArray, isNull, lte, notExists, or, sql } from "drizzle-orm";
4
+ import { and, asc, eq, getTableColumns, gt, gte, inArray, isNotNull, isNull, lte, ne, notExists, or, sql } from "drizzle-orm";
5
5
  /** The shared kernel only passes tables and expressions from this compiler.
6
6
  * Erasure stops at query shapes; row codecs and Effect errors remain explicit. */
7
7
  const drizzleQueryOperations = {
@@ -10,11 +10,13 @@ const drizzleQueryOperations = {
10
10
  asc,
11
11
  or,
12
12
  eq,
13
+ ne,
13
14
  gt,
14
15
  gte,
15
16
  lte,
16
17
  inArray,
17
18
  isNull,
19
+ isNotNull,
18
20
  notExists,
19
21
  sql,
20
22
  getTableColumns,
@@ -1 +1 @@
1
- {"version":3,"file":"query-operations.mjs","names":[],"sources":["../../src/drizzle/query-operations.ts"],"sourcesContent":["import type { QueryOperations } from \"@yielded/auth-persistence/Adapter\";\nimport {\n type SQL,\n type AnyColumn,\n and,\n asc,\n or,\n eq,\n gt,\n gte,\n lte,\n inArray,\n isNull,\n notExists,\n sql,\n getTableColumns,\n} from \"drizzle-orm\";\n\nimport { balancedD1And, compactD1GeneratedStatement } from \"./d1-generated-statement\";\nimport { column, updateValues } from \"./model\";\nimport { validateDrizzleStorage } from \"./storage-validation\";\n\nconst operations = {\n validateStorage: validateDrizzleStorage,\n and,\n asc,\n or,\n eq,\n gt,\n gte,\n lte,\n inArray,\n isNull,\n notExists,\n sql,\n getTableColumns,\n column,\n updateValues,\n balancedD1And,\n compactD1GeneratedStatement,\n};\n\n/** The shared kernel only passes tables and expressions from this compiler.\n * Erasure stops at query shapes; row codecs and Effect errors remain explicit. */\nexport const drizzleQueryOperations = operations as unknown as QueryOperations<SQL, AnyColumn>;\n"],"mappings":";;;;;;AA4CA,MAAa,yBAAyB;CArBpC,iBAAiB;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAKoC"}
1
+ {"version":3,"file":"query-operations.mjs","names":[],"sources":["../../src/drizzle/query-operations.ts"],"sourcesContent":["import type { QueryOperations } from \"@yielded/auth-persistence/Adapter\";\nimport {\n type SQL,\n type AnyColumn,\n and,\n asc,\n or,\n eq,\n ne,\n gt,\n gte,\n lte,\n inArray,\n isNull,\n isNotNull,\n notExists,\n sql,\n getTableColumns,\n} from \"drizzle-orm\";\n\nimport { balancedD1And, compactD1GeneratedStatement } from \"./d1-generated-statement\";\nimport { column, updateValues } from \"./model\";\nimport { validateDrizzleStorage } from \"./storage-validation\";\n\nconst operations = {\n validateStorage: validateDrizzleStorage,\n and,\n asc,\n or,\n eq,\n ne,\n gt,\n gte,\n lte,\n inArray,\n isNull,\n isNotNull,\n notExists,\n sql,\n getTableColumns,\n column,\n updateValues,\n balancedD1And,\n compactD1GeneratedStatement,\n};\n\n/** The shared kernel only passes tables and expressions from this compiler.\n * Erasure stops at query shapes; row codecs and Effect errors remain explicit. */\nexport const drizzleQueryOperations = operations as unknown as QueryOperations<SQL, AnyColumn>;\n"],"mappings":";;;;;;AAgDA,MAAa,yBAAyB;CAvBpC,iBAAiB;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAKoC"}
@@ -1,7 +1,8 @@
1
+ import { makeDrizzleSqlTables } from "./native-sql-table.mjs";
1
2
  import { drizzleQueryOperations } from "./query-operations.mjs";
2
3
  import { CurrentSessionSql, makeSessionKernel } from "@yielded/auth-persistence/Adapter";
3
4
  //#region src/drizzle/session-sql.ts
4
- const { makeSqlAuthenticationAuthority, makeSqlPendingAuthentication, makeSqlStatefulSessions, makeSqlSignedValidity, makeSqlSessionStepUp } = makeSessionKernel(drizzleQueryOperations);
5
+ const { makeSqlAuthenticationAuthority, makeSqlPendingAuthentication, makeSqlStatefulSessions, makeSqlSignedValidity, makeSqlSessionStepUp } = makeSessionKernel(drizzleQueryOperations, makeDrizzleSqlTables);
5
6
  //#endregion
6
7
  export { CurrentSessionSql, makeSqlAuthenticationAuthority, makeSqlPendingAuthentication, makeSqlSessionStepUp, makeSqlSignedValidity, makeSqlStatefulSessions };
7
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"session-sql.mjs","names":[],"sources":["../../src/drizzle/session-sql.ts"],"sourcesContent":["import { makeSessionKernel } from \"@yielded/auth-persistence/Adapter\";\n\nimport { drizzleQueryOperations } from \"./query-operations\";\nexport type { SessionSqlDatabase } from \"@yielded/auth-persistence/Adapter\";\nexport { CurrentSessionSql } from \"@yielded/auth-persistence/Adapter\";\nexport type { SessionSqlOptions } from \"@yielded/auth-persistence/Adapter\";\n\nexport const {\n makeSqlAuthenticationAuthority,\n makeSqlPendingAuthentication,\n makeSqlStatefulSessions,\n makeSqlSignedValidity,\n makeSqlSessionStepUp,\n} = makeSessionKernel(drizzleQueryOperations);\n"],"mappings":";;;AAOA,MAAa,EACX,gCACA,8BACA,yBACA,uBACA,yBACE,kBAAkB,sBAAsB"}
1
+ {"version":3,"file":"session-sql.mjs","names":[],"sources":["../../src/drizzle/session-sql.ts"],"sourcesContent":["import { makeSessionKernel } from \"@yielded/auth-persistence/Adapter\";\n\nimport { makeDrizzleSqlTables } from \"./native-sql-table\";\nimport { drizzleQueryOperations } from \"./query-operations\";\nexport type { SessionSqlDatabase } from \"@yielded/auth-persistence/Adapter\";\nexport { CurrentSessionSql } from \"@yielded/auth-persistence/Adapter\";\nexport type { SessionSqlOptions } from \"@yielded/auth-persistence/Adapter\";\n\nexport const {\n makeSqlAuthenticationAuthority,\n makeSqlPendingAuthentication,\n makeSqlStatefulSessions,\n makeSqlSignedValidity,\n makeSqlSessionStepUp,\n} = makeSessionKernel(drizzleQueryOperations, makeDrizzleSqlTables);\n"],"mappings":";;;;AAQA,MAAa,EACX,gCACA,8BACA,yBACA,uBACA,yBACE,kBAAkB,wBAAwB,oBAAoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"sqlite-password-prepared.mjs","names":[],"sources":["../../src/drizzle/sqlite-password-prepared.ts"],"sourcesContent":["import { NativeDatabase } from \"@yielded/auth-persistence/Adapter\";\nimport type { LifecycleHooks, HookConfigurationError } from \"@yielded/auth/Hooks\";\nimport type { PasswordUnavailable, PasswordPreparedPersistence } from \"@yielded/auth/Password\";\nimport type { AnySQLiteTable } from \"drizzle-orm/sqlite-core\";\nimport { Effect, Context } from \"effect\";\nimport type { SqlError } from \"effect/sql/SqlError\";\n\nimport { nativeDatabase } from \"./native-database\";\nimport type {\n PasswordPreparedPersistenceMapping,\n PasswordPreparedProofMapping,\n} from \"./password-prepared-model\";\nimport {\n makeTargetPasswordPreparedPersistenceServices,\n coordinateTargetPasswordPreparedPersistence,\n} from \"./password-prepared-target\";\nimport { CurrentPasswordSql } from \"./password-sql\";\nimport type { PasswordTargetConfiguration } from \"./password-target\";\nimport type { SqlitePasswordDatabase } from \"./sqlite-passwords\";\nimport {\n type TransactionService,\n acquireTransactionService,\n transactionService,\n} from \"./standalone-guard\";\nimport type { SuppliedService } from \"./SuppliedService\";\ntype TransactionOf<D extends SqlitePasswordDatabase> = Parameters<\n Parameters<D[\"transaction\"]>[0]\n>[0];\n\nexport const makeSqlitePasswordPreparedTarget = <\n DatabaseId,\n D extends SqlitePasswordDatabase,\n Synchronous extends boolean = false,\n>(\n databaseService: Context.Service<DatabaseId, D>,\n configuration:\n | PasswordTargetConfiguration\n | ((service: TransactionService | undefined) => PasswordTargetConfiguration),\n) => {\n const configurationFor = (database: D) =>\n typeof configuration === \"function\"\n ? configuration(transactionService(database))\n : configuration;\n\n const standaloneConfiguration =\n typeof configuration === \"function\"\n ? Effect.map(acquireTransactionService(databaseService), configuration)\n : Effect.succeed(configuration);\n\n function coordinatePasswordPreparedPersistence<\n Database extends D,\n TargetId,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n A extends AnySQLiteTable,\n RS extends AnySQLiteTable,\n CE extends AnySQLiteTable,\n M extends AnySQLiteTable,\n T extends AnySQLiteTable,\n B extends AnySQLiteTable,\n NativeId,\n PS extends AnySQLiteTable,\n PC extends AnySQLiteTable,\n PM extends AnySQLiteTable,\n PSub extends AnySQLiteTable,\n PI extends AnySQLiteTable,\n PCr extends AnySQLiteTable,\n PNativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n >(\n acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordPreparedPersistenceMapping<\n S,\n I,\n C,\n AC,\n A,\n RS,\n CE,\n M,\n T,\n B,\n NativeId\n >;\n readonly proofMapping?:\n | PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>\n | undefined;\n readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;\n readonly transaction?: never;\n },\n body: Effect.Effect<Out, E, Synchronous extends true ? NoInfer<TargetId> : R>,\n ): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n | (Synchronous extends true ? never : Exclude<R, TargetId>)\n | LifecycleHooks\n | DatabaseRequirements\n >;\n function coordinatePasswordPreparedPersistence<\n Database extends D,\n TargetId,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n A extends AnySQLiteTable,\n RS extends AnySQLiteTable,\n CE extends AnySQLiteTable,\n M extends AnySQLiteTable,\n T extends AnySQLiteTable,\n B extends AnySQLiteTable,\n NativeId,\n PS extends AnySQLiteTable,\n PC extends AnySQLiteTable,\n PM extends AnySQLiteTable,\n PSub extends AnySQLiteTable,\n PI extends AnySQLiteTable,\n PCr extends AnySQLiteTable,\n PNativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n >(\n acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordPreparedPersistenceMapping<\n S,\n I,\n C,\n AC,\n A,\n RS,\n CE,\n M,\n T,\n B,\n NativeId\n >;\n readonly proofMapping?:\n | PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>\n | undefined;\n readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;\n readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<Database>>, TxShape>;\n },\n body: Effect.Effect<Out, E, Synchronous extends true ? NoInfer<TargetId | TxId> : R>,\n ): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n | (Synchronous extends true ? never : Exclude<R, TargetId | TxId>)\n | LifecycleHooks\n | DatabaseRequirements\n >;\n function coordinatePasswordPreparedPersistence<\n Database extends D,\n TargetId,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n A extends AnySQLiteTable,\n RS extends AnySQLiteTable,\n CE extends AnySQLiteTable,\n M extends AnySQLiteTable,\n T extends AnySQLiteTable,\n B extends AnySQLiteTable,\n NativeId,\n PS extends AnySQLiteTable,\n PC extends AnySQLiteTable,\n PM extends AnySQLiteTable,\n PSub extends AnySQLiteTable,\n PI extends AnySQLiteTable,\n PCr extends AnySQLiteTable,\n PNativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n >(\n acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordPreparedPersistenceMapping<\n S,\n I,\n C,\n AC,\n A,\n RS,\n CE,\n M,\n T,\n B,\n NativeId\n >;\n readonly proofMapping?:\n | PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>\n | undefined;\n readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;\n readonly transaction?: SuppliedService<TxId, NoInfer<TransactionOf<Database>>, TxShape>;\n },\n body: Effect.Effect<Out, E, R>,\n ): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements\n > {\n return Effect.flatMap(nativeDatabase(acquire), (database) =>\n coordinateTargetPasswordPreparedPersistence<\n TransactionOf<Database>,\n Out,\n E,\n Exclude<R, TargetId>\n >(\n database,\n options.mapping,\n configurationFor(database),\n options.proofMapping,\n (\n transaction: TransactionOf<Database>,\n services: { readonly passwordPreparedPersistence: PasswordPreparedPersistence },\n ) => {\n const provided = Context.make(options.target, services.passwordPreparedPersistence);\n const work = Effect.provideContext(body, provided);\n\n return options.transaction === undefined\n ? work\n : Effect.provideService(work, options.transaction, options.transaction.of(transaction));\n },\n ).pipe(Effect.provideService(NativeDatabase, database)),\n );\n }\n\n return {\n makePasswordPreparedPersistenceServices: <\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n A extends AnySQLiteTable,\n RS extends AnySQLiteTable,\n CE extends AnySQLiteTable,\n M extends AnySQLiteTable,\n T extends AnySQLiteTable,\n B extends AnySQLiteTable,\n NativeId,\n PS extends AnySQLiteTable = AnySQLiteTable,\n PC extends AnySQLiteTable = AnySQLiteTable,\n PM extends AnySQLiteTable = AnySQLiteTable,\n PSub extends AnySQLiteTable = AnySQLiteTable,\n PI extends AnySQLiteTable = AnySQLiteTable,\n PCr extends AnySQLiteTable = AnySQLiteTable,\n PNativeId = unknown,\n >(\n mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, A, RS, CE, M, T, B, NativeId>,\n proofMapping?: PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>,\n ) =>\n Effect.flatMap(standaloneConfiguration, (configuration) =>\n makeTargetPasswordPreparedPersistenceServices(mapping, configuration, proofMapping),\n ).pipe(\n Effect.provideServiceEffect(CurrentPasswordSql, nativeDatabase(databaseService)),\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService)),\n ),\n coordinatePasswordPreparedPersistence,\n };\n};\n"],"mappings":";;;;;;;AA6BA,MAAa,oCAKX,iBACA,kBAGG;CACH,MAAM,oBAAoB,aACxB,OAAO,kBAAkB,aACrB,cAAc,mBAAmB,QAAQ,CAAC,IAC1C;CAEN,MAAM,0BACJ,OAAO,kBAAkB,aACrB,OAAO,IAAI,0BAA0B,eAAe,GAAG,aAAa,IACpE,OAAO,QAAQ,aAAa;CAoHlC,SAAS,sCA6BP,SACA,SAoBA,MAKA;EACA,OAAO,OAAO,QAAQ,eAAe,OAAO,IAAI,aAC9C,4CAME,UACA,QAAQ,SACR,iBAAiB,QAAQ,GACzB,QAAQ,eAEN,aACA,aACG;GACH,MAAM,WAAW,QAAQ,KAAK,QAAQ,QAAQ,SAAS,2BAA2B;GAClF,MAAM,OAAO,OAAO,eAAe,MAAM,QAAQ;GAEjD,OAAO,QAAQ,gBAAgB,KAAA,IAC3B,OACA,OAAO,eAAe,MAAM,QAAQ,aAAa,QAAQ,YAAY,GAAG,WAAW,CAAC;EAC1F,CACF,CAAC,CAAC,KAAK,OAAO,eAAe,gBAAgB,QAAQ,CAAC,CACxD;CACF;CAEA,OAAO;EACL,0CAoBE,SACA,iBAEA,OAAO,QAAQ,0BAA0B,kBACvC,8CAA8C,SAAS,eAAe,YAAY,CACpF,CAAC,CAAC,KACA,OAAO,qBAAqB,oBAAoB,eAAe,eAAe,CAAC,GAC/E,OAAO,qBAAqB,gBAAgB,eAAe,eAAe,CAAC,CAC7E;EACF;CACF;AACF"}
1
+ {"version":3,"file":"sqlite-password-prepared.mjs","names":[],"sources":["../../src/drizzle/sqlite-password-prepared.ts"],"sourcesContent":["import { NativeDatabase } from \"@yielded/auth-persistence/Adapter\";\nimport type { LifecycleHooks, HookConfigurationError } from \"@yielded/auth/Hooks\";\nimport type { PasswordUnavailable, PasswordPreparedPersistence } from \"@yielded/auth/Password\";\nimport type { AnySQLiteTable } from \"drizzle-orm/sqlite-core\";\nimport { Effect, Context } from \"effect\";\nimport type { SqlError } from \"effect/sql/SqlError\";\n\nimport { nativeDatabase } from \"./native-database\";\nimport type {\n PasswordPreparedPersistenceMapping,\n PasswordPreparedProofMapping,\n} from \"./password-prepared-model\";\nimport {\n makeTargetPasswordPreparedPersistenceServices,\n coordinateTargetPasswordPreparedPersistence,\n} from \"./password-prepared-target\";\nimport { CurrentPasswordSql } from \"./password-sql\";\nimport type { PasswordTargetConfiguration } from \"./password-target\";\nimport type { SqlitePasswordDatabase } from \"./sqlite-passwords\";\nimport {\n type TransactionService,\n acquireTransactionService,\n transactionService,\n} from \"./standalone-guard\";\nimport type { SuppliedService } from \"./SuppliedService\";\ntype TransactionOf<D extends SqlitePasswordDatabase> = Parameters<\n Parameters<D[\"transaction\"]>[0]\n>[0];\n\nexport const makeSqlitePasswordPreparedTarget = <\n DatabaseId,\n D extends SqlitePasswordDatabase,\n Synchronous extends boolean = false,\n>(\n databaseService: Context.Service<DatabaseId, D>,\n configuration:\n | PasswordTargetConfiguration\n | ((service: TransactionService | undefined) => PasswordTargetConfiguration),\n) => {\n const configurationFor = (database: D) =>\n typeof configuration === \"function\"\n ? configuration(transactionService(database))\n : configuration;\n\n const standaloneConfiguration =\n typeof configuration === \"function\"\n ? Effect.map(acquireTransactionService(databaseService), configuration)\n : Effect.succeed(configuration);\n\n function coordinatePasswordPreparedPersistence<\n Database extends D,\n TargetId,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n M extends AnySQLiteTable,\n T extends AnySQLiteTable,\n B extends AnySQLiteTable,\n NativeId,\n PS extends AnySQLiteTable,\n PC extends AnySQLiteTable,\n PM extends AnySQLiteTable,\n PSub extends AnySQLiteTable,\n PI extends AnySQLiteTable,\n PCr extends AnySQLiteTable,\n PNativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n >(\n acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, M, T, B, NativeId>;\n readonly proofMapping?:\n | PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>\n | undefined;\n readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;\n readonly transaction?: never;\n },\n body: Effect.Effect<Out, E, Synchronous extends true ? NoInfer<TargetId> : R>,\n ): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n | (Synchronous extends true ? never : Exclude<R, TargetId>)\n | LifecycleHooks\n | DatabaseRequirements\n >;\n function coordinatePasswordPreparedPersistence<\n Database extends D,\n TargetId,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n M extends AnySQLiteTable,\n T extends AnySQLiteTable,\n B extends AnySQLiteTable,\n NativeId,\n PS extends AnySQLiteTable,\n PC extends AnySQLiteTable,\n PM extends AnySQLiteTable,\n PSub extends AnySQLiteTable,\n PI extends AnySQLiteTable,\n PCr extends AnySQLiteTable,\n PNativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n >(\n acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, M, T, B, NativeId>;\n readonly proofMapping?:\n | PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>\n | undefined;\n readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;\n readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<Database>>, TxShape>;\n },\n body: Effect.Effect<Out, E, Synchronous extends true ? NoInfer<TargetId | TxId> : R>,\n ): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n | (Synchronous extends true ? never : Exclude<R, TargetId | TxId>)\n | LifecycleHooks\n | DatabaseRequirements\n >;\n function coordinatePasswordPreparedPersistence<\n Database extends D,\n TargetId,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n M extends AnySQLiteTable,\n T extends AnySQLiteTable,\n B extends AnySQLiteTable,\n NativeId,\n PS extends AnySQLiteTable,\n PC extends AnySQLiteTable,\n PM extends AnySQLiteTable,\n PSub extends AnySQLiteTable,\n PI extends AnySQLiteTable,\n PCr extends AnySQLiteTable,\n PNativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n TxId,\n TxShape,\n >(\n acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, M, T, B, NativeId>;\n readonly proofMapping?:\n | PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>\n | undefined;\n readonly target: SuppliedService<TargetId, PasswordPreparedPersistence>;\n readonly transaction?: SuppliedService<TxId, NoInfer<TransactionOf<Database>>, TxShape>;\n },\n body: Effect.Effect<Out, E, R>,\n ): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n Exclude<R, TargetId> | LifecycleHooks | DatabaseRequirements\n > {\n return Effect.flatMap(nativeDatabase(acquire), (database) =>\n coordinateTargetPasswordPreparedPersistence<\n TransactionOf<Database>,\n Out,\n E,\n Exclude<R, TargetId>\n >(\n database,\n options.mapping,\n configurationFor(database),\n options.proofMapping,\n (\n transaction: TransactionOf<Database>,\n services: { readonly passwordPreparedPersistence: PasswordPreparedPersistence },\n ) => {\n const provided = Context.make(options.target, services.passwordPreparedPersistence);\n const work = Effect.provideContext(body, provided);\n\n return options.transaction === undefined\n ? work\n : Effect.provideService(work, options.transaction, options.transaction.of(transaction));\n },\n ).pipe(Effect.provideService(NativeDatabase, database)),\n );\n }\n\n return {\n makePasswordPreparedPersistenceServices: <\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n M extends AnySQLiteTable,\n T extends AnySQLiteTable,\n B extends AnySQLiteTable,\n NativeId,\n PS extends AnySQLiteTable = AnySQLiteTable,\n PC extends AnySQLiteTable = AnySQLiteTable,\n PM extends AnySQLiteTable = AnySQLiteTable,\n PSub extends AnySQLiteTable = AnySQLiteTable,\n PI extends AnySQLiteTable = AnySQLiteTable,\n PCr extends AnySQLiteTable = AnySQLiteTable,\n PNativeId = unknown,\n >(\n mapping: PasswordPreparedPersistenceMapping<S, I, C, AC, M, T, B, NativeId>,\n proofMapping?: PasswordPreparedProofMapping<PS, PC, PM, PSub, PI, PCr, PNativeId>,\n ) =>\n Effect.flatMap(standaloneConfiguration, (configuration) =>\n makeTargetPasswordPreparedPersistenceServices(mapping, configuration, proofMapping),\n ).pipe(\n Effect.provideServiceEffect(CurrentPasswordSql, nativeDatabase(databaseService)),\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService)),\n ),\n coordinatePasswordPreparedPersistence,\n };\n};\n"],"mappings":";;;;;;;AA6BA,MAAa,oCAKX,iBACA,kBAGG;CACH,MAAM,oBAAoB,aACxB,OAAO,kBAAkB,aACrB,cAAc,mBAAmB,QAAQ,CAAC,IAC1C;CAEN,MAAM,0BACJ,OAAO,kBAAkB,aACrB,OAAO,IAAI,0BAA0B,eAAe,GAAG,aAAa,IACpE,OAAO,QAAQ,aAAa;CAsFlC,SAAS,sCA0BP,SACA,SAQA,MAKA;EACA,OAAO,OAAO,QAAQ,eAAe,OAAO,IAAI,aAC9C,4CAME,UACA,QAAQ,SACR,iBAAiB,QAAQ,GACzB,QAAQ,eAEN,aACA,aACG;GACH,MAAM,WAAW,QAAQ,KAAK,QAAQ,QAAQ,SAAS,2BAA2B;GAClF,MAAM,OAAO,OAAO,eAAe,MAAM,QAAQ;GAEjD,OAAO,QAAQ,gBAAgB,KAAA,IAC3B,OACA,OAAO,eAAe,MAAM,QAAQ,aAAa,QAAQ,YAAY,GAAG,WAAW,CAAC;EAC1F,CACF,CAAC,CAAC,KAAK,OAAO,eAAe,gBAAgB,QAAQ,CAAC,CACxD;CACF;CAEA,OAAO;EACL,0CAiBE,SACA,iBAEA,OAAO,QAAQ,0BAA0B,kBACvC,8CAA8C,SAAS,eAAe,YAAY,CACpF,CAAC,CAAC,KACA,OAAO,qBAAqB,oBAAoB,eAAe,eAAe,CAAC,GAC/E,OAAO,qBAAqB,gBAAgB,eAAe,eAAe,CAAC,CAC7E;EACF;CACF;AACF"}