@yielded/auth-persistence-drizzle 0.1.0-beta.18 → 0.1.0-beta.20

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 (130) hide show
  1. package/README.md +8 -1
  2. package/dist/D1.d.mts +8 -8
  3. package/dist/Libsql.d.mts +38 -38
  4. package/dist/Mysql2.d.mts +51 -51
  5. package/dist/Pglite.d.mts +51 -51
  6. package/dist/Postgres.d.mts +38 -38
  7. package/dist/SqliteBun.d.mts +51 -51
  8. package/dist/SqliteDo.d.mts +112 -134
  9. package/dist/SqliteDo.mjs +30 -45
  10. package/dist/SqliteDo.mjs.map +1 -1
  11. package/dist/SqliteNode.d.mts +44 -44
  12. package/dist/SqliteWasm.d.mts +38 -38
  13. package/dist/drizzle/crypto.mjs +11 -0
  14. package/dist/drizzle/crypto.mjs.map +1 -0
  15. package/dist/drizzle/d1-identity.mjs +2 -2
  16. package/dist/drizzle/d1-identity.mjs.map +1 -1
  17. package/dist/drizzle/d1-oauth.d.mts +11 -11
  18. package/dist/drizzle/d1-oauth.mjs.map +1 -1
  19. package/dist/drizzle/d1-passkey.d.mts +6 -6
  20. package/dist/drizzle/d1-passkey.mjs.map +1 -1
  21. package/dist/drizzle/d1-passwords.d.mts +1 -1
  22. package/dist/drizzle/d1-phone.d.mts +3 -3
  23. package/dist/drizzle/d1-phone.mjs.map +1 -1
  24. package/dist/drizzle/d1-proofs.d.mts +1 -1
  25. package/dist/drizzle/d1-sessions.d.mts +1 -1
  26. package/dist/drizzle/d1-totp.d.mts +3 -3
  27. package/dist/drizzle/d1-totp.mjs.map +1 -1
  28. package/dist/drizzle/mysql-identity.mjs +2 -2
  29. package/dist/drizzle/mysql-identity.mjs.map +1 -1
  30. package/dist/drizzle/oauth-accounts.mjs +9 -8
  31. package/dist/drizzle/oauth-accounts.mjs.map +1 -1
  32. package/dist/drizzle/oauth-connected-collection.mjs +1 -1
  33. package/dist/drizzle/oauth-connected-collection.mjs.map +1 -1
  34. package/dist/drizzle/oauth-connected-custody.mjs +5 -4
  35. package/dist/drizzle/oauth-connected-custody.mjs.map +1 -1
  36. package/dist/drizzle/oauth-connected-drivers.mjs.map +1 -1
  37. package/dist/drizzle/oauth-connected-flow.mjs +8 -7
  38. package/dist/drizzle/oauth-connected-flow.mjs.map +1 -1
  39. package/dist/drizzle/oauth-connected-management.mjs +3 -2
  40. package/dist/drizzle/oauth-connected-management.mjs.map +1 -1
  41. package/dist/drizzle/oauth-connected-reference.mjs +8 -4
  42. package/dist/drizzle/oauth-connected-reference.mjs.map +1 -1
  43. package/dist/drizzle/oauth-connected-settlement.mjs +4 -4
  44. package/dist/drizzle/oauth-connected-settlement.mjs.map +1 -1
  45. package/dist/drizzle/oauth-connected-sign-in.mjs +11 -10
  46. package/dist/drizzle/oauth-connected-sign-in.mjs.map +1 -1
  47. package/dist/drizzle/oauth-connected-state.d.mts +13 -13
  48. package/dist/drizzle/oauth-connected-state.mjs +23 -20
  49. package/dist/drizzle/oauth-connected-state.mjs.map +1 -1
  50. package/dist/drizzle/oauth-connected-target.d.mts +9 -9
  51. package/dist/drizzle/oauth-connected-target.mjs.map +1 -1
  52. package/dist/drizzle/oauth-drivers.mjs.map +1 -1
  53. package/dist/drizzle/oauth-flow.mjs +1 -1
  54. package/dist/drizzle/oauth-flow.mjs.map +1 -1
  55. package/dist/drizzle/oauth-model.d.mts +4 -4
  56. package/dist/drizzle/oauth-model.mjs.map +1 -1
  57. package/dist/drizzle/oauth-registration.mjs +2 -2
  58. package/dist/drizzle/oauth-registration.mjs.map +1 -1
  59. package/dist/drizzle/oauth-state.mjs +11 -12
  60. package/dist/drizzle/oauth-state.mjs.map +1 -1
  61. package/dist/drizzle/oauth-target.d.mts +4 -4
  62. package/dist/drizzle/oauth-target.mjs.map +1 -1
  63. package/dist/drizzle/passkey-drivers.mjs.map +1 -1
  64. package/dist/drizzle/passkey-write-drivers.mjs.map +1 -1
  65. package/dist/drizzle/passkey-write-target.d.mts +1 -1
  66. package/dist/drizzle/password-prepared-state.mjs +1 -1
  67. package/dist/drizzle/pg-identity.mjs +2 -2
  68. package/dist/drizzle/pg-identity.mjs.map +1 -1
  69. package/dist/drizzle/phone-model.d.mts +2 -2
  70. package/dist/drizzle/phone-model.mjs +3 -3
  71. package/dist/drizzle/phone-model.mjs.map +1 -1
  72. package/dist/drizzle/phone-target.d.mts +1 -1
  73. package/dist/drizzle/phone-target.mjs +2 -2
  74. package/dist/drizzle/phone-target.mjs.map +1 -1
  75. package/dist/drizzle/sqlite-do-database.d.mts +29 -0
  76. package/dist/drizzle/sqlite-do-database.mjs +45 -0
  77. package/dist/drizzle/sqlite-do-database.mjs.map +1 -0
  78. package/dist/drizzle/sqlite-emails.mjs.map +1 -1
  79. package/dist/drizzle/sqlite-identity.mjs +2 -2
  80. package/dist/drizzle/sqlite-identity.mjs.map +1 -1
  81. package/dist/drizzle/sqlite-passwords.mjs.map +1 -1
  82. package/dist/drizzle/sqlite-proofs.mjs.map +1 -1
  83. package/dist/drizzle/sqlite-sessions.mjs.map +1 -1
  84. package/dist/drizzle/storage-validation.mjs +17 -9
  85. package/dist/drizzle/storage-validation.mjs.map +1 -1
  86. package/dist/drizzle/totp-state.mjs +8 -8
  87. package/dist/drizzle/totp-state.mjs.map +1 -1
  88. package/dist/drizzle/totp-target.d.mts +1 -1
  89. package/dist/drizzle/totp-target.mjs +2 -2
  90. package/dist/drizzle/totp-target.mjs.map +1 -1
  91. package/package.json +1 -1
  92. package/src/SqliteDo.ts +63 -70
  93. package/src/drizzle/crypto.ts +14 -0
  94. package/src/drizzle/d1-identity.ts +2 -2
  95. package/src/drizzle/d1-oauth.ts +14 -5
  96. package/src/drizzle/d1-passkey.ts +5 -1
  97. package/src/drizzle/d1-phone.ts +2 -1
  98. package/src/drizzle/d1-totp.ts +6 -2
  99. package/src/drizzle/mysql-identity.ts +2 -2
  100. package/src/drizzle/oauth-accounts.ts +14 -13
  101. package/src/drizzle/oauth-connected-collection.ts +1 -1
  102. package/src/drizzle/oauth-connected-custody.ts +8 -6
  103. package/src/drizzle/oauth-connected-drivers.ts +9 -3
  104. package/src/drizzle/oauth-connected-flow.ts +6 -6
  105. package/src/drizzle/oauth-connected-management.ts +1 -1
  106. package/src/drizzle/oauth-connected-reference.ts +14 -9
  107. package/src/drizzle/oauth-connected-settlement.ts +4 -4
  108. package/src/drizzle/oauth-connected-sign-in.ts +11 -10
  109. package/src/drizzle/oauth-connected-state.ts +40 -25
  110. package/src/drizzle/oauth-connected-target.ts +9 -5
  111. package/src/drizzle/oauth-drivers.ts +13 -5
  112. package/src/drizzle/oauth-flow.ts +1 -1
  113. package/src/drizzle/oauth-model.ts +4 -4
  114. package/src/drizzle/oauth-registration.ts +2 -2
  115. package/src/drizzle/oauth-state.ts +17 -15
  116. package/src/drizzle/oauth-target.ts +11 -3
  117. package/src/drizzle/passkey-drivers.ts +7 -3
  118. package/src/drizzle/passkey-write-drivers.ts +11 -2
  119. package/src/drizzle/pg-identity.ts +2 -2
  120. package/src/drizzle/phone-model.ts +3 -3
  121. package/src/drizzle/phone-target.ts +11 -4
  122. package/src/drizzle/sqlite-do-database.ts +87 -0
  123. package/src/drizzle/sqlite-emails.ts +1 -1
  124. package/src/drizzle/sqlite-identity.ts +2 -2
  125. package/src/drizzle/sqlite-passwords.ts +1 -1
  126. package/src/drizzle/sqlite-proofs.ts +2 -2
  127. package/src/drizzle/sqlite-sessions.ts +2 -2
  128. package/src/drizzle/storage-validation.ts +15 -6
  129. package/src/drizzle/totp-state.ts +8 -8
  130. package/src/drizzle/totp-target.ts +11 -5
@@ -586,7 +586,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
586
586
  readonly hasMore: boolean;
587
587
  }, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/OAuth").OAuthUnavailable>;
588
588
  };
589
- }, import("@yielded/auth/OAuth").OAuthUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeOAuthSignInServices: <S extends AnySQLiteTable<{
589
+ }, import("@yielded/auth/OAuth").OAuthUnavailable, import("effect/Crypto").Crypto | Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeOAuthSignInServices: <S extends AnySQLiteTable<{
590
590
  dialect: "sqlite";
591
591
  }>, O extends AnySQLiteTable<{
592
592
  dialect: "sqlite";
@@ -628,7 +628,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
628
628
  readonly hasMore: boolean;
629
629
  }, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/OAuth").OAuthUnavailable>;
630
630
  };
631
- }, import("@yielded/auth/OAuth").OAuthUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeOAuthRegistrationIntentServices: <S extends AnySQLiteTable<{
631
+ }, import("@yielded/auth/OAuth").OAuthUnavailable, import("effect/Crypto").Crypto | Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeOAuthRegistrationIntentServices: <S extends AnySQLiteTable<{
632
632
  dialect: "sqlite";
633
633
  }>, O extends AnySQLiteTable<{
634
634
  dialect: "sqlite";
@@ -651,7 +651,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
651
651
  readonly nowMillis: number;
652
652
  }, prepare: import("@yielded/auth/OAuth").PrepareOAuthCommit<import("@yielded/auth/OAuth").OAuthRegistrationSettlement, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/OAuth").OAuthUnavailable>;
653
653
  };
654
- }, import("@yielded/auth/OAuth").OAuthUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeOAuthRegistrationServices: <Registration, S extends AnySQLiteTable<{
654
+ }, import("@yielded/auth/OAuth").OAuthUnavailable, import("effect/Crypto").Crypto | Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeOAuthRegistrationServices: <Registration, S extends AnySQLiteTable<{
655
655
  dialect: "sqlite";
656
656
  }>, O extends AnySQLiteTable<{
657
657
  dialect: "sqlite";
@@ -667,7 +667,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
667
667
  dialect: "sqlite";
668
668
  }>, N>(mapping: OAuthRegistrationMapping<Registration, S, O, C, AC, TA, I, R, N>) => Effect.Effect<{
669
669
  registrationAuthority: OAuthRegistrationAuthority<Registration>;
670
- }, import("@yielded/auth/OAuth").OAuthUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, coordinateOAuthRegistration: {
670
+ }, import("@yielded/auth/OAuth").OAuthUnavailable, import("effect/Crypto").Crypto | Database | import("@yielded/auth/Hooks").LifecycleHooks>, coordinateOAuthRegistration: {
671
671
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, TargetId, Registration, S extends AnySQLiteTable<{
672
672
  dialect: "sqlite";
673
673
  }>, O extends AnySQLiteTable<{
@@ -686,7 +686,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
686
686
  readonly mapping: OAuthRegistrationMapping<NoInfer<Registration>, S, O, C, AC, TA, I, Rq, N>;
687
687
  readonly target: SuppliedService<TargetId, OAuthRegistrationAuthority<Registration>>;
688
688
  readonly transaction?: never;
689
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TargetId>>;
689
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TargetId>>;
690
690
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, TargetId, Registration, S extends AnySQLiteTable<{
691
691
  dialect: "sqlite";
692
692
  }>, O extends AnySQLiteTable<{
@@ -707,7 +707,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
707
707
  readonly transaction: SuppliedService<TxId, NoInfer<Database extends {
708
708
  readonly transaction: (...args: any[]) => any;
709
709
  } ? Parameters<Parameters<Database["transaction"]>[0]>[0] : never>, TxShape>;
710
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TargetId | TxId>>;
710
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TargetId | TxId>>;
711
711
  }, coordinateOAuthSignIn: {
712
712
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
713
713
  dialect: "sqlite";
@@ -722,7 +722,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
722
722
  }>, N, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
723
723
  readonly mapping: OAuthSignInMapping<S, O, C, AC, F, N>;
724
724
  readonly transaction?: never;
725
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/OAuth").OAuthSignInPersistence>>;
725
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/OAuth").OAuthSignInPersistence>>;
726
726
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
727
727
  dialect: "sqlite";
728
728
  }>, O extends AnySQLiteTable<{
@@ -738,7 +738,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
738
738
  readonly transaction: SuppliedService<TxId, NoInfer<Database extends {
739
739
  readonly transaction: (...args: any[]) => any;
740
740
  } ? Parameters<Parameters<Database["transaction"]>[0]>[0] : never>, TxShape>;
741
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/OAuth").OAuthSignInPersistence>>;
741
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/OAuth").OAuthSignInPersistence>>;
742
742
  }, coordinateOAuthRegistrationIntents: {
743
743
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
744
744
  dialect: "sqlite";
@@ -757,7 +757,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
757
757
  }>, N, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
758
758
  readonly mapping: OAuthRegistrationIntentMapping<S, O, C, AC, F, TA, I, N>;
759
759
  readonly transaction?: never;
760
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/OAuth").OAuthRegistrationIntents>>;
760
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/OAuth").OAuthRegistrationIntents>>;
761
761
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
762
762
  dialect: "sqlite";
763
763
  }>, O extends AnySQLiteTable<{
@@ -777,7 +777,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
777
777
  readonly transaction: SuppliedService<TxId, NoInfer<Database extends {
778
778
  readonly transaction: (...args: any[]) => any;
779
779
  } ? Parameters<Parameters<Database["transaction"]>[0]>[0] : never>, TxShape>;
780
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/OAuth").OAuthRegistrationIntents>>;
780
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/OAuth").OAuthRegistrationIntents>>;
781
781
  }, coordinateOAuthAccounts: {
782
782
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
783
783
  dialect: "sqlite";
@@ -796,7 +796,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
796
796
  }>, N, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
797
797
  readonly mapping: OAuthAccountsMapping<S, O, C, AC, F, TA, U, N>;
798
798
  readonly transaction?: never;
799
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/OAuth").OAuthAccountsPersistence>>;
799
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/OAuth").OAuthAccountsPersistence>>;
800
800
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
801
801
  dialect: "sqlite";
802
802
  }>, O extends AnySQLiteTable<{
@@ -816,7 +816,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
816
816
  readonly transaction: SuppliedService<TxId, NoInfer<Database extends {
817
817
  readonly transaction: (...args: any[]) => any;
818
818
  } ? Parameters<Parameters<Database["transaction"]>[0]>[0] : never>, TxShape>;
819
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/OAuth").OAuthAccountsPersistence>>;
819
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/OAuth").OAuthAccountsPersistence>>;
820
820
  }, makeOAuthConnectedServices: <S extends AnySQLiteTable<{
821
821
  dialect: "sqlite";
822
822
  }>, AC extends AnySQLiteTable<{
@@ -1809,7 +1809,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
1809
1809
  readonly hasMore: boolean;
1810
1810
  }, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/OAuth").OAuthUnavailable, never>;
1811
1811
  };
1812
- }, import("@yielded/auth/OAuth").OAuthUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeOAuthConnectedRevocationServices: <T extends AnySQLiteTable<{
1812
+ }, import("@yielded/auth/OAuth").OAuthUnavailable, import("effect/Crypto").Crypto | Database | import("@yielded/auth/Hooks").LifecycleHooks>, makeOAuthConnectedRevocationServices: <T extends AnySQLiteTable<{
1813
1813
  dialect: "sqlite";
1814
1814
  }>, O extends AnySQLiteTable<{
1815
1815
  dialect: "sqlite";
@@ -1917,7 +1917,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
1917
1917
  readonly settled: boolean;
1918
1918
  }, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/OAuth").OAuthUnavailable>;
1919
1919
  };
1920
- }, import("@yielded/auth/OAuth").OAuthUnavailable, Database | import("@yielded/auth/Hooks").LifecycleHooks>, coordinateOAuthConnected: {
1920
+ }, import("@yielded/auth/OAuth").OAuthUnavailable, import("effect/Crypto").Crypto | Database | import("@yielded/auth/Hooks").LifecycleHooks>, coordinateOAuthConnected: {
1921
1921
  <D extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
1922
1922
  dialect: "sqlite";
1923
1923
  }>, AC extends AnySQLiteTable<{
@@ -1943,7 +1943,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
1943
1943
  }>, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
1944
1944
  readonly mapping: OAuthConnectedMapping<S, AC, T, O, F, G, C, H, UA, DC, N, J>;
1945
1945
  readonly transaction?: never;
1946
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/OAuth").OAuthConnectedPersistence>>;
1946
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/OAuth").OAuthConnectedPersistence>>;
1947
1947
  <D extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
1948
1948
  dialect: "sqlite";
1949
1949
  }>, AC extends AnySQLiteTable<{
@@ -1971,7 +1971,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
1971
1971
  readonly transaction: SuppliedService<TxId, NoInfer<D extends {
1972
1972
  readonly transaction: (...args: any[]) => any;
1973
1973
  } ? Parameters<Parameters<D["transaction"]>[0]>[0] : never>, TxShape>;
1974
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/OAuth").OAuthConnectedPersistence>>;
1974
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/OAuth").OAuthConnectedPersistence>>;
1975
1975
  }, coordinateOAuthConnectedRevocations: {
1976
1976
  <D extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, T extends AnySQLiteTable<{
1977
1977
  dialect: "sqlite";
@@ -1990,7 +1990,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
1990
1990
  }>, N, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<D, DatabaseError, DatabaseRequirements>, options: {
1991
1991
  readonly mapping: OAuthConnectedRevocationMapping<T, O, F, G, C, H, J, N>;
1992
1992
  readonly transaction?: never;
1993
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/OAuth").OAuthConnectedRevocations>>;
1993
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/OAuth").OAuthConnectedRevocations>>;
1994
1994
  <D extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, T extends AnySQLiteTable<{
1995
1995
  dialect: "sqlite";
1996
1996
  }>, O extends AnySQLiteTable<{
@@ -2010,7 +2010,7 @@ export declare const makeOAuthAccountsServices: <S extends AnySQLiteTable<{
2010
2010
  readonly transaction: SuppliedService<TxId, NoInfer<D extends {
2011
2011
  readonly transaction: (...args: any[]) => any;
2012
2012
  } ? Parameters<Parameters<D["transaction"]>[0]>[0] : never>, TxShape>;
2013
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/OAuth").OAuthConnectedRevocations>>;
2013
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | OAuthCoordinatorError<E>, DatabaseRequirements | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/OAuth").OAuthConnectedRevocations>>;
2014
2014
  };
2015
2015
  export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2016
2016
  dialect: "sqlite";
@@ -2022,7 +2022,7 @@ export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2022
2022
  dialect: "sqlite";
2023
2023
  }>, H extends AnySQLiteTable<{
2024
2024
  dialect: "sqlite";
2025
- }>, N, RSetup = never>(mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyCredentialMapping<S, C, F, O, H, N>, RSetup>) => Effect.Effect<import("@yielded/auth-persistence/Adapter").PasskeyCredentialServices, import("@yielded/auth/Passkey").PasskeyConfigurationError | import("@yielded/auth-persistence/Adapter").PersistenceMappingError, Database | Exclude<RSetup, NativeDatabase>>, makePasskeyPersistenceServices: <S extends AnySQLiteTable<{
2025
+ }>, N, RSetup = never>(mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyCredentialMapping<S, C, F, O, H, N>, RSetup>) => Effect.Effect<import("@yielded/auth-persistence/Adapter").PasskeyCredentialServices, import("@yielded/auth/Passkey").PasskeyConfigurationError | import("@yielded/auth-persistence/Adapter").PersistenceMappingError, import("effect/Crypto").Crypto | Database | Exclude<RSetup, NativeDatabase>>, makePasskeyPersistenceServices: <S extends AnySQLiteTable<{
2026
2026
  dialect: "sqlite";
2027
2027
  }>, C extends AnySQLiteTable<{
2028
2028
  dialect: "sqlite";
@@ -2040,7 +2040,7 @@ export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2040
2040
  dialect: "sqlite";
2041
2041
  }>, Charge extends AnySQLiteTable<{
2042
2042
  dialect: "sqlite";
2043
- }>, N, RSetup = never>(mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyPersistenceMapping<PasskeyCredentialMapping<S, C, F, O, H, N>, M, Flow, Admission, Charge, N>, RSetup>) => Effect.Effect<import("@yielded/auth-persistence/Adapter").PasskeyPersistenceServices, import("@yielded/auth/Passkey").PasskeyConfigurationError | import("@yielded/auth-persistence/Adapter").PersistenceMappingError, Database | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<RSetup, NativeDatabase>>, makePasskeyEnrollmentContextServices: <S extends AnySQLiteTable<{
2043
+ }>, N, RSetup = never>(mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyPersistenceMapping<PasskeyCredentialMapping<S, C, F, O, H, N>, M, Flow, Admission, Charge, N>, RSetup>) => Effect.Effect<import("@yielded/auth-persistence/Adapter").PasskeyPersistenceServices, import("@yielded/auth/Passkey").PasskeyConfigurationError | import("@yielded/auth-persistence/Adapter").PersistenceMappingError, import("effect/Crypto").Crypto | Database | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<RSetup, NativeDatabase>>, makePasskeyEnrollmentContextServices: <S extends AnySQLiteTable<{
2044
2044
  dialect: "sqlite";
2045
2045
  }>, C extends AnySQLiteTable<{
2046
2046
  dialect: "sqlite";
@@ -2052,7 +2052,7 @@ export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2052
2052
  dialect: "sqlite";
2053
2053
  }>, M extends AnySQLiteTable<{
2054
2054
  dialect: "sqlite";
2055
- }>, N, RSetup = never>(mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyEnrollmentContextMapping<PasskeyCredentialMapping<S, C, F, O, H, N>, M, N>, RSetup>) => Effect.Effect<import("@yielded/auth-persistence/Adapter").PasskeyEnrollmentContextServices, import("@yielded/auth/Passkey").PasskeyConfigurationError | import("@yielded/auth-persistence/Adapter").PersistenceMappingError, Database | Exclude<RSetup, NativeDatabase>>, makePasskeyRegistrationCeremonyServices: <M extends AnySQLiteTable<{
2055
+ }>, N, RSetup = never>(mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyEnrollmentContextMapping<PasskeyCredentialMapping<S, C, F, O, H, N>, M, N>, RSetup>) => Effect.Effect<import("@yielded/auth-persistence/Adapter").PasskeyEnrollmentContextServices, import("@yielded/auth/Passkey").PasskeyConfigurationError | import("@yielded/auth-persistence/Adapter").PersistenceMappingError, import("effect/Crypto").Crypto | Database | Exclude<RSetup, NativeDatabase>>, makePasskeyRegistrationCeremonyServices: <M extends AnySQLiteTable<{
2056
2056
  dialect: "sqlite";
2057
2057
  }>, Flow extends AnySQLiteTable<{
2058
2058
  dialect: "sqlite";
@@ -2064,7 +2064,7 @@ export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2064
2064
  dialect: "sqlite";
2065
2065
  }>, H extends AnySQLiteTable<{
2066
2066
  dialect: "sqlite";
2067
- }>, RSetup = never>(mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyRegistrationCeremonyMapping<M, Flow, Admission, Charge, Intent, H>, RSetup>) => Effect.Effect<import("@yielded/auth-persistence/Adapter").PasskeyRegistrationCeremonyServices, import("@yielded/auth/Passkey").PasskeyConfigurationError | import("@yielded/auth-persistence/Adapter").PersistenceMappingError, Database | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<RSetup, NativeDatabase>>, coordinatePasskeyPersistence: {
2067
+ }>, RSetup = never>(mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyRegistrationCeremonyMapping<M, Flow, Admission, Charge, Intent, H>, RSetup>) => Effect.Effect<import("@yielded/auth-persistence/Adapter").PasskeyRegistrationCeremonyServices, import("@yielded/auth/Passkey").PasskeyConfigurationError | import("@yielded/auth-persistence/Adapter").PersistenceMappingError, import("effect/Crypto").Crypto | Database | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<RSetup, NativeDatabase>>, coordinatePasskeyPersistence: {
2068
2068
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
2069
2069
  dialect: "sqlite";
2070
2070
  }>, C extends AnySQLiteTable<{
@@ -2086,7 +2086,7 @@ export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2086
2086
  }>, N, A, E, R, RSetup = never, DatabaseError = never, DatabaseRequirements = never>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
2087
2087
  readonly mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyPersistenceMapping<PasskeyCredentialMapping<S, C, F, O, H, N>, M, Flow, Admission, Charge, N>, RSetup>;
2088
2088
  readonly transaction?: never;
2089
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/Passkey").PasskeyPersistence>>;
2089
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/Passkey").PasskeyPersistence>>;
2090
2090
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
2091
2091
  dialect: "sqlite";
2092
2092
  }>, C extends AnySQLiteTable<{
@@ -2110,7 +2110,7 @@ export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2110
2110
  readonly transaction: SuppliedService<TxId, NoInfer<Database extends {
2111
2111
  readonly transaction: (...args: any[]) => any;
2112
2112
  } ? Parameters<Parameters<Database["transaction"]>[0]>[0] : never>, TxShape>;
2113
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/Passkey").PasskeyPersistence>>;
2113
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/Passkey").PasskeyPersistence>>;
2114
2114
  }, coordinatePasskeyRegistrationCeremony: {
2115
2115
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, M extends AnySQLiteTable<{
2116
2116
  dialect: "sqlite";
@@ -2127,7 +2127,7 @@ export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2127
2127
  }>, A, E, R, RSetup = never, DatabaseError = never, DatabaseRequirements = never>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
2128
2128
  readonly mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyRegistrationCeremonyMapping<M, Flow, Admission, Charge, Intent, H>, RSetup>;
2129
2129
  readonly transaction?: never;
2130
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/Passkey").PasskeyPersistence>>;
2130
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/Passkey").PasskeyPersistence>>;
2131
2131
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, M extends AnySQLiteTable<{
2132
2132
  dialect: "sqlite";
2133
2133
  }>, Flow extends AnySQLiteTable<{
@@ -2145,7 +2145,7 @@ export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2145
2145
  readonly transaction: SuppliedService<TxId, NoInfer<Database extends {
2146
2146
  readonly transaction: (...args: any[]) => any;
2147
2147
  } ? Parameters<Parameters<Database["transaction"]>[0]>[0] : never>, TxShape>;
2148
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/Passkey").PasskeyPersistence>>;
2148
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/Passkey").PasskeyPersistence>>;
2149
2149
  }, makePasskeyManagementServices: <S extends AnySQLiteTable<{
2150
2150
  dialect: "sqlite";
2151
2151
  }>, C extends AnySQLiteTable<{
@@ -2166,7 +2166,7 @@ export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2166
2166
  dialect: "sqlite";
2167
2167
  }>, Command extends AnySQLiteTable<{
2168
2168
  dialect: "sqlite";
2169
- }>, N, RSetup = never>(mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyManagementMapping<S, C, F, O, H, M, Flow, Admission, Charge, Command, N>, RSetup>) => Effect.Effect<import("@yielded/auth-persistence/Adapter").PasskeyManagementServices, import("@yielded/auth/Passkey").PasskeyConfigurationError | import("@yielded/auth-persistence/Adapter").PersistenceMappingError, Database | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<RSetup, NativeDatabase>>, makePasskeyRegistrationServices: <S extends AnySQLiteTable<{
2169
+ }>, N, RSetup = never>(mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyManagementMapping<S, C, F, O, H, M, Flow, Admission, Charge, Command, N>, RSetup>) => Effect.Effect<import("@yielded/auth-persistence/Adapter").PasskeyManagementServices, import("@yielded/auth/Passkey").PasskeyConfigurationError | import("@yielded/auth-persistence/Adapter").PersistenceMappingError, import("effect/Crypto").Crypto | Database | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<RSetup, NativeDatabase>>, makePasskeyRegistrationServices: <S extends AnySQLiteTable<{
2170
2170
  dialect: "sqlite";
2171
2171
  }>, C extends AnySQLiteTable<{
2172
2172
  dialect: "sqlite";
@@ -2186,7 +2186,7 @@ export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2186
2186
  dialect: "sqlite";
2187
2187
  }>, Intent extends AnySQLiteTable<{
2188
2188
  dialect: "sqlite";
2189
- }>, N, Value, RSetup = never>(mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyRegistrationMapping<S, C, F, O, H, M, Flow, Admission, Charge, Intent, N, Value>, RSetup>) => Effect.Effect<import("@yielded/auth-persistence/Adapter").PasskeyRegistrationServices<Value>, import("@yielded/auth/Passkey").PasskeyConfigurationError | import("@yielded/auth-persistence/Adapter").PersistenceMappingError, Database | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<RSetup, NativeDatabase>>, coordinatePasskeyManagement: {
2189
+ }>, N, Value, RSetup = never>(mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyRegistrationMapping<S, C, F, O, H, M, Flow, Admission, Charge, Intent, N, Value>, RSetup>) => Effect.Effect<import("@yielded/auth-persistence/Adapter").PasskeyRegistrationServices<Value>, import("@yielded/auth/Passkey").PasskeyConfigurationError | import("@yielded/auth-persistence/Adapter").PersistenceMappingError, import("effect/Crypto").Crypto | Database | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<RSetup, NativeDatabase>>, coordinatePasskeyManagement: {
2190
2190
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
2191
2191
  dialect: "sqlite";
2192
2192
  }>, C extends AnySQLiteTable<{
@@ -2210,7 +2210,7 @@ export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2210
2210
  }>, N, A, E, R, RSetup = never, DatabaseError = never, DatabaseRequirements = never>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
2211
2211
  readonly mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyManagementMapping<S, C, F, O, H, M, Flow, Admission, Charge, Command, N>, RSetup>;
2212
2212
  readonly transaction?: never;
2213
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/Passkey").PasskeyManagementPersistence | import("@yielded/auth/Passkey").PasskeyPersistence>>;
2213
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/Passkey").PasskeyManagementPersistence | import("@yielded/auth/Passkey").PasskeyPersistence>>;
2214
2214
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
2215
2215
  dialect: "sqlite";
2216
2216
  }>, C extends AnySQLiteTable<{
@@ -2236,7 +2236,7 @@ export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2236
2236
  readonly transaction: SuppliedService<TxId, NoInfer<Database extends {
2237
2237
  readonly transaction: (...args: any[]) => any;
2238
2238
  } ? Parameters<Parameters<Database["transaction"]>[0]>[0] : never>, TxShape>;
2239
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/Passkey").PasskeyManagementPersistence | import("@yielded/auth/Passkey").PasskeyPersistence>>;
2239
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/Passkey").PasskeyManagementPersistence | import("@yielded/auth/Passkey").PasskeyPersistence>>;
2240
2240
  }, coordinatePasskeyRegistration: {
2241
2241
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
2242
2242
  dialect: "sqlite";
@@ -2262,7 +2262,7 @@ export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2262
2262
  readonly mapping: import("@yielded/auth-persistence/Adapter").PasskeyMappingSource<PasskeyRegistrationMapping<S, C, F, O, H, M, Flow, Admission, Charge, Intent, N, Value>, RSetup>;
2263
2263
  readonly authority: Context.Key<AuthorityId, import("@yielded/auth-persistence/Adapter").PasskeyRegistrationWriter<Value>>;
2264
2264
  readonly transaction?: never;
2265
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, AuthorityId | import("@yielded/auth/Passkey").PasskeyPersistence>>;
2265
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, AuthorityId | import("@yielded/auth/Passkey").PasskeyPersistence>>;
2266
2266
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
2267
2267
  dialect: "sqlite";
2268
2268
  }>, C extends AnySQLiteTable<{
@@ -2289,7 +2289,7 @@ export declare const makePasskeyCredentialServices: <S extends AnySQLiteTable<{
2289
2289
  readonly transaction: SuppliedService<TxId, NoInfer<Database extends {
2290
2290
  readonly transaction: (...args: any[]) => any;
2291
2291
  } ? Parameters<Parameters<Database["transaction"]>[0]>[0] : never>, TxShape>;
2292
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, AuthorityId | TxId | import("@yielded/auth/Passkey").PasskeyPersistence>>;
2292
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | import("@yielded/auth-persistence/Adapter").PasskeyCoordinatorError<E>, DatabaseRequirements | RSetup | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, AuthorityId | TxId | import("@yielded/auth/Passkey").PasskeyPersistence>>;
2293
2293
  };
2294
2294
  export declare const makeTotpPersistenceServices: <S extends AnySQLiteTable<{
2295
2295
  dialect: "sqlite";
@@ -2297,7 +2297,7 @@ export declare const makeTotpPersistenceServices: <S extends AnySQLiteTable<{
2297
2297
  dialect: "sqlite";
2298
2298
  }>, C extends AnySQLiteTable<{
2299
2299
  dialect: "sqlite";
2300
- }>, N, RSetup = never>(mapping: TotpMappingSource<TotpMapping<S, F, C, N>, RSetup>) => Effect.Effect<TotpPersistenceServices, import("@yielded/auth-persistence/Adapter").PersistenceMappingError | import("@yielded/auth/Totp").TotpConfigurationError, Database | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<RSetup, NativeDatabase>>, coordinateTotpPersistence: {
2300
+ }>, N, RSetup = never>(mapping: TotpMappingSource<TotpMapping<S, F, C, N>, RSetup>) => Effect.Effect<TotpPersistenceServices, import("@yielded/auth-persistence/Adapter").PersistenceMappingError | import("@yielded/auth/Totp").TotpConfigurationError, import("effect/Crypto").Crypto | Database | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<RSetup, NativeDatabase>>, coordinateTotpPersistence: {
2301
2301
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
2302
2302
  dialect: "sqlite";
2303
2303
  }>, F extends AnySQLiteTable<{
@@ -2307,7 +2307,7 @@ export declare const makeTotpPersistenceServices: <S extends AnySQLiteTable<{
2307
2307
  }>, N, A, E, R, RSetup = never, DatabaseError = never, DatabaseRequirements = never>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
2308
2308
  readonly mapping: TotpMappingSource<TotpMapping<S, F, C, N>, RSetup>;
2309
2309
  readonly transaction?: never;
2310
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | TotpCoordinatorError<E>, DatabaseRequirements | RSetup | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/Totp").TotpPersistence>>;
2310
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | TotpCoordinatorError<E>, DatabaseRequirements | RSetup | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/Totp").TotpPersistence>>;
2311
2311
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
2312
2312
  dialect: "sqlite";
2313
2313
  }>, F extends AnySQLiteTable<{
@@ -2319,7 +2319,7 @@ export declare const makeTotpPersistenceServices: <S extends AnySQLiteTable<{
2319
2319
  readonly transaction: SuppliedService<TxId, NoInfer<Database extends {
2320
2320
  readonly transaction: (...args: any[]) => any;
2321
2321
  } ? Parameters<Parameters<Database["transaction"]>[0]>[0] : never>, TxShape>;
2322
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | TotpCoordinatorError<E>, DatabaseRequirements | RSetup | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/Totp").TotpPersistence>>;
2322
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | TotpCoordinatorError<E>, DatabaseRequirements | RSetup | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/Totp").TotpPersistence>>;
2323
2323
  };
2324
2324
  export declare const makePhonePersistenceServices: <S extends AnySQLiteTable<{
2325
2325
  dialect: "sqlite";
@@ -2329,7 +2329,7 @@ export declare const makePhonePersistenceServices: <S extends AnySQLiteTable<{
2329
2329
  dialect: "sqlite";
2330
2330
  }>, C extends AnySQLiteTable<{
2331
2331
  dialect: "sqlite";
2332
- }>, N, RSetup = never>(mapping: PhoneMappingSource<PhoneMapping<S, I, C, F, N>, RSetup>) => Effect.Effect<PhonePersistenceServices, import("@yielded/auth-persistence/Adapter").PersistenceMappingError | import("@yielded/auth/PhoneOtp").PhoneConfigurationError, Database | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<RSetup, NativeDatabase>>, coordinatePhonePersistence: {
2332
+ }>, N, RSetup = never>(mapping: PhoneMappingSource<PhoneMapping<S, I, C, F, N>, RSetup>) => Effect.Effect<PhonePersistenceServices, import("@yielded/auth-persistence/Adapter").PersistenceMappingError | import("@yielded/auth/PhoneOtp").PhoneConfigurationError, import("effect/Crypto").Crypto | Database | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<RSetup, NativeDatabase>>, coordinatePhonePersistence: {
2333
2333
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
2334
2334
  dialect: "sqlite";
2335
2335
  }>, I extends AnySQLiteTable<{
@@ -2341,7 +2341,7 @@ export declare const makePhonePersistenceServices: <S extends AnySQLiteTable<{
2341
2341
  }>, N, A, E, R, RSetup = never, DatabaseError = never, DatabaseRequirements = never>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
2342
2342
  readonly mapping: PhoneMappingSource<PhoneMapping<S, I, C, F, N>, RSetup>;
2343
2343
  readonly transaction?: never;
2344
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | PhoneCoordinatorError<E>, DatabaseRequirements | RSetup | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/PhoneOtp").PhoneAdmission | import("@yielded/auth/PhoneOtp").PhonePersistence | import("@yielded/auth/PhoneOtp").PhoneSignInTargets>>;
2344
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | PhoneCoordinatorError<E>, DatabaseRequirements | RSetup | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, import("@yielded/auth/PhoneOtp").PhoneAdmission | import("@yielded/auth/PhoneOtp").PhonePersistence | import("@yielded/auth/PhoneOtp").PhoneSignInTargets>>;
2345
2345
  <Database extends EffectSQLiteWasmDatabase<import("drizzle-orm").TablesRelationalConfig>, S extends AnySQLiteTable<{
2346
2346
  dialect: "sqlite";
2347
2347
  }>, I extends AnySQLiteTable<{
@@ -2355,7 +2355,7 @@ export declare const makePhonePersistenceServices: <S extends AnySQLiteTable<{
2355
2355
  readonly transaction: SuppliedService<TxId, NoInfer<Database extends {
2356
2356
  readonly transaction: (...args: any[]) => any;
2357
2357
  } ? Parameters<Parameters<Database["transaction"]>[0]>[0] : never>, TxShape>;
2358
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | PhoneCoordinatorError<E>, DatabaseRequirements | RSetup | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/PhoneOtp").PhoneAdmission | import("@yielded/auth/PhoneOtp").PhonePersistence | import("@yielded/auth/PhoneOtp").PhoneSignInTargets>>;
2358
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, DatabaseError | PhoneCoordinatorError<E>, DatabaseRequirements | RSetup | import("effect/Crypto").Crypto | import("@yielded/auth/Hooks").LifecycleHooks | Exclude<R, TxId | import("@yielded/auth/PhoneOtp").PhoneAdmission | import("@yielded/auth/PhoneOtp").PhonePersistence | import("@yielded/auth/PhoneOtp").PhoneSignInTargets>>;
2359
2359
  };
2360
2360
  export declare const AuthPersistence: {
2361
2361
  make: <C extends import("@yielded/auth-persistence/Adapter").ClaimsCodec, const Id extends string, const A extends import("@yielded/auth-persistence/Adapter").Definition<C, Id>>(auth: A & import("@yielded/auth-persistence/Adapter").Definition<C, Id>) => import("@yielded/auth-persistence/Adapter").BoundPersistence<import("drizzle-orm/sqlite-core").SQLiteTable<import("drizzle-orm/sqlite-core").TableConfig>, import("@effect/sql-sqlite-wasm/SqliteClient").SqliteClient, C, Id, A>;
@@ -0,0 +1,11 @@
1
+ import { Crypto, Effect } from "effect";
2
+ import { Base64Url } from "effect/encoding";
3
+ import { TokenDigest } from "@yielded/auth/Schema";
4
+ //#region src/drizzle/crypto.ts
5
+ const encoder = new TextEncoder();
6
+ const randomId = Effect.flatMap(Crypto.Crypto, (crypto) => crypto.randomBytes(32).pipe(Effect.map(Base64Url.encode)));
7
+ const digest = (value) => Effect.flatMap(Crypto.Crypto, (crypto) => crypto.digest("SHA-256", encoder.encode(value))).pipe(Effect.map((bytes) => TokenDigest.make(Base64Url.encode(bytes))));
8
+ //#endregion
9
+ export { digest, randomId };
10
+
11
+ //# sourceMappingURL=crypto.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.mjs","names":[],"sources":["../../src/drizzle/crypto.ts"],"sourcesContent":["import { TokenDigest } from \"@yielded/auth/Schema\";\nimport { Crypto, Effect } from \"effect\";\nimport { Base64Url } from \"effect/encoding\";\n\nconst encoder = new TextEncoder();\n\nexport const randomId = Effect.flatMap(Crypto.Crypto, (crypto) =>\n crypto.randomBytes(32).pipe(Effect.map(Base64Url.encode)),\n);\n\nexport const digest = (value: string) =>\n Effect.flatMap(Crypto.Crypto, (crypto) => crypto.digest(\"SHA-256\", encoder.encode(value))).pipe(\n Effect.map((bytes) => TokenDigest.make(Base64Url.encode(bytes))),\n );\n"],"mappings":";;;;AAIA,MAAM,UAAU,IAAI,YAAY;AAEhC,MAAa,WAAW,OAAO,QAAQ,OAAO,SAAS,WACrD,OAAO,YAAY,EAAE,CAAC,CAAC,KAAK,OAAO,IAAI,UAAU,MAAM,CAAC,CAC1D;AAEA,MAAa,UAAU,UACrB,OAAO,QAAQ,OAAO,SAAS,WAAW,OAAO,OAAO,WAAW,QAAQ,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KACzF,OAAO,KAAK,UAAU,YAAY,KAAK,UAAU,OAAO,KAAK,CAAC,CAAC,CACjE"}
@@ -2,7 +2,7 @@ import { column, isMappedConstraintConflict, provisioningFingerprint } from "./m
2
2
  import { validateDrizzleStorage } from "./storage-validation.mjs";
3
3
  import { Database } from "./d1-database.mjs";
4
4
  import { nativeDatabase } from "./native-database.mjs";
5
- import { NativeDatabase } from "@yielded/auth-persistence/Adapter";
5
+ import { NativeDatabase, withStorageValidation } from "@yielded/auth-persistence/Adapter";
6
6
  import { ExternalIdentityMutation, IdentityConflict, IdentityUnavailable, SubjectProvisioned, SubjectProvisioner } from "@yielded/auth/Identity";
7
7
  import { SQL, and, eq, getTableColumns, is, sql } from "drizzle-orm";
8
8
  import { Cause, Effect, Schema } from "effect";
@@ -121,7 +121,7 @@ const makeD1IdentityServices = Effect.fnUntraced(function* (mapping) {
121
121
  ...yield* makeD1SubjectProvisioningServices(mapping),
122
122
  ...yield* makeD1ExternalIdentityServices(mapping)
123
123
  };
124
- });
124
+ }, withStorageValidation);
125
125
  //#endregion
126
126
  export { makeD1ExternalIdentityServices, makeD1IdentityServices, makeD1SubjectProvisioningServices };
127
127
 
@@ -1 +1 @@
1
- {"version":3,"file":"d1-identity.mjs","names":["DatabaseService"],"sources":["../../src/drizzle/d1-identity.ts"],"sourcesContent":["import type { D1Client } from \"@effect/sql-d1/D1Client\";\nimport { NativeDatabase } from \"@yielded/auth-persistence/Adapter\";\nimport {\n ExternalIdentityMutation,\n type ExternalIdentity,\n IdentityConflict,\n IdentityUnavailable,\n SubjectProvisioned,\n SubjectProvisioner,\n type SubjectProvisioningInput,\n} from \"@yielded/auth/Identity\";\nimport { reportPersistenceFailure } from \"@yielded/auth/Persistence\";\nimport type { SubjectId } from \"@yielded/auth/Schema\";\n/* oxlint-disable no-explicit-any -- D1 batch bridges Drizzle SQL objects to Effect SQL Statements at this adapter boundary. */\nimport {\n and,\n eq,\n getTableColumns,\n is,\n sql,\n SQL,\n type InferInsertModel,\n type Table,\n} from \"drizzle-orm\";\nimport type { EffectSQLiteD1Database } from \"drizzle-orm/effect-d1\";\nimport type { AnySQLiteTable, SQLiteColumn } from \"drizzle-orm/sqlite-core\";\nimport { Cause, Effect, Schema } from \"effect\";\n\nimport { Database as DatabaseService } from \"./d1-database\";\nimport {\n column,\n isMappedConstraintConflict,\n provisioningFingerprint,\n type D1ExternalIdentityMapping,\n type D1GeneratedIdentityMapping,\n type D1SubjectProvisioningMapping,\n} from \"./model\";\nimport { nativeDatabase } from \"./native-database\";\nimport { validateDrizzleStorage } from \"./storage-validation\";\n\ntype RuntimeDatabase = EffectSQLiteD1Database<any> & { readonly $client: D1Client };\nconst unavailable = () => IdentityUnavailable.make();\nconst isIdentityFailure = Schema.is(Schema.Union([IdentityConflict, IdentityUnavailable]));\n\nconst mapUnavailable = <A, E, R>(effect: Effect.Effect<A, E, R>) =>\n reportPersistenceFailure(effect, isIdentityFailure).pipe(\n Effect.catchCause((cause) =>\n Effect.failCause(\n Cause.map(cause, (error) => (isIdentityFailure(error) ? error : unavailable())),\n ),\n ),\n );\n\nconst selectFields = <T extends Table>(\n table: T,\n values: InferInsertModel<T>,\n): Record<string, unknown> => {\n const columns = getTableColumns(table) as Record<string, SQLiteColumn>;\n\n const fields = Object.fromEntries(\n Object.entries(values)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [\n key,\n is(value, SQL) ? value : sql`${sql.param(value, columns[key] as SQLiteColumn)}`,\n ]),\n );\n\n for (const [key, mapped] of Object.entries(columns)) {\n if (\n fields[key] !== undefined ||\n (\n mapped as SQLiteColumn & { readonly shouldDisableInsert: () => boolean }\n ).shouldDisableInsert()\n )\n continue;\n if (mapped.default !== null && mapped.default !== undefined) continue;\n\n const value =\n mapped.defaultFn !== undefined\n ? mapped.defaultFn()\n : !mapped.default && mapped.onUpdateFn !== undefined\n ? mapped.onUpdateFn()\n : undefined;\n\n if (value !== undefined || mapped.defaultFn !== undefined || mapped.onUpdateFn !== undefined)\n fields[key] = is(value, SQL) ? value : sql`${sql.param(value, mapped)}`;\n }\n\n return fields;\n};\n\n/**\n * D1 provisioning is an ordered atomic batch. The receipt captures the\n * database-generated subject id from the first insert via last_insert_rowid;\n * the optional identifier then reads that stable id from the receipt.\n */\nexport const makeD1SubjectProvisioningServices = Effect.fnUntraced(function* <\n Subject extends AnySQLiteTable,\n Identifier extends AnySQLiteTable,\n Request extends AnySQLiteTable,\n NativeId,\n>(mapping: D1SubjectProvisioningMapping<Subject, Identifier, Request, NativeId>) {\n const database = yield* DatabaseService;\n\n yield* validateDrizzleStorage(mapping).pipe(\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(DatabaseService)),\n Effect.mapError(() => IdentityUnavailable.make()),\n );\n\n const db = database as RuntimeDatabase;\n const requestTable = mapping.provisioningRequest.table;\n\n const requestIdColumn = column(\n requestTable,\n mapping.provisioningRequest.requestId,\n ) as SQLiteColumn;\n\n const requestFingerprintColumn = column(\n requestTable,\n mapping.provisioningRequest.fingerprint,\n ) as SQLiteColumn;\n\n const requestSubjectColumn = column(\n requestTable,\n mapping.provisioningRequest.subjectId,\n ) as SQLiteColumn;\n\n const findReceipt = Effect.fn(\"DrizzleD1Identity.findReceipt\")(function* (requestId: string) {\n const rows = yield* db\n .select({ fingerprint: requestFingerprintColumn, subjectId: requestSubjectColumn })\n .from(requestTable as any)\n .where(eq(requestIdColumn, requestId))\n .limit(1);\n\n return rows[0];\n });\n\n const provision = Effect.fn(\"DrizzleD1Identity.provision\")(function* (\n input: SubjectProvisioningInput,\n ) {\n const fingerprint = provisioningFingerprint(input);\n const existing = yield* findReceipt(input.requestId);\n\n if (existing !== undefined) {\n if (existing.fingerprint !== fingerprint) return yield* IdentityConflict.make();\n const subjectId = yield* mapping.subjectId.toSubject(existing.subjectId as NativeId);\n\n return SubjectProvisioned.make({ subjectId });\n }\n\n const allocated =\n mapping.subject.allocateId === undefined\n ? mapping.subject.allocateIdSync?.()\n : yield* mapping.subject.allocateId;\n\n const subjectQuery = db\n .insert(mapping.subject.table as any)\n .values(mapping.subject.encodeInsert(input, allocated) as any)\n .toSQL();\n\n const statements = [db.$client.unsafe(subjectQuery.sql, subjectQuery.params)];\n\n if (allocated !== undefined) {\n const requestQuery = db\n .insert(requestTable as any)\n .values(\n mapping.provisioningRequest.encodeInsert(input.requestId, fingerprint, allocated) as any,\n )\n .toSQL();\n\n statements.push(db.$client.unsafe(requestQuery.sql, requestQuery.params));\n\n if (input.identifier !== undefined) {\n const identifierQuery = db\n .insert(mapping.identifier.table as any)\n .values(\n mapping.identifier.encodeInsert(input.identifier, allocated, input.verifiedAt) as any,\n )\n .toSQL();\n\n statements.push(db.$client.unsafe(identifierQuery.sql, identifierQuery.params));\n }\n } else {\n if (mapping.d1.generatedRowIdAlias === undefined) return yield* unavailable();\n\n const mappedColumnNames = Object.values(getTableColumns(mapping.subject.table)).map((value) =>\n value.name.toLowerCase(),\n );\n\n if (mappedColumnNames.includes(mapping.d1.generatedRowIdAlias.toLowerCase()))\n return yield* unavailable();\n const subjectIdColumn = column(mapping.subject.table, mapping.subject.id);\n const rowId = sql.identifier(mapping.d1.generatedRowIdAlias);\n\n const requestQuery = db\n .insert(requestTable as any)\n .values({\n ...mapping.d1.requestInsertWithoutSubject(input.requestId, fingerprint),\n [mapping.provisioningRequest.subjectId]:\n sql`(select ${subjectIdColumn} from ${mapping.subject.table} where ${rowId} = last_insert_rowid())`,\n } as any)\n .toSQL();\n\n statements.push(db.$client.unsafe(requestQuery.sql, requestQuery.params));\n }\n\n if (allocated === undefined && input.identifier !== undefined) {\n const requestIdParam = sql.param(input.requestId, requestIdColumn);\n\n const identifierQuery = db\n .insert(mapping.identifier.table as any)\n .values({\n ...mapping.d1.identifierInsertWithoutSubject(input.identifier, input.verifiedAt),\n [mapping.identifier.subjectId]:\n sql`(select ${requestSubjectColumn} from ${requestTable} where ${requestIdColumn} = ${requestIdParam})`,\n } as any)\n .toSQL();\n\n statements.push(db.$client.unsafe(identifierQuery.sql, identifierQuery.params));\n }\n const attempt = db.$client.batch(statements);\n\n yield* attempt.pipe(\n Effect.catchCause(\n (\n cause,\n ): Effect.Effect<\n void,\n | Effect.Error<typeof attempt>\n | Effect.Error<ReturnType<typeof findReceipt>>\n | IdentityConflict\n > => {\n if (\n cause.reasons.length === 0 ||\n !cause.reasons.every(\n (reason) =>\n Cause.isFailReason(reason) &&\n isMappedConstraintConflict(mapping.isConstraintConflict, reason.error),\n )\n )\n return Effect.failCause(cause);\n\n return findReceipt(input.requestId).pipe(\n Effect.flatMap((receipt) =>\n receipt !== undefined && receipt.fingerprint === fingerprint\n ? Effect.void\n : IdentityConflict.make(),\n ),\n );\n },\n ),\n );\n const receipt = yield* findReceipt(input.requestId);\n\n if (receipt === undefined || receipt.fingerprint !== fingerprint)\n return yield* IdentityConflict.make();\n const subjectId = yield* mapping.subjectId.toSubject(receipt.subjectId as NativeId);\n\n return SubjectProvisioned.make({ subjectId });\n }, mapUnavailable);\n\n return { subjectProvisioner: SubjectProvisioner.of({ provision }) } as const;\n});\n\nexport const makeD1ExternalIdentityServices = Effect.fnUntraced(function* <\n Subject extends AnySQLiteTable,\n External extends AnySQLiteTable,\n NativeId,\n>(mapping: D1ExternalIdentityMapping<Subject, External, NativeId>) {\n const database = yield* DatabaseService;\n\n yield* validateDrizzleStorage(mapping).pipe(\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(DatabaseService)),\n Effect.mapError(() => IdentityUnavailable.make()),\n );\n\n const db = database as RuntimeDatabase;\n const externalTable = mapping.externalIdentity.table;\n\n const externalSubjectIdColumn = column(\n externalTable,\n mapping.externalIdentity.subjectId,\n ) as SQLiteColumn;\n\n const externalProviderColumn = column(\n externalTable,\n mapping.externalIdentity.provider,\n ) as SQLiteColumn;\n\n const externalIssuerColumn = column(\n externalTable,\n mapping.externalIdentity.issuer,\n ) as SQLiteColumn;\n\n const externalSubjectColumn = column(\n externalTable,\n mapping.externalIdentity.subject,\n ) as SQLiteColumn;\n\n const bind = Effect.fn(\"DrizzleD1Identity.bindExternalIdentity\")(function* (\n subjectId: SubjectId,\n identity: ExternalIdentity,\n ) {\n const nativeId = yield* mapping.subjectId.toNative(subjectId);\n const subjectIdColumn = column(mapping.subject.table, mapping.subject.id);\n const subjectStatusColumn = column(mapping.subject.table, mapping.subject.status);\n const nativeIdParam = sql.param(nativeId, subjectIdColumn);\n const activeStatusParam = sql.param(mapping.d1.activeStatusValue, subjectStatusColumn);\n\n const selection = selectFields(\n externalTable,\n mapping.externalIdentity.encodeInsert(identity, nativeId),\n );\n\n selection[mapping.externalIdentity.subjectId] = subjectIdColumn;\n\n const inserted = yield* db\n .insert(externalTable as any)\n .select(\n db\n .select(selection as any)\n .from(mapping.subject.table as any)\n .where(\n and(eq(subjectIdColumn, nativeIdParam), eq(subjectStatusColumn, activeStatusParam)),\n ) as any,\n )\n .returning({ subjectId: externalSubjectIdColumn })\n .pipe(\n Effect.catchCause((cause) => {\n if (\n cause.reasons.length === 0 ||\n !cause.reasons.every(\n (reason) =>\n Cause.isFailReason(reason) &&\n isMappedConstraintConflict(mapping.isConstraintConflict, reason.error),\n )\n )\n return Effect.failCause(cause);\n\n return db\n .select({ subjectId: externalSubjectIdColumn })\n .from(externalTable as any)\n .innerJoin(\n mapping.subject.table as any,\n and(\n eq(externalSubjectIdColumn, subjectIdColumn),\n eq(subjectStatusColumn, mapping.d1.activeStatusValue),\n ),\n )\n .where(\n and(\n eq(externalProviderColumn, identity.provider),\n eq(externalIssuerColumn, identity.issuer),\n eq(externalSubjectColumn, identity.subject),\n eq(externalSubjectIdColumn, nativeId),\n ),\n )\n .limit(1);\n }),\n );\n\n const row = inserted[0];\n\n if (row === undefined) return yield* IdentityConflict.make();\n const linked = row.subjectId as NativeId;\n\n if (!mapping.subjectId.equals(linked, nativeId)) return yield* IdentityConflict.make();\n }, mapUnavailable);\n\n return { externalIdentityMutation: ExternalIdentityMutation.of({ bind }) } as const;\n});\n\nexport const makeD1IdentityServices = Effect.fnUntraced(function* <\n Subject extends AnySQLiteTable,\n Identifier extends AnySQLiteTable,\n External extends AnySQLiteTable,\n Request extends AnySQLiteTable,\n NativeId,\n>(mapping: D1GeneratedIdentityMapping<Subject, Identifier, External, Request, NativeId>) {\n return {\n ...(yield* makeD1SubjectProvisioningServices(mapping)),\n ...(yield* makeD1ExternalIdentityServices(mapping)),\n };\n});\n"],"mappings":";;;;;;;;;;AAyCA,MAAM,oBAAoB,oBAAoB,KAAK;AACnD,MAAM,oBAAoB,OAAO,GAAG,OAAO,MAAM,CAAC,kBAAkB,mBAAmB,CAAC,CAAC;AAEzF,MAAM,kBAA2B,WAC/B,yBAAyB,QAAQ,iBAAiB,CAAC,CAAC,KAClD,OAAO,YAAY,UACjB,OAAO,UACL,MAAM,IAAI,QAAQ,UAAW,kBAAkB,KAAK,IAAI,QAAQ,YAAY,CAAE,CAChF,CACF,CACF;AAEF,MAAM,gBACJ,OACA,WAC4B;CAC5B,MAAM,UAAU,gBAAgB,KAAK;CAErC,MAAM,SAAS,OAAO,YACpB,OAAO,QAAQ,MAAM,CAAC,CACnB,QAAQ,GAAG,WAAW,UAAU,KAAA,CAAS,CAAC,CAC1C,KAA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OAAO,OAAO,iBAAiB,KAAK;CACvF,GAAG,cAAc;CAEjB,OAAO,EAAE,0BAA0B,yBAAyB,GAAG,EAAE,KAAK,CAAC,EAAE;AAC3E,CAAC;AAED,MAAa,yBAAyB,OAAO,WAAW,WAMtD,SAAuF;CACvF,OAAO;EACL,GAAI,OAAO,kCAAkC,OAAO;EACpD,GAAI,OAAO,+BAA+B,OAAO;CACnD;AACF,CAAC"}
1
+ {"version":3,"file":"d1-identity.mjs","names":["DatabaseService"],"sources":["../../src/drizzle/d1-identity.ts"],"sourcesContent":["import type { D1Client } from \"@effect/sql-d1/D1Client\";\nimport { withStorageValidation, NativeDatabase } from \"@yielded/auth-persistence/Adapter\";\nimport {\n ExternalIdentityMutation,\n type ExternalIdentity,\n IdentityConflict,\n IdentityUnavailable,\n SubjectProvisioned,\n SubjectProvisioner,\n type SubjectProvisioningInput,\n} from \"@yielded/auth/Identity\";\nimport { reportPersistenceFailure } from \"@yielded/auth/Persistence\";\nimport type { SubjectId } from \"@yielded/auth/Schema\";\n/* oxlint-disable no-explicit-any -- D1 batch bridges Drizzle SQL objects to Effect SQL Statements at this adapter boundary. */\nimport {\n and,\n eq,\n getTableColumns,\n is,\n sql,\n SQL,\n type InferInsertModel,\n type Table,\n} from \"drizzle-orm\";\nimport type { EffectSQLiteD1Database } from \"drizzle-orm/effect-d1\";\nimport type { AnySQLiteTable, SQLiteColumn } from \"drizzle-orm/sqlite-core\";\nimport { Cause, Effect, Schema } from \"effect\";\n\nimport { Database as DatabaseService } from \"./d1-database\";\nimport {\n column,\n isMappedConstraintConflict,\n provisioningFingerprint,\n type D1ExternalIdentityMapping,\n type D1GeneratedIdentityMapping,\n type D1SubjectProvisioningMapping,\n} from \"./model\";\nimport { nativeDatabase } from \"./native-database\";\nimport { validateDrizzleStorage } from \"./storage-validation\";\n\ntype RuntimeDatabase = EffectSQLiteD1Database<any> & { readonly $client: D1Client };\nconst unavailable = () => IdentityUnavailable.make();\nconst isIdentityFailure = Schema.is(Schema.Union([IdentityConflict, IdentityUnavailable]));\n\nconst mapUnavailable = <A, E, R>(effect: Effect.Effect<A, E, R>) =>\n reportPersistenceFailure(effect, isIdentityFailure).pipe(\n Effect.catchCause((cause) =>\n Effect.failCause(\n Cause.map(cause, (error) => (isIdentityFailure(error) ? error : unavailable())),\n ),\n ),\n );\n\nconst selectFields = <T extends Table>(\n table: T,\n values: InferInsertModel<T>,\n): Record<string, unknown> => {\n const columns = getTableColumns(table) as Record<string, SQLiteColumn>;\n\n const fields = Object.fromEntries(\n Object.entries(values)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [\n key,\n is(value, SQL) ? value : sql`${sql.param(value, columns[key] as SQLiteColumn)}`,\n ]),\n );\n\n for (const [key, mapped] of Object.entries(columns)) {\n if (\n fields[key] !== undefined ||\n (\n mapped as SQLiteColumn & { readonly shouldDisableInsert: () => boolean }\n ).shouldDisableInsert()\n )\n continue;\n if (mapped.default !== null && mapped.default !== undefined) continue;\n\n const value =\n mapped.defaultFn !== undefined\n ? mapped.defaultFn()\n : !mapped.default && mapped.onUpdateFn !== undefined\n ? mapped.onUpdateFn()\n : undefined;\n\n if (value !== undefined || mapped.defaultFn !== undefined || mapped.onUpdateFn !== undefined)\n fields[key] = is(value, SQL) ? value : sql`${sql.param(value, mapped)}`;\n }\n\n return fields;\n};\n\n/**\n * D1 provisioning is an ordered atomic batch. The receipt captures the\n * database-generated subject id from the first insert via last_insert_rowid;\n * the optional identifier then reads that stable id from the receipt.\n */\nexport const makeD1SubjectProvisioningServices = Effect.fnUntraced(function* <\n Subject extends AnySQLiteTable,\n Identifier extends AnySQLiteTable,\n Request extends AnySQLiteTable,\n NativeId,\n>(mapping: D1SubjectProvisioningMapping<Subject, Identifier, Request, NativeId>) {\n const database = yield* DatabaseService;\n\n yield* validateDrizzleStorage(mapping).pipe(\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(DatabaseService)),\n Effect.mapError(() => IdentityUnavailable.make()),\n );\n\n const db = database as RuntimeDatabase;\n const requestTable = mapping.provisioningRequest.table;\n\n const requestIdColumn = column(\n requestTable,\n mapping.provisioningRequest.requestId,\n ) as SQLiteColumn;\n\n const requestFingerprintColumn = column(\n requestTable,\n mapping.provisioningRequest.fingerprint,\n ) as SQLiteColumn;\n\n const requestSubjectColumn = column(\n requestTable,\n mapping.provisioningRequest.subjectId,\n ) as SQLiteColumn;\n\n const findReceipt = Effect.fn(\"DrizzleD1Identity.findReceipt\")(function* (requestId: string) {\n const rows = yield* db\n .select({ fingerprint: requestFingerprintColumn, subjectId: requestSubjectColumn })\n .from(requestTable as any)\n .where(eq(requestIdColumn, requestId))\n .limit(1);\n\n return rows[0];\n });\n\n const provision = Effect.fn(\"DrizzleD1Identity.provision\")(function* (\n input: SubjectProvisioningInput,\n ) {\n const fingerprint = provisioningFingerprint(input);\n const existing = yield* findReceipt(input.requestId);\n\n if (existing !== undefined) {\n if (existing.fingerprint !== fingerprint) return yield* IdentityConflict.make();\n const subjectId = yield* mapping.subjectId.toSubject(existing.subjectId as NativeId);\n\n return SubjectProvisioned.make({ subjectId });\n }\n\n const allocated =\n mapping.subject.allocateId === undefined\n ? mapping.subject.allocateIdSync?.()\n : yield* mapping.subject.allocateId;\n\n const subjectQuery = db\n .insert(mapping.subject.table as any)\n .values(mapping.subject.encodeInsert(input, allocated) as any)\n .toSQL();\n\n const statements = [db.$client.unsafe(subjectQuery.sql, subjectQuery.params)];\n\n if (allocated !== undefined) {\n const requestQuery = db\n .insert(requestTable as any)\n .values(\n mapping.provisioningRequest.encodeInsert(input.requestId, fingerprint, allocated) as any,\n )\n .toSQL();\n\n statements.push(db.$client.unsafe(requestQuery.sql, requestQuery.params));\n\n if (input.identifier !== undefined) {\n const identifierQuery = db\n .insert(mapping.identifier.table as any)\n .values(\n mapping.identifier.encodeInsert(input.identifier, allocated, input.verifiedAt) as any,\n )\n .toSQL();\n\n statements.push(db.$client.unsafe(identifierQuery.sql, identifierQuery.params));\n }\n } else {\n if (mapping.d1.generatedRowIdAlias === undefined) return yield* unavailable();\n\n const mappedColumnNames = Object.values(getTableColumns(mapping.subject.table)).map((value) =>\n value.name.toLowerCase(),\n );\n\n if (mappedColumnNames.includes(mapping.d1.generatedRowIdAlias.toLowerCase()))\n return yield* unavailable();\n const subjectIdColumn = column(mapping.subject.table, mapping.subject.id);\n const rowId = sql.identifier(mapping.d1.generatedRowIdAlias);\n\n const requestQuery = db\n .insert(requestTable as any)\n .values({\n ...mapping.d1.requestInsertWithoutSubject(input.requestId, fingerprint),\n [mapping.provisioningRequest.subjectId]:\n sql`(select ${subjectIdColumn} from ${mapping.subject.table} where ${rowId} = last_insert_rowid())`,\n } as any)\n .toSQL();\n\n statements.push(db.$client.unsafe(requestQuery.sql, requestQuery.params));\n }\n\n if (allocated === undefined && input.identifier !== undefined) {\n const requestIdParam = sql.param(input.requestId, requestIdColumn);\n\n const identifierQuery = db\n .insert(mapping.identifier.table as any)\n .values({\n ...mapping.d1.identifierInsertWithoutSubject(input.identifier, input.verifiedAt),\n [mapping.identifier.subjectId]:\n sql`(select ${requestSubjectColumn} from ${requestTable} where ${requestIdColumn} = ${requestIdParam})`,\n } as any)\n .toSQL();\n\n statements.push(db.$client.unsafe(identifierQuery.sql, identifierQuery.params));\n }\n const attempt = db.$client.batch(statements);\n\n yield* attempt.pipe(\n Effect.catchCause(\n (\n cause,\n ): Effect.Effect<\n void,\n | Effect.Error<typeof attempt>\n | Effect.Error<ReturnType<typeof findReceipt>>\n | IdentityConflict\n > => {\n if (\n cause.reasons.length === 0 ||\n !cause.reasons.every(\n (reason) =>\n Cause.isFailReason(reason) &&\n isMappedConstraintConflict(mapping.isConstraintConflict, reason.error),\n )\n )\n return Effect.failCause(cause);\n\n return findReceipt(input.requestId).pipe(\n Effect.flatMap((receipt) =>\n receipt !== undefined && receipt.fingerprint === fingerprint\n ? Effect.void\n : IdentityConflict.make(),\n ),\n );\n },\n ),\n );\n const receipt = yield* findReceipt(input.requestId);\n\n if (receipt === undefined || receipt.fingerprint !== fingerprint)\n return yield* IdentityConflict.make();\n const subjectId = yield* mapping.subjectId.toSubject(receipt.subjectId as NativeId);\n\n return SubjectProvisioned.make({ subjectId });\n }, mapUnavailable);\n\n return { subjectProvisioner: SubjectProvisioner.of({ provision }) } as const;\n});\n\nexport const makeD1ExternalIdentityServices = Effect.fnUntraced(function* <\n Subject extends AnySQLiteTable,\n External extends AnySQLiteTable,\n NativeId,\n>(mapping: D1ExternalIdentityMapping<Subject, External, NativeId>) {\n const database = yield* DatabaseService;\n\n yield* validateDrizzleStorage(mapping).pipe(\n Effect.provideServiceEffect(NativeDatabase, nativeDatabase(DatabaseService)),\n Effect.mapError(() => IdentityUnavailable.make()),\n );\n\n const db = database as RuntimeDatabase;\n const externalTable = mapping.externalIdentity.table;\n\n const externalSubjectIdColumn = column(\n externalTable,\n mapping.externalIdentity.subjectId,\n ) as SQLiteColumn;\n\n const externalProviderColumn = column(\n externalTable,\n mapping.externalIdentity.provider,\n ) as SQLiteColumn;\n\n const externalIssuerColumn = column(\n externalTable,\n mapping.externalIdentity.issuer,\n ) as SQLiteColumn;\n\n const externalSubjectColumn = column(\n externalTable,\n mapping.externalIdentity.subject,\n ) as SQLiteColumn;\n\n const bind = Effect.fn(\"DrizzleD1Identity.bindExternalIdentity\")(function* (\n subjectId: SubjectId,\n identity: ExternalIdentity,\n ) {\n const nativeId = yield* mapping.subjectId.toNative(subjectId);\n const subjectIdColumn = column(mapping.subject.table, mapping.subject.id);\n const subjectStatusColumn = column(mapping.subject.table, mapping.subject.status);\n const nativeIdParam = sql.param(nativeId, subjectIdColumn);\n const activeStatusParam = sql.param(mapping.d1.activeStatusValue, subjectStatusColumn);\n\n const selection = selectFields(\n externalTable,\n mapping.externalIdentity.encodeInsert(identity, nativeId),\n );\n\n selection[mapping.externalIdentity.subjectId] = subjectIdColumn;\n\n const inserted = yield* db\n .insert(externalTable as any)\n .select(\n db\n .select(selection as any)\n .from(mapping.subject.table as any)\n .where(\n and(eq(subjectIdColumn, nativeIdParam), eq(subjectStatusColumn, activeStatusParam)),\n ) as any,\n )\n .returning({ subjectId: externalSubjectIdColumn })\n .pipe(\n Effect.catchCause((cause) => {\n if (\n cause.reasons.length === 0 ||\n !cause.reasons.every(\n (reason) =>\n Cause.isFailReason(reason) &&\n isMappedConstraintConflict(mapping.isConstraintConflict, reason.error),\n )\n )\n return Effect.failCause(cause);\n\n return db\n .select({ subjectId: externalSubjectIdColumn })\n .from(externalTable as any)\n .innerJoin(\n mapping.subject.table as any,\n and(\n eq(externalSubjectIdColumn, subjectIdColumn),\n eq(subjectStatusColumn, mapping.d1.activeStatusValue),\n ),\n )\n .where(\n and(\n eq(externalProviderColumn, identity.provider),\n eq(externalIssuerColumn, identity.issuer),\n eq(externalSubjectColumn, identity.subject),\n eq(externalSubjectIdColumn, nativeId),\n ),\n )\n .limit(1);\n }),\n );\n\n const row = inserted[0];\n\n if (row === undefined) return yield* IdentityConflict.make();\n const linked = row.subjectId as NativeId;\n\n if (!mapping.subjectId.equals(linked, nativeId)) return yield* IdentityConflict.make();\n }, mapUnavailable);\n\n return { externalIdentityMutation: ExternalIdentityMutation.of({ bind }) } as const;\n});\n\nexport const makeD1IdentityServices = Effect.fnUntraced(function* <\n Subject extends AnySQLiteTable,\n Identifier extends AnySQLiteTable,\n External extends AnySQLiteTable,\n Request extends AnySQLiteTable,\n NativeId,\n>(mapping: D1GeneratedIdentityMapping<Subject, Identifier, External, Request, NativeId>) {\n return {\n ...(yield* makeD1SubjectProvisioningServices(mapping)),\n ...(yield* makeD1ExternalIdentityServices(mapping)),\n };\n}, withStorageValidation);\n"],"mappings":";;;;;;;;;;AAyCA,MAAM,oBAAoB,oBAAoB,KAAK;AACnD,MAAM,oBAAoB,OAAO,GAAG,OAAO,MAAM,CAAC,kBAAkB,mBAAmB,CAAC,CAAC;AAEzF,MAAM,kBAA2B,WAC/B,yBAAyB,QAAQ,iBAAiB,CAAC,CAAC,KAClD,OAAO,YAAY,UACjB,OAAO,UACL,MAAM,IAAI,QA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SAAS,OAAO,GAC1C,GAAG,yBAAyB,QAAQ,CACtC,CACF,CAAC,CACA,MAAM,CAAC;EACZ,CAAC,CACH,EAAA,CAEmB;EAErB,IAAI,QAAQ,KAAA,GAAW,OAAO,OAAO,iBAAiB,KAAK;EAC3D,MAAM,SAAS,IAAI;EAEnB,IAAI,CAAC,QAAQ,UAAU,OAAO,QAAQ,QAAQ,GAAG,OAAO,OAAO,iBAAiB,KAAK;CACvF,GAAG,cAAc;CAEjB,OAAO,EAAE,0BAA0B,yBAAyB,GAAG,EAAE,KAAK,CAAC,EAAE;AAC3E,CAAC;AAED,MAAa,yBAAyB,OAAO,WAAW,WAMtD,SAAuF;CACvF,OAAO;EACL,GAAI,OAAO,kCAAkC,OAAO;EACpD,GAAI,OAAO,+BAA+B,OAAO;CACnD;AACF,GAAG,qBAAqB"}
@@ -4,7 +4,7 @@ import { Database as Database$1 } from "./d1-database.mjs";
4
4
  import { D1BatchStatements } from "./D1BatchStatements.mjs";
5
5
  import { SuppliedService } from "./SuppliedService.mjs";
6
6
  import { AnyRelations } from "drizzle-orm";
7
- import { Effect } from "effect";
7
+ import { Crypto, Effect } from "effect";
8
8
  import { LifecycleHooks } from "@yielded/auth/Hooks";
9
9
  import { OAuthAccountsPersistence, OAuthRegistrationIntents, OAuthSignInPersistence, OAuthUnavailable } from "@yielded/auth/OAuth";
10
10
  import { EffectSQLiteD1Database } from "drizzle-orm/effect-d1";
@@ -163,10 +163,10 @@ export declare const makeD1OAuthAccountsServices: <S extends SQLiteTable, O exte
163
163
  readonly nowMillis: number;
164
164
  }, prepare: import("@yielded/auth/OAuth").PrepareOAuthCommit<{
165
165
  readonly _tag: "Rejected";
166
- } | {
167
- readonly _tag: "Cancelled";
168
166
  } | {
169
167
  readonly _tag: "Ambiguous";
168
+ } | {
169
+ readonly _tag: "Cancelled";
170
170
  } | {
171
171
  readonly _tag: "Linked";
172
172
  readonly credential: {
@@ -267,7 +267,7 @@ export declare const makeD1OAuthAccountsServices: <S extends SQLiteTable, O exte
267
267
  readonly hasMore: boolean;
268
268
  }, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, OAuthUnavailable>;
269
269
  };
270
- }, OAuthUnavailable, Database$1 | LifecycleHooks>;
270
+ }, OAuthUnavailable, Crypto.Crypto | Database$1 | LifecycleHooks>;
271
271
  export declare const makeD1OAuthSignInServices: <S extends SQLiteTable, O extends SQLiteTable, C extends SQLiteTable, AC extends SQLiteTable, F extends SQLiteTable, N>(mapping: OAuthSignInMapping<S, O, C, AC, F, N> & OAuthD1Mapping) => Effect.Effect<{
272
272
  oauthSignInPersistence: {
273
273
  readonly issue: <A>(input: import("@yielded/auth/OAuth").OAuthPendingFlow, prepare: import("@yielded/auth/OAuth").PrepareOAuthCommit<import("@yielded/auth/OAuth").OAuthIssueDecision, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, OAuthUnavailable>;
@@ -300,7 +300,7 @@ export declare const makeD1OAuthSignInServices: <S extends SQLiteTable, O extend
300
300
  readonly hasMore: boolean;
301
301
  }, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, OAuthUnavailable>;
302
302
  };
303
- }, OAuthUnavailable, Database$1 | LifecycleHooks>;
303
+ }, OAuthUnavailable, Crypto.Crypto | Database$1 | LifecycleHooks>;
304
304
  export declare const makeD1OAuthRegistrationIntentServices: <S extends SQLiteTable, O extends SQLiteTable, C extends SQLiteTable, AC extends SQLiteTable, F extends SQLiteTable, T extends SQLiteTable, I extends SQLiteTable, N>(mapping: OAuthRegistrationIntentMapping<S, O, C, AC, F, T, I, N> & OAuthD1Mapping) => Effect.Effect<{
305
305
  oauthRegistrationIntents: {
306
306
  readonly settle: <A>(input: {
@@ -310,22 +310,22 @@ export declare const makeD1OAuthRegistrationIntentServices: <S extends SQLiteTab
310
310
  readonly nowMillis: number;
311
311
  }, prepare: import("@yielded/auth/OAuth").PrepareOAuthCommit<import("@yielded/auth/OAuth").OAuthRegistrationSettlement, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, OAuthUnavailable>;
312
312
  };
313
- }, OAuthUnavailable, Database$1 | LifecycleHooks>;
313
+ }, OAuthUnavailable, Crypto.Crypto | Database$1 | LifecycleHooks>;
314
314
  export declare const makeD1OAuthRegistrationServices: <Registration, S extends SQLiteTable, O extends SQLiteTable, C extends SQLiteTable, AC extends SQLiteTable, T extends SQLiteTable, I extends SQLiteTable, R extends SQLiteTable, N>(mapping: OAuthRegistrationMapping<Registration, S, O, C, AC, T, I, R, N> & OAuthD1Mapping) => Effect.Effect<{
315
315
  registrationAuthority: OAuthRegistrationAuthority<Registration>;
316
- }, OAuthUnavailable, Database$1 | LifecycleHooks>;
316
+ }, OAuthUnavailable, Crypto.Crypto | Database$1 | LifecycleHooks>;
317
317
  export declare function coordinateD1OAuthSignIn<S extends SQLiteTable, O extends SQLiteTable, C extends SQLiteTable, AC extends SQLiteTable, F extends SQLiteTable, N, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
318
318
  readonly mapping: OAuthSignInMapping<S, O, C, AC, F, N> & OAuthD1Mapping;
319
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, OAuthCoordinatorError<E> | DatabaseError, Exclude<R, OAuthSignInPersistence | D1BatchStatements> | LifecycleHooks | DatabaseRequirements>;
319
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, OAuthCoordinatorError<E> | DatabaseError, Exclude<R, OAuthSignInPersistence | D1BatchStatements> | Crypto.Crypto | LifecycleHooks | DatabaseRequirements>;
320
320
  export declare function coordinateD1OAuthRegistrationIntents<S extends SQLiteTable, O extends SQLiteTable, C extends SQLiteTable, AC extends SQLiteTable, F extends SQLiteTable, T extends SQLiteTable, I extends SQLiteTable, N, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
321
321
  readonly mapping: OAuthRegistrationIntentMapping<S, O, C, AC, F, T, I, N> & OAuthD1Mapping;
322
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, OAuthCoordinatorError<E> | DatabaseError, Exclude<R, OAuthRegistrationIntents | D1BatchStatements> | LifecycleHooks | DatabaseRequirements>;
322
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, OAuthCoordinatorError<E> | DatabaseError, Exclude<R, OAuthRegistrationIntents | D1BatchStatements> | Crypto.Crypto | LifecycleHooks | DatabaseRequirements>;
323
323
  export declare function coordinateD1OAuthAccounts<S extends SQLiteTable, O extends SQLiteTable, C extends SQLiteTable, AC extends SQLiteTable, F extends SQLiteTable, T extends SQLiteTable, U extends SQLiteTable, N, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
324
324
  readonly mapping: OAuthAccountsMapping<S, O, C, AC, F, T, U, N> & OAuthD1Mapping;
325
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, OAuthCoordinatorError<E> | DatabaseError, Exclude<R, OAuthAccountsPersistence | D1BatchStatements> | LifecycleHooks | DatabaseRequirements>;
325
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, OAuthCoordinatorError<E> | DatabaseError, Exclude<R, OAuthAccountsPersistence | D1BatchStatements> | Crypto.Crypto | LifecycleHooks | DatabaseRequirements>;
326
326
  export declare function coordinateD1OAuthRegistration<TargetId, Registration, S extends SQLiteTable, O extends SQLiteTable, C extends SQLiteTable, AC extends SQLiteTable, T extends SQLiteTable, I extends SQLiteTable, Rq extends SQLiteTable, N, A, E, R, DatabaseError, DatabaseRequirements>(acquire: Effect.Effect<Database, DatabaseError, DatabaseRequirements>, options: {
327
327
  readonly mapping: OAuthRegistrationMapping<NoInfer<Registration>, S, O, C, AC, T, I, Rq, N> & OAuthD1Mapping;
328
328
  readonly target: SuppliedService<TargetId, OAuthRegistrationAuthority<Registration>>;
329
- }, body: Effect.Effect<A, E, R>): Effect.Effect<A, OAuthCoordinatorError<E> | DatabaseError, Exclude<R, TargetId | D1BatchStatements> | LifecycleHooks | DatabaseRequirements>;
329
+ }, body: Effect.Effect<A, E, R>): Effect.Effect<A, OAuthCoordinatorError<E> | DatabaseError, Exclude<R, TargetId | D1BatchStatements> | Crypto.Crypto | LifecycleHooks | DatabaseRequirements>;
330
330
  //#endregion
331
331
  //# sourceMappingURL=d1-oauth.d.mts.map