@yielded/auth-persistence-drizzle 0.1.0-beta.23 → 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 (185) hide show
  1. package/README.md +3 -0
  2. package/dist/D1.d.mts +9 -9
  3. package/dist/D1.mjs +2 -1
  4. package/dist/D1.mjs.map +1 -1
  5. package/dist/Libsql.d.mts +46 -62
  6. package/dist/Libsql.mjs +2 -1
  7. package/dist/Libsql.mjs.map +1 -1
  8. package/dist/Mysql2.d.mts +24 -25
  9. package/dist/Pglite.d.mts +26 -26
  10. package/dist/Pglite.mjs +2 -1
  11. package/dist/Pglite.mjs.map +1 -1
  12. package/dist/Postgres.d.mts +27 -27
  13. package/dist/Postgres.mjs +2 -1
  14. package/dist/Postgres.mjs.map +1 -1
  15. package/dist/SqliteBun.d.mts +47 -63
  16. package/dist/SqliteBun.mjs +2 -1
  17. package/dist/SqliteBun.mjs.map +1 -1
  18. package/dist/SqliteDo.d.mts +45 -61
  19. package/dist/SqliteDo.mjs +2 -1
  20. package/dist/SqliteDo.mjs.map +1 -1
  21. package/dist/SqliteNode.d.mts +49 -65
  22. package/dist/SqliteNode.mjs +2 -1
  23. package/dist/SqliteNode.mjs.map +1 -1
  24. package/dist/SqliteWasm.d.mts +45 -61
  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 +13 -13
  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 +17 -33
  34. package/dist/drizzle/d1-passwords.mjs +56 -198
  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 +1 -1
  38. package/dist/drizzle/d1-sessions.d.mts +2 -2
  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 +26 -1
  48. package/dist/drizzle/native-sql-table.mjs.map +1 -1
  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 -6
  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/pg-password-prepared.d.mts +5 -5
  76. package/dist/drizzle/pg-password-prepared.mjs.map +1 -1
  77. package/dist/drizzle/pg-passwords.d.mts +16 -32
  78. package/dist/drizzle/pg-passwords.mjs.map +1 -1
  79. package/dist/drizzle/pg-sessions.d.mts +1 -1
  80. package/dist/drizzle/phone-target.d.mts +1 -1
  81. package/dist/drizzle/phone-target.mjs +1 -1
  82. package/dist/drizzle/query-operations.mjs +3 -1
  83. package/dist/drizzle/query-operations.mjs.map +1 -1
  84. package/dist/drizzle/sqlite-password-prepared.mjs.map +1 -1
  85. package/dist/drizzle/sqlite-passwords.mjs.map +1 -1
  86. package/dist/drizzle/storage-validation.mjs +10 -185
  87. package/dist/drizzle/storage-validation.mjs.map +1 -1
  88. package/dist/drizzle/totp-target.d.mts +2 -2
  89. package/dist/drizzle/totp-target.mjs +2 -2
  90. package/dist/drizzle/transaction-execution.d.mts +2 -2
  91. package/dist/drizzle/transaction-owner.d.mts +1 -2
  92. package/dist/index.d.mts +3 -2
  93. package/dist/internal/drizzle-postgres-oauth-proxy.d.mts +138 -0
  94. package/dist/internal/drizzle-postgres-oauth-proxy.mjs +29 -0
  95. package/dist/internal/drizzle-postgres-oauth-proxy.mjs.map +1 -0
  96. package/dist/internal/drizzle-sqlite-oauth-proxy.d.mts +146 -0
  97. package/dist/internal/drizzle-sqlite-oauth-proxy.mjs +29 -0
  98. package/dist/internal/drizzle-sqlite-oauth-proxy.mjs.map +1 -0
  99. package/package.json +1 -1
  100. package/src/D1.ts +2 -0
  101. package/src/Libsql.ts +2 -0
  102. package/src/Pglite.ts +2 -0
  103. package/src/Postgres.ts +2 -0
  104. package/src/SqliteBun.ts +2 -0
  105. package/src/SqliteDo.ts +2 -0
  106. package/src/SqliteNode.ts +2 -0
  107. package/src/SqliteWasm.ts +2 -0
  108. package/src/drizzle/d1-password-prepared.ts +2 -5
  109. package/src/drizzle/d1-passwords.ts +123 -458
  110. package/src/drizzle/d1-sessions.ts +21 -6
  111. package/src/drizzle/mysql-password-prepared.ts +4 -8
  112. package/src/drizzle/mysql-passwords.ts +5 -10
  113. package/src/drizzle/native-sql-table.ts +30 -0
  114. package/src/drizzle/oauth-connected-model.ts +97 -315
  115. package/src/drizzle/oauth-connected-reference.ts +13 -93
  116. package/src/drizzle/oauth-connected-target.ts +14 -271
  117. package/src/drizzle/oauth-kernel.ts +10 -0
  118. package/src/drizzle/oauth-model.ts +188 -541
  119. package/src/drizzle/oauth-mysql.ts +2 -2
  120. package/src/drizzle/oauth-proxy.ts +101 -0
  121. package/src/drizzle/oauth-target.ts +33 -737
  122. package/src/drizzle/password-model.ts +0 -13
  123. package/src/drizzle/password-prepared-model.ts +0 -6
  124. package/src/drizzle/pg-password-prepared.ts +4 -8
  125. package/src/drizzle/pg-passwords.ts +5 -10
  126. package/src/drizzle/query-operations.ts +4 -0
  127. package/src/drizzle/sqlite-password-prepared.ts +4 -8
  128. package/src/drizzle/sqlite-passwords.ts +7 -14
  129. package/src/drizzle/storage-validation.ts +13 -214
  130. package/src/index.ts +2 -4
  131. package/src/internal/drizzle-postgres-oauth-proxy.ts +37 -0
  132. package/src/internal/drizzle-sqlite-oauth-proxy.ts +44 -0
  133. package/dist/_virtual/_rolldown/runtime.mjs +0 -13
  134. package/dist/drizzle/oauth-accounts.mjs +0 -359
  135. package/dist/drizzle/oauth-accounts.mjs.map +0 -1
  136. package/dist/drizzle/oauth-connected-access.mjs +0 -212
  137. package/dist/drizzle/oauth-connected-access.mjs.map +0 -1
  138. package/dist/drizzle/oauth-connected-collection.mjs +0 -202
  139. package/dist/drizzle/oauth-connected-collection.mjs.map +0 -1
  140. package/dist/drizzle/oauth-connected-custody.mjs +0 -147
  141. package/dist/drizzle/oauth-connected-custody.mjs.map +0 -1
  142. package/dist/drizzle/oauth-connected-flow.mjs +0 -297
  143. package/dist/drizzle/oauth-connected-flow.mjs.map +0 -1
  144. package/dist/drizzle/oauth-connected-input.mjs +0 -122
  145. package/dist/drizzle/oauth-connected-input.mjs.map +0 -1
  146. package/dist/drizzle/oauth-connected-maintenance.mjs +0 -214
  147. package/dist/drizzle/oauth-connected-maintenance.mjs.map +0 -1
  148. package/dist/drizzle/oauth-connected-management.mjs +0 -229
  149. package/dist/drizzle/oauth-connected-management.mjs.map +0 -1
  150. package/dist/drizzle/oauth-connected-settlement.mjs +0 -128
  151. package/dist/drizzle/oauth-connected-settlement.mjs.map +0 -1
  152. package/dist/drizzle/oauth-connected-sign-in.mjs +0 -265
  153. package/dist/drizzle/oauth-connected-sign-in.mjs.map +0 -1
  154. package/dist/drizzle/oauth-connected-state.d.mts +0 -2062
  155. package/dist/drizzle/oauth-connected-state.mjs +0 -430
  156. package/dist/drizzle/oauth-connected-state.mjs.map +0 -1
  157. package/dist/drizzle/oauth-flow.d.mts +0 -22
  158. package/dist/drizzle/oauth-flow.mjs +0 -253
  159. package/dist/drizzle/oauth-flow.mjs.map +0 -1
  160. package/dist/drizzle/oauth-input.mjs +0 -127
  161. package/dist/drizzle/oauth-input.mjs.map +0 -1
  162. package/dist/drizzle/oauth-owner.d.mts +0 -10
  163. package/dist/drizzle/oauth-owner.mjs +0 -10
  164. package/dist/drizzle/oauth-owner.mjs.map +0 -1
  165. package/dist/drizzle/oauth-registration.d.mts +0 -5
  166. package/dist/drizzle/oauth-registration.mjs +0 -374
  167. package/dist/drizzle/oauth-registration.mjs.map +0 -1
  168. package/dist/drizzle/oauth-state.mjs +0 -107
  169. package/dist/drizzle/oauth-state.mjs.map +0 -1
  170. package/src/drizzle/oauth-accounts.ts +0 -805
  171. package/src/drizzle/oauth-connected-access.ts +0 -361
  172. package/src/drizzle/oauth-connected-collection.ts +0 -324
  173. package/src/drizzle/oauth-connected-custody.ts +0 -279
  174. package/src/drizzle/oauth-connected-flow.ts +0 -529
  175. package/src/drizzle/oauth-connected-input.ts +0 -147
  176. package/src/drizzle/oauth-connected-maintenance.ts +0 -346
  177. package/src/drizzle/oauth-connected-management.ts +0 -365
  178. package/src/drizzle/oauth-connected-settlement.ts +0 -251
  179. package/src/drizzle/oauth-connected-sign-in.ts +0 -443
  180. package/src/drizzle/oauth-connected-state.ts +0 -872
  181. package/src/drizzle/oauth-flow.ts +0 -462
  182. package/src/drizzle/oauth-input.ts +0 -201
  183. package/src/drizzle/oauth-owner.ts +0 -29
  184. package/src/drizzle/oauth-registration.ts +0 -640
  185. 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, Command extends Table, Intent extends Table, Admission extends Table, NativeSubjectId> {
67
- readonly password: PasswordPersistenceMapping<Subject, Identifier, Credential, AuthorityCredential, Attempt, 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, Command extends Table, Intent extends Table, Admission extends Table, NativeSubjectId> = PasswordPreparedPersistenceMapping<Subject, Identifier, Credential, AuthorityCredential, Attempt, 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, 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, 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 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 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 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 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 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 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({
@@ -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, 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, 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, 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, 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, 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, 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 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, 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 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, 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 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, 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 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, 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,6CAkBX,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;AAsFF,SAAgB,wCA2Bd,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, M extends AnyPgTable, NativeId> = PasswordPersistenceMapping<S, I, C, AC, A, M, NativeId>;
21
- export declare const makePgPasswordPersistenceServices: <S extends AnyPgTable, I extends AnyPgTable, C extends AnyPgTable, AC extends AnyPgTable, A extends AnyPgTable, M extends AnyPgTable, NativeId>(mapping: PasswordMapping<S, I, C, AC, A, 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 prepareAttempt: (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 attemptLifetimeMillis: number;
29
- }) => Effect.Effect<import("@yielded/auth/Password").PasswordAttemptPreparation, 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, 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, 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, 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, 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 M extends AnyPgTable,\n NativeId,\n> = PasswordPersistenceMapping<S, I, C, AC, A, 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 M extends AnyPgTable,\n NativeId,\n>(\n mapping: PasswordMapping<S, I, C, AC, A, 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 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, 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 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, 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 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, 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;AAYA,MAAa,qCASX,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;AAkEF,SAAgB,gCAoBd,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,8 +1,8 @@
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";
@@ -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 +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 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, A, 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 A 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, A, 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 A 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, A, 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 A 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, 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;CAwFlC,SAAS,sCA2BP,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,0CAkBE,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"sqlite-passwords.mjs","names":[],"sources":["../../src/drizzle/sqlite-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 { EffectLibsqlDatabase } from \"drizzle-orm/effect-libsql\";\nimport type { EffectSQLiteBunDatabase } from \"drizzle-orm/effect-sqlite-bun\";\nimport type { EffectSQLiteNodeDatabase as NodeDatabase } from \"drizzle-orm/effect-sqlite-node\";\nimport type { EffectSQLiteWasmDatabase as WasmDatabase } from \"drizzle-orm/effect-sqlite-wasm\";\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 { 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 type PasswordTargetConfiguration,\n} from \"./password-target\";\nimport type { ProofPersistenceMapping } from \"./proof-model\";\nimport type { ProofSqlQuery } from \"./proof-sql\";\nimport type { DatabaseValue as DODatabase } from \"./sqlite-do-database\";\nimport {\n type TransactionService,\n acquireTransactionService,\n transactionService,\n} from \"./standalone-guard\";\nimport type { SuppliedService } from \"./SuppliedService\";\n\nexport type SqlitePasswordDatabase =\n | NodeDatabase<AnyRelations>\n | EffectSQLiteBunDatabase<AnyRelations>\n | EffectLibsqlDatabase<AnyRelations>\n | WasmDatabase<AnyRelations>\n | DODatabase<AnyRelations>;\n\ntype TransactionOf<D extends SqlitePasswordDatabase> = Parameters<\n Parameters<D[\"transaction\"]>[0]\n>[0];\n\nexport const sqlitePasswordConfiguration = (\n mode: \"interactive\" | \"synchronous\",\n standaloneGuard: PasswordTargetConfiguration[\"standaloneGuard\"],\n proofStandaloneGuard: PasswordTargetConfiguration[\"proof\"][\"standaloneGuard\"],\n coordinatorGuard?: PasswordTargetConfiguration[\"coordinatorGuard\"],\n): PasswordTargetConfiguration => ({\n mode,\n locking: false,\n standaloneGuard,\n ...(coordinatorGuard === undefined ? {} : { coordinatorGuard }),\n insertIfAbsent: (query: PasswordSqlQuery) => query.onConflictDoNothing(),\n generatedSubjectRows: (query: PasswordSqlQuery) => query.returning(),\n proof: {\n mode,\n locking: false,\n standaloneGuard: proofStandaloneGuard,\n insertIfAbsent: (query: ProofSqlQuery) => query.onConflictDoNothing(),\n },\n});\n\ntype Mapping<\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n A extends AnySQLiteTable,\n M extends AnySQLiteTable,\n NativeId,\n> = PasswordPersistenceMapping<S, I, C, AC, A, M, NativeId>;\n\nexport const makeSqlitePasswordPersistenceServices = <\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n A extends AnySQLiteTable,\n M extends AnySQLiteTable,\n NativeId,\n>(\n mapping: Mapping<S, I, C, AC, A, M, NativeId>,\n configuration: PasswordTargetConfiguration,\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) => makeTargetPasswordPersistenceServices(mapping, configuration, proofMapping);\n\nexport const coordinateSqlitePasswordPersistence = <\n D extends SqlitePasswordDatabase,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n A extends AnySQLiteTable,\n M extends AnySQLiteTable,\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>(\n database: D,\n mapping: Mapping<S, I, C, AC, A, M, NativeId>,\n configuration: PasswordTargetConfiguration,\n proofMapping: PM,\n owner: (\n transaction: TransactionOf<D>,\n services: { readonly passwordPersistence: PasswordPersistence[\"Service\"] },\n ) => Effect.Effect<Out, E, R>,\n) =>\n coordinateTargetPasswordPersistence<TransactionOf<D>, Out, E, R>(\n database,\n mapping,\n configuration,\n proofMapping,\n owner,\n );\n\nexport const makeSqlitePasswordRegistrationServices = <\n Registration,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n Rq extends AnySQLiteTable,\n NativeId,\n>(\n mapping: PasswordRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>,\n configuration: PasswordTargetConfiguration,\n) => makeTargetPasswordRegistrationServices<Registration>(mapping, configuration);\n\nexport const coordinateSqlitePasswordRegistration = <\n Registration,\n D extends SqlitePasswordDatabase,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n Rq extends AnySQLiteTable,\n NativeId,\n Out,\n E,\n R,\n>(\n database: D,\n mapping: PasswordRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>,\n configuration: PasswordTargetConfiguration,\n owner: (\n transaction: TransactionOf<D>,\n services: { readonly registrationAuthority: PasswordRegistrationAuthority<Registration> },\n ) => Effect.Effect<Out, E, R>,\n) =>\n coordinateTargetPasswordRegistration<Registration, TransactionOf<D>, Out, E, R>(\n database,\n mapping,\n configuration,\n owner,\n );\n\nexport const makeSqlitePasswordTarget = <\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 coordinatePasswordPersistence<\n Database extends D,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n A extends AnySQLiteTable,\n M extends AnySQLiteTable,\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<Database, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: Mapping<S, I, C, AC, A, M, NativeId>;\n readonly proofMapping?: PM;\n readonly transaction?: never;\n },\n body: Effect.Effect<Out, E, Synchronous extends true ? NoInfer<PasswordPersistence> : R>,\n ): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n | (Synchronous extends true ? never : Exclude<R, PasswordPersistence>)\n | LifecycleHooks\n | DatabaseRequirements\n >;\n function coordinatePasswordPersistence<\n Database extends D,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n A extends AnySQLiteTable,\n M extends AnySQLiteTable,\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<Database, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: Mapping<S, I, C, AC, A, M, NativeId>;\n readonly proofMapping?: PM;\n readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<Database>>, TxShape>;\n },\n body: Effect.Effect<Out, E, Synchronous extends true ? NoInfer<PasswordPersistence | TxId> : R>,\n ): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n | (Synchronous extends true ? never : Exclude<R, PasswordPersistence | TxId>)\n | LifecycleHooks\n | DatabaseRequirements\n >;\n function coordinatePasswordPersistence<\n Database extends D,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n A extends AnySQLiteTable,\n M extends AnySQLiteTable,\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<Database, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: Mapping<S, I, C, AC, A, M, NativeId>;\n readonly proofMapping?: PM;\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, PasswordPersistence> | LifecycleHooks | DatabaseRequirements\n > {\n return Effect.flatMap(nativeDatabase(acquire), (database) =>\n coordinateSqlitePasswordPersistence(\n database,\n options.mapping,\n configurationFor(database),\n options.proofMapping,\n (\n transaction: TransactionOf<Database>,\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 function coordinatePasswordRegistration<\n Database extends D,\n TargetId,\n Registration,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n Rq extends AnySQLiteTable,\n NativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n >(\n acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordRegistrationMapping<\n NoInfer<Registration>,\n S,\n I,\n C,\n AC,\n Rq,\n NativeId\n >;\n readonly target: SuppliedService<TargetId, PasswordRegistrationAuthority<Registration>>;\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 coordinatePasswordRegistration<\n Database extends D,\n TargetId,\n Registration,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n Rq extends AnySQLiteTable,\n NativeId,\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: PasswordRegistrationMapping<\n NoInfer<Registration>,\n S,\n I,\n C,\n AC,\n Rq,\n NativeId\n >;\n readonly target: SuppliedService<TargetId, PasswordRegistrationAuthority<Registration>>;\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 coordinatePasswordRegistration<\n Database extends D,\n TargetId,\n Registration,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n Rq extends AnySQLiteTable,\n NativeId,\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: PasswordRegistrationMapping<\n NoInfer<Registration>,\n S,\n I,\n C,\n AC,\n Rq,\n NativeId\n >;\n readonly target: SuppliedService<TargetId, PasswordRegistrationAuthority<Registration>>;\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 coordinateSqlitePasswordRegistration(\n database,\n options.mapping,\n configurationFor(database),\n (\n transaction: TransactionOf<Database>,\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\n return {\n makePasswordPersistenceServices: <\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n A extends AnySQLiteTable,\n M extends AnySQLiteTable,\n NativeId,\n >(\n mapping: Mapping<S, I, C, AC, A, 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(standaloneConfiguration, (configuration) =>\n makeSqlitePasswordPersistenceServices(mapping, configuration, proofMapping),\n ).pipe(\n Effect.provideServiceEffect(CurrentPasswordSql, nativeDatabase(databaseService)),\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService)),\n ),\n coordinatePasswordPersistence,\n makePasswordRegistrationServices: <\n Registration,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n Rq extends AnySQLiteTable,\n NativeId,\n >(\n mapping: PasswordRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>,\n ) =>\n Effect.flatMap(standaloneConfiguration, (configuration) =>\n makeSqlitePasswordRegistrationServices(mapping, configuration),\n ).pipe(\n Effect.provideServiceEffect(CurrentPasswordSql, nativeDatabase(databaseService)),\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService)),\n ),\n coordinatePasswordRegistration,\n };\n};\n"],"mappings":";;;;;;;;AA8CA,MAAa,+BACX,MACA,iBACA,sBACA,sBACiC;CACjC;CACA,SAAS;CACT;CACA,GAAI,qBAAqB,KAAA,IAAY,CAAC,IAAI,EAAE,iBAAiB;CAC7D,iBAAiB,UAA4B,MAAM,oBAAoB;CACvE,uBAAuB,UAA4B,MAAM,UAAU;CACnE,OAAO;EACL;EACA,SAAS;EACT,iBAAiB;EACjB,iBAAiB,UAAyB,MAAM,oBAAoB;CACtE;AACF;AAYA,MAAa,yCASX,SACA,eACA,iBAcG,sCAAsC,SAAS,eAAe,YAAY;AAE/E,MAAa,uCAgBX,UACA,SACA,eACA,cACA,UAKA,oCACE,UACA,SACA,eACA,cACA,KACF;AAEF,MAAa,0CASX,SACA,kBACG,uCAAqD,SAAS,aAAa;AAEhF,MAAa,wCAaX,UACA,SACA,eACA,UAKA,qCACE,UACA,SACA,eACA,KACF;AAEF,MAAa,4BAKX,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;CAoElC,SAAS,8BAoBP,SACA,SAKA,MAKA;EACA,OAAO,OAAO,QAAQ,eAAe,OAAO,IAAI,aAC9C,oCACE,UACA,QAAQ,SACR,iBAAiB,QAAQ,GACzB,QAAQ,eAEN,aACA,aACG;GACH,MAAM,WAAW,QAAQ,KAAK,qBAAqB,SAAS,mBAAmB;GAC/E,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;CA+EA,SAAS,+BAkBP,SACA,SAaA,MAKA;EACA,OAAO,OAAO,QAAQ,eAAe,OAAO,IAAI,aAC9C,qCACE,UACA,QAAQ,SACR,iBAAiB,QAAQ,IAEvB,aACA,aACG;GACH,MAAM,WAAW,QAAQ,KAAK,QAAQ,QAAQ,SAAS,qBAAqB;GAC5E,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,kCASE,SACA,iBAeA,OAAO,QAAQ,0BAA0B,kBACvC,sCAAsC,SAAS,eAAe,YAAY,CAC5E,CAAC,CAAC,KACA,OAAO,qBAAqB,oBAAoB,eAAe,eAAe,CAAC,GAC/E,OAAO,qBAAqB,gBAAgB,eAAe,eAAe,CAAC,CAC7E;EACF;EACA,mCASE,YAEA,OAAO,QAAQ,0BAA0B,kBACvC,uCAAuC,SAAS,aAAa,CAC/D,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-passwords.mjs","names":[],"sources":["../../src/drizzle/sqlite-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 { EffectLibsqlDatabase } from \"drizzle-orm/effect-libsql\";\nimport type { EffectSQLiteBunDatabase } from \"drizzle-orm/effect-sqlite-bun\";\nimport type { EffectSQLiteNodeDatabase as NodeDatabase } from \"drizzle-orm/effect-sqlite-node\";\nimport type { EffectSQLiteWasmDatabase as WasmDatabase } from \"drizzle-orm/effect-sqlite-wasm\";\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 { 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 type PasswordTargetConfiguration,\n} from \"./password-target\";\nimport type { ProofPersistenceMapping } from \"./proof-model\";\nimport type { ProofSqlQuery } from \"./proof-sql\";\nimport type { DatabaseValue as DODatabase } from \"./sqlite-do-database\";\nimport {\n type TransactionService,\n acquireTransactionService,\n transactionService,\n} from \"./standalone-guard\";\nimport type { SuppliedService } from \"./SuppliedService\";\n\nexport type SqlitePasswordDatabase =\n | NodeDatabase<AnyRelations>\n | EffectSQLiteBunDatabase<AnyRelations>\n | EffectLibsqlDatabase<AnyRelations>\n | WasmDatabase<AnyRelations>\n | DODatabase<AnyRelations>;\n\ntype TransactionOf<D extends SqlitePasswordDatabase> = Parameters<\n Parameters<D[\"transaction\"]>[0]\n>[0];\n\nexport const sqlitePasswordConfiguration = (\n mode: \"interactive\" | \"synchronous\",\n standaloneGuard: PasswordTargetConfiguration[\"standaloneGuard\"],\n proofStandaloneGuard: PasswordTargetConfiguration[\"proof\"][\"standaloneGuard\"],\n coordinatorGuard?: PasswordTargetConfiguration[\"coordinatorGuard\"],\n): PasswordTargetConfiguration => ({\n mode,\n locking: false,\n standaloneGuard,\n ...(coordinatorGuard === undefined ? {} : { coordinatorGuard }),\n insertIfAbsent: (query: PasswordSqlQuery) => query.onConflictDoNothing(),\n generatedSubjectRows: (query: PasswordSqlQuery) => query.returning(),\n proof: {\n mode,\n locking: false,\n standaloneGuard: proofStandaloneGuard,\n insertIfAbsent: (query: ProofSqlQuery) => query.onConflictDoNothing(),\n },\n});\n\ntype Mapping<\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n M extends AnySQLiteTable,\n NativeId,\n> = PasswordPersistenceMapping<S, I, C, AC, M, NativeId>;\n\nexport const makeSqlitePasswordPersistenceServices = <\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n M extends AnySQLiteTable,\n NativeId,\n>(\n mapping: Mapping<S, I, C, AC, M, NativeId>,\n configuration: PasswordTargetConfiguration,\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) => makeTargetPasswordPersistenceServices(mapping, configuration, proofMapping);\n\nexport const coordinateSqlitePasswordPersistence = <\n D extends SqlitePasswordDatabase,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n M extends AnySQLiteTable,\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>(\n database: D,\n mapping: Mapping<S, I, C, AC, M, NativeId>,\n configuration: PasswordTargetConfiguration,\n proofMapping: PM,\n owner: (\n transaction: TransactionOf<D>,\n services: { readonly passwordPersistence: PasswordPersistence[\"Service\"] },\n ) => Effect.Effect<Out, E, R>,\n) =>\n coordinateTargetPasswordPersistence<TransactionOf<D>, Out, E, R>(\n database,\n mapping,\n configuration,\n proofMapping,\n owner,\n );\n\nexport const makeSqlitePasswordRegistrationServices = <\n Registration,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n Rq extends AnySQLiteTable,\n NativeId,\n>(\n mapping: PasswordRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>,\n configuration: PasswordTargetConfiguration,\n) => makeTargetPasswordRegistrationServices<Registration>(mapping, configuration);\n\nexport const coordinateSqlitePasswordRegistration = <\n Registration,\n D extends SqlitePasswordDatabase,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n Rq extends AnySQLiteTable,\n NativeId,\n Out,\n E,\n R,\n>(\n database: D,\n mapping: PasswordRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>,\n configuration: PasswordTargetConfiguration,\n owner: (\n transaction: TransactionOf<D>,\n services: { readonly registrationAuthority: PasswordRegistrationAuthority<Registration> },\n ) => Effect.Effect<Out, E, R>,\n) =>\n coordinateTargetPasswordRegistration<Registration, TransactionOf<D>, Out, E, R>(\n database,\n mapping,\n configuration,\n owner,\n );\n\nexport const makeSqlitePasswordTarget = <\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 coordinatePasswordPersistence<\n Database extends D,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n M extends AnySQLiteTable,\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<Database, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: Mapping<S, I, C, AC, M, NativeId>;\n readonly proofMapping?: PM;\n readonly transaction?: never;\n },\n body: Effect.Effect<Out, E, Synchronous extends true ? NoInfer<PasswordPersistence> : R>,\n ): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n | (Synchronous extends true ? never : Exclude<R, PasswordPersistence>)\n | LifecycleHooks\n | DatabaseRequirements\n >;\n function coordinatePasswordPersistence<\n Database extends D,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n M extends AnySQLiteTable,\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<Database, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: Mapping<S, I, C, AC, M, NativeId>;\n readonly proofMapping?: PM;\n readonly transaction: SuppliedService<TxId, NoInfer<TransactionOf<Database>>, TxShape>;\n },\n body: Effect.Effect<Out, E, Synchronous extends true ? NoInfer<PasswordPersistence | TxId> : R>,\n ): Effect.Effect<\n Out,\n E | PasswordUnavailable | HookConfigurationError | SqlError | DatabaseError,\n | (Synchronous extends true ? never : Exclude<R, PasswordPersistence | TxId>)\n | LifecycleHooks\n | DatabaseRequirements\n >;\n function coordinatePasswordPersistence<\n Database extends D,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n M extends AnySQLiteTable,\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<Database, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: Mapping<S, I, C, AC, M, NativeId>;\n readonly proofMapping?: PM;\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, PasswordPersistence> | LifecycleHooks | DatabaseRequirements\n > {\n return Effect.flatMap(nativeDatabase(acquire), (database) =>\n coordinateSqlitePasswordPersistence(\n database,\n options.mapping,\n configurationFor(database),\n options.proofMapping,\n (\n transaction: TransactionOf<Database>,\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 function coordinatePasswordRegistration<\n Database extends D,\n TargetId,\n Registration,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n Rq extends AnySQLiteTable,\n NativeId,\n Out,\n E,\n R,\n DatabaseError,\n DatabaseRequirements,\n >(\n acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>,\n options: {\n readonly mapping: PasswordRegistrationMapping<\n NoInfer<Registration>,\n S,\n I,\n C,\n AC,\n Rq,\n NativeId\n >;\n readonly target: SuppliedService<TargetId, PasswordRegistrationAuthority<Registration>>;\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 coordinatePasswordRegistration<\n Database extends D,\n TargetId,\n Registration,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n Rq extends AnySQLiteTable,\n NativeId,\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: PasswordRegistrationMapping<\n NoInfer<Registration>,\n S,\n I,\n C,\n AC,\n Rq,\n NativeId\n >;\n readonly target: SuppliedService<TargetId, PasswordRegistrationAuthority<Registration>>;\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 coordinatePasswordRegistration<\n Database extends D,\n TargetId,\n Registration,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n Rq extends AnySQLiteTable,\n NativeId,\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: PasswordRegistrationMapping<\n NoInfer<Registration>,\n S,\n I,\n C,\n AC,\n Rq,\n NativeId\n >;\n readonly target: SuppliedService<TargetId, PasswordRegistrationAuthority<Registration>>;\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 coordinateSqlitePasswordRegistration(\n database,\n options.mapping,\n configurationFor(database),\n (\n transaction: TransactionOf<Database>,\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\n return {\n makePasswordPersistenceServices: <\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n M extends AnySQLiteTable,\n NativeId,\n >(\n mapping: Mapping<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(standaloneConfiguration, (configuration) =>\n makeSqlitePasswordPersistenceServices(mapping, configuration, proofMapping),\n ).pipe(\n Effect.provideServiceEffect(CurrentPasswordSql, nativeDatabase(databaseService)),\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService)),\n ),\n coordinatePasswordPersistence,\n makePasswordRegistrationServices: <\n Registration,\n S extends AnySQLiteTable,\n I extends AnySQLiteTable,\n C extends AnySQLiteTable,\n AC extends AnySQLiteTable,\n Rq extends AnySQLiteTable,\n NativeId,\n >(\n mapping: PasswordRegistrationMapping<Registration, S, I, C, AC, Rq, NativeId>,\n ) =>\n Effect.flatMap(standaloneConfiguration, (configuration) =>\n makeSqlitePasswordRegistrationServices(mapping, configuration),\n ).pipe(\n Effect.provideServiceEffect(CurrentPasswordSql, nativeDatabase(databaseService)),\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(databaseService)),\n ),\n coordinatePasswordRegistration,\n };\n};\n"],"mappings":";;;;;;;;AA8CA,MAAa,+BACX,MACA,iBACA,sBACA,sBACiC;CACjC;CACA,SAAS;CACT;CACA,GAAI,qBAAqB,KAAA,IAAY,CAAC,IAAI,EAAE,iBAAiB;CAC7D,iBAAiB,UAA4B,MAAM,oBAAoB;CACvE,uBAAuB,UAA4B,MAAM,UAAU;CACnE,OAAO;EACL;EACA,SAAS;EACT,iBAAiB;EACjB,iBAAiB,UAAyB,MAAM,oBAAoB;CACtE;AACF;AAWA,MAAa,yCAQX,SACA,eACA,iBAcG,sCAAsC,SAAS,eAAe,YAAY;AAE/E,MAAa,uCAeX,UACA,SACA,eACA,cACA,UAKA,oCACE,UACA,SACA,eACA,cACA,KACF;AAEF,MAAa,0CASX,SACA,kBACG,uCAAqD,SAAS,aAAa;AAEhF,MAAa,wCAaX,UACA,SACA,eACA,UAKA,qCACE,UACA,SACA,eACA,KACF;AAEF,MAAa,4BAKX,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;CAkElC,SAAS,8BAmBP,SACA,SAKA,MAKA;EACA,OAAO,OAAO,QAAQ,eAAe,OAAO,IAAI,aAC9C,oCACE,UACA,QAAQ,SACR,iBAAiB,QAAQ,GACzB,QAAQ,eAEN,aACA,aACG;GACH,MAAM,WAAW,QAAQ,KAAK,qBAAqB,SAAS,mBAAmB;GAC/E,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;CA+EA,SAAS,+BAkBP,SACA,SAaA,MAKA;EACA,OAAO,OAAO,QAAQ,eAAe,OAAO,IAAI,aAC9C,qCACE,UACA,QAAQ,SACR,iBAAiB,QAAQ,IAEvB,aACA,aACG;GACH,MAAM,WAAW,QAAQ,KAAK,QAAQ,QAAQ,SAAS,qBAAqB;GAC5E,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,kCAQE,SACA,iBAeA,OAAO,QAAQ,0BAA0B,kBACvC,sCAAsC,SAAS,eAAe,YAAY,CAC5E,CAAC,CAAC,KACA,OAAO,qBAAqB,oBAAoB,eAAe,eAAe,CAAC,GAC/E,OAAO,qBAAqB,gBAAgB,eAAe,eAAe,CAAC,CAC7E;EACF;EACA,mCASE,YAEA,OAAO,QAAQ,0BAA0B,kBACvC,uCAAuC,SAAS,aAAa,CAC/D,CAAC,CAAC,KACA,OAAO,qBAAqB,oBAAoB,eAAe,eAAe,CAAC,GAC/E,OAAO,qBAAqB,gBAAgB,eAAe,eAAe,CAAC,CAC7E;EACF;CACF;AACF"}