@yielded/auth-persistence 0.1.0-beta.7 → 0.1.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +9 -0
  2. package/dist/DrizzleD1.d.mts +9 -9
  3. package/dist/DrizzleLibsql.d.mts +25 -25
  4. package/dist/DrizzleLibsql.mjs +7 -22
  5. package/dist/DrizzleLibsql.mjs.map +1 -1
  6. package/dist/DrizzleMysql2.d.mts +15 -15
  7. package/dist/DrizzlePglite.d.mts +9 -9
  8. package/dist/DrizzlePostgres.d.mts +15 -15
  9. package/dist/DrizzleSqliteBun.d.mts +18 -18
  10. package/dist/DrizzleSqliteDo.d.mts +29 -29
  11. package/dist/DrizzleSqliteNode.d.mts +24 -24
  12. package/dist/DrizzleSqliteWasm.d.mts +24 -24
  13. package/dist/_virtual/_rolldown/runtime.mjs +13 -0
  14. package/dist/drizzle/D1BatchStatements.d.mts +1 -2
  15. package/dist/drizzle/SuppliedService.d.mts +1 -2
  16. package/dist/drizzle/d1-emails.d.mts +5 -6
  17. package/dist/drizzle/d1-identity.d.mts +2 -3
  18. package/dist/drizzle/d1-oauth.d.mts +10 -11
  19. package/dist/drizzle/d1-passkey.d.mts +5 -6
  20. package/dist/drizzle/d1-password-prepared.d.mts +2 -3
  21. package/dist/drizzle/d1-passwords.d.mts +4 -5
  22. package/dist/drizzle/d1-phone.d.mts +2 -3
  23. package/dist/drizzle/d1-planning.d.mts +1 -2
  24. package/dist/drizzle/d1-proofs.d.mts +2 -3
  25. package/dist/drizzle/d1-sessions.d.mts +10 -11
  26. package/dist/drizzle/d1-totp.d.mts +2 -3
  27. package/dist/drizzle/email-model.d.mts +30 -31
  28. package/dist/drizzle/email-registration.d.mts +1 -2
  29. package/dist/drizzle/email-target.d.mts +3 -4
  30. package/dist/drizzle/model.d.mts +42 -42
  31. package/dist/drizzle/model.mjs +4 -6
  32. package/dist/drizzle/model.mjs.map +1 -1
  33. package/dist/drizzle/mysql-emails.d.mts +7 -8
  34. package/dist/drizzle/mysql-identity.d.mts +2 -3
  35. package/dist/drizzle/mysql-password-prepared.d.mts +3 -4
  36. package/dist/drizzle/mysql-passwords.d.mts +6 -7
  37. package/dist/drizzle/mysql-proofs.d.mts +3 -4
  38. package/dist/drizzle/mysql-sessions.d.mts +15 -16
  39. package/dist/drizzle/mysql.d.mts +9 -10
  40. package/dist/drizzle/mysql.mjs +1 -1
  41. package/dist/drizzle/oauth-connected-model.d.mts +21 -22
  42. package/dist/drizzle/oauth-connected-reference.d.mts +1 -2
  43. package/dist/drizzle/oauth-connected-state.d.mts +1950 -7
  44. package/dist/drizzle/oauth-connected-target.d.mts +9 -10
  45. package/dist/drizzle/oauth-flow.d.mts +22 -2
  46. package/dist/drizzle/oauth-model.d.mts +45 -46
  47. package/dist/drizzle/oauth-owner.d.mts +10 -2
  48. package/dist/drizzle/oauth-target.d.mts +9 -10
  49. package/dist/drizzle/passkey-model.d.mts +34 -35
  50. package/dist/drizzle/passkey-registration-ceremony-model.d.mts +5 -6
  51. package/dist/drizzle/passkey-write-model.d.mts +13 -14
  52. package/dist/drizzle/password-model.d.mts +29 -30
  53. package/dist/drizzle/password-prepared-model.d.mts +10 -11
  54. package/dist/drizzle/password-prepared-target.d.mts +1 -2
  55. package/dist/drizzle/password-registration.d.mts +1 -2
  56. package/dist/drizzle/password-target.d.mts +2 -3
  57. package/dist/drizzle/pg-emails.d.mts +7 -8
  58. package/dist/drizzle/pg-password-prepared.d.mts +3 -4
  59. package/dist/drizzle/pg-passwords.d.mts +6 -7
  60. package/dist/drizzle/pg-proofs.d.mts +3 -4
  61. package/dist/drizzle/pg-sessions.d.mts +15 -16
  62. package/dist/drizzle/pg.d.mts +11 -12
  63. package/dist/drizzle/pg.mjs +1 -1
  64. package/dist/drizzle/phone-model.d.mts +9 -10
  65. package/dist/drizzle/phone-target.d.mts +1 -2
  66. package/dist/drizzle/proof-model.d.mts +25 -26
  67. package/dist/drizzle/proof-target.d.mts +1 -2
  68. package/dist/drizzle/session-model.d.mts +25 -26
  69. package/dist/drizzle/session-target.d.mts +4 -5
  70. package/dist/drizzle/sqlite.d.mts +9 -10
  71. package/dist/drizzle/sqlite.mjs +1 -1
  72. package/dist/drizzle/standalone-guard.mjs +3 -5
  73. package/dist/drizzle/standalone-guard.mjs.map +1 -1
  74. package/dist/drizzle/step-up-model.d.mts +6 -7
  75. package/dist/drizzle/totp-model.d.mts +7 -8
  76. package/dist/drizzle/totp-state.d.mts +2 -3
  77. package/dist/drizzle/totp-target.d.mts +1 -2
  78. package/dist/drizzle/transaction-mysql.mjs +1 -0
  79. package/dist/drizzle/transaction-mysql.mjs.map +1 -1
  80. package/dist/drizzle/transaction-owner.d.mts +3 -2
  81. package/dist/index.d.mts +3 -1
  82. package/dist/index.mjs +3 -1
  83. package/dist/internal/configuration.d.mts +19 -19
  84. package/dist/internal/mapping-error.d.mts +2 -3
  85. package/dist/internal/oauth-app.d.mts +11 -0
  86. package/dist/internal/oauth-app.mjs +57 -0
  87. package/dist/internal/oauth-app.mjs.map +1 -0
  88. package/dist/internal/oauth-server.d.mts +10 -0
  89. package/dist/internal/oauth-server.mjs +66 -0
  90. package/dist/internal/oauth-server.mjs.map +1 -0
  91. package/dist/internal/passkey/target.d.mts +2 -3
  92. package/dist/internal/passkeys.mjs +2 -1
  93. package/dist/internal/passkeys.mjs.map +1 -1
  94. package/dist/internal/persistence.mjs +3 -2
  95. package/dist/internal/persistence.mjs.map +1 -1
  96. package/dist/internal/sql-persistence.d.mts +1 -2
  97. package/dist/internal/sql-table.d.mts +6 -7
  98. package/dist/internal/sql-table.mjs +12 -2
  99. package/dist/internal/sql-table.mjs.map +1 -1
  100. package/dist/internal/standalone.mjs +13 -0
  101. package/dist/internal/standalone.mjs.map +1 -0
  102. package/dist/internal/storage-tables.d.mts +5 -6
  103. package/dist/internal/transaction-execution-kernel.d.mts +2 -3
  104. package/dist/internal/transaction-execution-kernel.mjs +3 -5
  105. package/dist/internal/transaction-execution-kernel.mjs.map +1 -1
  106. package/dist/internal/transaction-kernel.d.mts +49 -2
  107. package/package.json +1 -1
  108. package/src/DrizzleLibsql.ts +10 -54
  109. package/src/drizzle/model.ts +8 -10
  110. package/src/drizzle/standalone-guard.ts +4 -9
  111. package/src/drizzle/transaction-mysql.ts +2 -0
  112. package/src/index.ts +2 -0
  113. package/src/internal/oauth-app.ts +82 -0
  114. package/src/internal/oauth-server.ts +89 -0
  115. package/src/internal/passkeys.ts +2 -6
  116. package/src/internal/persistence.ts +3 -5
  117. package/src/internal/sql-table.ts +17 -2
  118. package/src/internal/standalone.ts +30 -0
  119. package/src/internal/transaction-execution-kernel.ts +3 -7
@@ -1,12 +1,12 @@
1
1
  import { OAuthTargetConfiguration } from "./oauth-target.mjs";
2
- import { Mapping, Revocations } from "./oauth-connected-state.mjs";
2
+ import { Mapping, Revocations, oauth_connected_state_d_exports } from "./oauth-connected-state.mjs";
3
3
  import { Effect, Layer, Schema } from "effect";
4
4
  import { LifecycleHooks } from "@yielded/auth/Hooks";
5
5
  import * as M from "@yielded/auth/OAuth";
6
6
  import { OAuthConnectedPersistence, OAuthConnectedRevocationDecision, OAuthConnectedRevocations, OAuthExternalIdentity, PrepareOAuthCommit } from "@yielded/auth/OAuth";
7
7
  import { Statement } from "effect/unstable/sql/Statement";
8
8
  //#region src/drizzle/oauth-connected-target.d.ts
9
- declare const makeTargetOAuthConnectedServices: (database: any, mapping: Mapping, configuration: OAuthTargetConfiguration) => Effect.Effect<{
9
+ export declare const makeTargetOAuthConnectedServices: (database: any, mapping: Mapping, configuration: OAuthTargetConfiguration) => Effect.Effect<{
10
10
  oauthConnectedPersistence: {
11
11
  readonly capture: (input: {
12
12
  readonly moduleId: string & import("effect/Brand").Brand<"effect-auth/OAuthModuleId">;
@@ -226,14 +226,14 @@ declare const makeTargetOAuthConnectedServices: (database: any, mapping: Mapping
226
226
  readonly identity: typeof OAuthExternalIdentity.Type;
227
227
  }) => Effect.Effect<{
228
228
  readonly _tag: "Rejected";
229
+ } | {
230
+ readonly _tag: "Conflict";
229
231
  } | {
230
232
  readonly _tag: "Target";
231
233
  readonly cohortGeneration: string & import("effect/Brand").Brand<"effect-auth/SecurityRevision">;
232
234
  } | {
233
235
  readonly _tag: "Quarantine";
234
236
  readonly cohortGeneration: string & import("effect/Brand").Brand<"effect-auth/SecurityRevision">;
235
- } | {
236
- readonly _tag: "Conflict";
237
237
  }, M.OAuthUnavailable>;
238
238
  readonly settle: <A>(input: {
239
239
  readonly claim: M.OAuthConnectedClaim;
@@ -242,12 +242,12 @@ declare const makeTargetOAuthConnectedServices: (database: any, mapping: Mapping
242
242
  readonly nowMillis: number;
243
243
  }, prepare: PrepareOAuthCommit<{
244
244
  readonly _tag: "Rejected";
245
- } | {
246
- readonly _tag: "Conflict";
247
245
  } | {
248
246
  readonly _tag: "Cancelled";
249
247
  } | {
250
248
  readonly _tag: "Ambiguous";
249
+ } | {
250
+ readonly _tag: "Conflict";
251
251
  } | {
252
252
  readonly _tag: "Connected";
253
253
  readonly grant: {
@@ -731,7 +731,7 @@ declare const makeTargetOAuthConnectedServices: (database: any, mapping: Mapping
731
731
  }, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, M.OAuthUnavailable, never>;
732
732
  };
733
733
  }, never, LifecycleHooks>;
734
- declare const makeTargetOAuthConnectedRevocationServices: (database: any, mapping: Revocations, configuration: OAuthTargetConfiguration) => Effect.Effect<{
734
+ export declare const makeTargetOAuthConnectedRevocationServices: (database: any, mapping: Revocations, configuration: OAuthTargetConfiguration) => Effect.Effect<{
735
735
  oauthConnectedRevocations: {
736
736
  readonly claim: <A>(input: {
737
737
  readonly moduleId: string & import("effect/Brand").Brand<"effect-auth/OAuthModuleId">;
@@ -746,8 +746,7 @@ declare const makeTargetOAuthConnectedRevocationServices: (database: any, mappin
746
746
  }, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, M.OAuthUnavailable>;
747
747
  };
748
748
  }, never, LifecycleHooks>;
749
- declare const oauthConnectedPersistenceLayer: (services: ReturnType<typeof makeTargetOAuthConnectedServices>) => Layer.Layer<OAuthConnectedPersistence, never, LifecycleHooks>;
750
- declare const oauthConnectedRevocationsLayer: (services: ReturnType<typeof makeTargetOAuthConnectedRevocationServices>) => Layer.Layer<OAuthConnectedRevocations, never, LifecycleHooks>;
749
+ export declare const oauthConnectedPersistenceLayer: (services: ReturnType<typeof makeTargetOAuthConnectedServices>) => Layer.Layer<OAuthConnectedPersistence, never, LifecycleHooks>;
750
+ export declare const oauthConnectedRevocationsLayer: (services: ReturnType<typeof makeTargetOAuthConnectedRevocationServices>) => Layer.Layer<OAuthConnectedRevocations, never, LifecycleHooks>;
751
751
  //#endregion
752
- export { makeTargetOAuthConnectedRevocationServices, makeTargetOAuthConnectedServices, oauthConnectedPersistenceLayer, oauthConnectedRevocationsLayer };
753
752
  //# sourceMappingURL=oauth-connected-target.d.mts.map
@@ -1,5 +1,25 @@
1
+ import { PersistenceMappingError } from "../internal/mapping-error.mjs";
1
2
  import "./model.mjs";
3
+ import { Observation, Row } from "../internal/transaction-kernel.mjs";
2
4
  import "./transaction-owner.mjs";
3
- import "./oauth-owner.mjs";
5
+ import { CurrentOAuthTransaction } from "./oauth-owner.mjs";
4
6
  import { Effect } from "effect";
5
- import { OAuthClaim, OAuthCleanupInput, OAuthLinkClaim, OAuthLinkPendingFlow, OAuthPendingFlow, OAuthVerifiedExternalIdentity } from "@yielded/auth/OAuth";
7
+ import { OAuthClaim, OAuthCleanupInput, OAuthLinkClaim, OAuthLinkPendingFlow, OAuthPendingFlow, OAuthVerifiedExternalIdentity } from "@yielded/auth/OAuth";
8
+ //#region src/drizzle/oauth-flow.d.ts
9
+ /** Subject precedes credentials; the complete active credential vector is retained. */
10
+ export declare const currentSubject: (mapping: any, nativeId: unknown) => Effect.Effect<{
11
+ subject: Observation;
12
+ row: Row;
13
+ authorities: Observation;
14
+ revision: {
15
+ readonly subjectId: string & import("effect/Brand").Brand<"effect-auth/SubjectId">;
16
+ readonly securityRevision: string & import("effect/Brand").Brand<"effect-auth/SecurityRevision">;
17
+ readonly credentials: readonly {
18
+ readonly credentialId: string;
19
+ readonly revision: string & import("effect/Brand").Brand<"effect-auth/SecurityRevision">;
20
+ }[];
21
+ };
22
+ nativeId: unknown;
23
+ } | undefined, import("@yielded/auth/OAuth").OAuthUnavailable | PersistenceMappingError, CurrentOAuthTransaction>;
24
+ //#endregion
25
+ //# sourceMappingURL=oauth-flow.d.mts.map
@@ -7,13 +7,13 @@ import { InferInsertModel, InferSelectModel, SQL, Table } from "drizzle-orm";
7
7
  import { AuthenticationFactor } from "@yielded/auth/Operations";
8
8
  //#region src/drizzle/oauth-model.d.ts
9
9
  type Column<T extends Table> = Extract<keyof T["_"]["columns"], string>;
10
- type OAuthFlowState = "Pending" | "Claimed" | "Verified" | "RegistrationIssued" | "Linked" | "Cancelled" | "Rejected" | "Ambiguous" | "Conflict";
11
- type OAuthTupleState = "Unowned" | "Reserved" | "Owned";
12
- type OAuthRegistrationState = "Unbound" | "Registered" | "ProvisioningPending" | "Rejected";
13
- type OAuthAction = OAuthActionAuthorization["challenge"]["action"];
10
+ export type OAuthFlowState = "Pending" | "Claimed" | "Verified" | "RegistrationIssued" | "Linked" | "Cancelled" | "Rejected" | "Ambiguous" | "Conflict";
11
+ export type OAuthTupleState = "Unowned" | "Reserved" | "Owned";
12
+ export type OAuthRegistrationState = "Unbound" | "Registered" | "ProvisioningPending" | "Rejected";
13
+ export type OAuthAction = OAuthActionAuthorization["challenge"]["action"];
14
14
  /** The engine writes every critical column explicitly after applying the pure
15
15
  * consumer encoder. Native instant values must roundtrip without precision loss. */
16
- interface OAuthClock {
16
+ export interface OAuthClock {
17
17
  readonly encodeInstant: (millis: number) => unknown;
18
18
  readonly decodeInstant: (value: unknown) => number;
19
19
  /** Actual engine wall clock sampled after locks, not transaction-start time.
@@ -21,7 +21,7 @@ interface OAuthClock {
21
21
  * its primary-engine sample bounds in final guards. Return integer milliseconds. */
22
22
  readonly engineNowMillis: SQL;
23
23
  }
24
- interface OAuthSubjectReadTable<S extends Table> {
24
+ export interface OAuthSubjectReadTable<S extends Table> {
25
25
  readonly table: S;
26
26
  readonly id: Column<S>;
27
27
  readonly status: Column<S>;
@@ -29,12 +29,12 @@ interface OAuthSubjectReadTable<S extends Table> {
29
29
  readonly isActiveStatus: (value: unknown) => boolean;
30
30
  readonly activeCondition: SQL;
31
31
  }
32
- interface OAuthSubjectTable<S extends Table> extends OAuthSubjectReadTable<S> {
32
+ export interface OAuthSubjectTable<S extends Table> extends OAuthSubjectReadTable<S> {
33
33
  readonly decodeActionRequirement: (row: InferSelectModel<S>, action: OAuthAction) => AuthenticationRequirement;
34
34
  readonly decodeAuthenticationRequirement: (row: InferSelectModel<S>) => AuthenticationRequirement;
35
35
  readonly nextSecurityRevision: (current: SecurityRevision) => SecurityRevision;
36
36
  }
37
- interface OAuthOwnershipReadTable<O extends Table, N> {
37
+ export interface OAuthOwnershipReadTable<O extends Table, N> {
38
38
  readonly table: O;
39
39
  readonly identityKey: Column<O>;
40
40
  readonly provider: Column<O>;
@@ -45,14 +45,14 @@ interface OAuthOwnershipReadTable<O extends Table, N> {
45
45
  readonly ownedCondition: SQL;
46
46
  readonly decodeSubjectId: (row: InferSelectModel<O>) => N;
47
47
  }
48
- interface OAuthOwnershipTable<O extends Table, N> extends OAuthOwnershipReadTable<O, N> {
48
+ export interface OAuthOwnershipTable<O extends Table, N> extends OAuthOwnershipReadTable<O, N> {
49
49
  readonly encodeInsert: (input: {
50
50
  readonly identity: typeof OAuthExternalIdentity.Type;
51
51
  readonly identityKey: string;
52
52
  readonly subjectId: N;
53
53
  }) => InferInsertModel<O>;
54
54
  }
55
- interface OAuthCredentialReadTable<C extends Table> {
55
+ export interface OAuthCredentialReadTable<C extends Table> {
56
56
  readonly table: C;
57
57
  readonly moduleId: Column<C>;
58
58
  readonly credentialId: Column<C>;
@@ -63,7 +63,7 @@ interface OAuthCredentialReadTable<C extends Table> {
63
63
  readonly isActiveStatus: (value: unknown) => boolean;
64
64
  readonly activeCondition: SQL;
65
65
  }
66
- interface OAuthCredentialTable<C extends Table, N> extends OAuthCredentialReadTable<C> {
66
+ export interface OAuthCredentialTable<C extends Table, N> extends OAuthCredentialReadTable<C> {
67
67
  readonly encodeInsert: (input: {
68
68
  readonly moduleId: string;
69
69
  readonly subjectId: N;
@@ -74,7 +74,7 @@ interface OAuthCredentialTable<C extends Table, N> extends OAuthCredentialReadTa
74
74
  /** This slice removes login rows. Historical records belong in separate audit storage. */
75
75
  readonly removal: "delete";
76
76
  }
77
- interface OAuthAuthorityReadTable<C extends Table> {
77
+ export interface OAuthAuthorityReadTable<C extends Table> {
78
78
  readonly table: C;
79
79
  readonly subjectId: Column<C>;
80
80
  readonly credentialId: Column<C>;
@@ -83,7 +83,7 @@ interface OAuthAuthorityReadTable<C extends Table> {
83
83
  readonly isActiveStatus: (value: unknown) => boolean;
84
84
  readonly activeCondition: SQL;
85
85
  }
86
- interface OAuthAuthorityTable<C extends Table, N> extends OAuthAuthorityReadTable<C> {
86
+ export interface OAuthAuthorityTable<C extends Table, N> extends OAuthAuthorityReadTable<C> {
87
87
  readonly encodeInsert: (input: {
88
88
  readonly subjectId: N;
89
89
  readonly credentialId: string;
@@ -93,7 +93,7 @@ interface OAuthAuthorityTable<C extends Table, N> extends OAuthAuthorityReadTabl
93
93
  /** Both purposes may use the same physical table. Shared tables share module/flow
94
94
  * and module/command uniqueness. The snapshot has the exact purpose-specific core
95
95
  * codec; terminal writes erase it, while identity, claim and retention columns remain. */
96
- interface OAuthFlowTable<F extends Table> {
96
+ export interface OAuthFlowTable<F extends Table> {
97
97
  readonly table: F;
98
98
  readonly moduleId: Column<F>;
99
99
  readonly flowId: Column<F>;
@@ -118,7 +118,7 @@ interface OAuthFlowTable<F extends Table> {
118
118
  readonly purpose: "sign-in" | "link";
119
119
  }) => InferInsertModel<F>;
120
120
  }
121
- interface OAuthTupleAuthorityTable<T extends Table, N> {
121
+ export interface OAuthTupleAuthorityTable<T extends Table, N> {
122
122
  readonly table: T;
123
123
  readonly identityKey: Column<T>;
124
124
  readonly provider: Column<T>;
@@ -135,7 +135,7 @@ interface OAuthTupleAuthorityTable<T extends Table, N> {
135
135
  readonly subjectId?: N;
136
136
  }) => InferInsertModel<T>;
137
137
  }
138
- interface OAuthRegistrationIntentTable<I extends Table> {
138
+ export interface OAuthRegistrationIntentTable<I extends Table> {
139
139
  readonly table: I;
140
140
  readonly moduleId: Column<I>;
141
141
  readonly reference: Column<I>;
@@ -152,7 +152,7 @@ interface OAuthRegistrationIntentTable<I extends Table> {
152
152
  readonly retentionUntil: Column<I>;
153
153
  readonly encodeInsert: (intent: OAuthRegistrationIntent) => InferInsertModel<I>;
154
154
  }
155
- interface OAuthRegistrationCommandTable<R extends Table, Registration> {
155
+ export interface OAuthRegistrationCommandTable<R extends Table, Registration> {
156
156
  readonly table: R;
157
157
  readonly moduleId: Column<R>;
158
158
  readonly commandId: Column<R>;
@@ -173,7 +173,7 @@ interface OAuthRegistrationCommandTable<R extends Table, Registration> {
173
173
  readonly provisioningIdentity: string;
174
174
  }) => InferInsertModel<R>;
175
175
  }
176
- interface OAuthUnlinkCommandTable<U extends Table> {
176
+ export interface OAuthUnlinkCommandTable<U extends Table> {
177
177
  readonly table: U;
178
178
  readonly moduleId: Column<U>;
179
179
  readonly commandId: Column<U>;
@@ -188,7 +188,7 @@ interface OAuthUnlinkCommandTable<U extends Table> {
188
188
  readonly credential: OAuthCredentialSnapshot;
189
189
  }) => InferInsertModel<U>;
190
190
  }
191
- interface OAuthEligibilityFact {
191
+ export interface OAuthEligibilityFact {
192
192
  readonly credentialId: string;
193
193
  readonly revision: SecurityRevision;
194
194
  readonly usablePrimary: boolean;
@@ -201,7 +201,7 @@ interface OAuthEligibilityFact {
201
201
  * All source/identifier/policy mutations advance subject securityRevision. D1 also
202
202
  * guards exact selected IDs/versions and absence/count assumptions, never just a
203
203
  * stale boolean. An over-limit graph fails closed rather than truncating. */
204
- interface OAuthEligibilityTable<T extends Table, N> {
204
+ export interface OAuthEligibilityTable<T extends Table, N> {
205
205
  readonly table: T;
206
206
  readonly subjectId: Column<T>;
207
207
  readonly credentialId: Column<T>;
@@ -212,10 +212,10 @@ interface OAuthEligibilityTable<T extends Table, N> {
212
212
  }
213
213
  /** Authenticated command replay uses current subject status and this additional
214
214
  * nonconsuming SQL policy. It never consumes a fresh action factor. */
215
- interface OAuthMetadataPolicy<N> {
215
+ export interface OAuthMetadataPolicy<N> {
216
216
  readonly condition: (subjectId: N) => SQL;
217
217
  }
218
- interface OAuthCleanupTable<T extends Table, N> {
218
+ export interface OAuthCleanupTable<T extends Table, N> {
219
219
  readonly table: T;
220
220
  readonly subjectId: Column<T>;
221
221
  /** Bound to this subject's old revision; no opaque independently committing service. */
@@ -226,19 +226,19 @@ interface OAuthCleanupTable<T extends Table, N> {
226
226
  }) => SQL;
227
227
  readonly disposition: "delete";
228
228
  }
229
- interface OAuthRegistrationEligibility<N> {
229
+ export interface OAuthRegistrationEligibility<N> {
230
230
  /** Pure SQL guards for mutable app policy; evaluated again after app writes. */
231
231
  readonly condition: (input: {
232
232
  readonly intent: OAuthRegistrationIntent;
233
233
  readonly nativeSubjectId?: N;
234
234
  }) => SQL;
235
235
  }
236
- interface OAuthD1Mapping {
236
+ export interface OAuthD1Mapping {
237
237
  readonly d1: {
238
238
  readonly primary: true;
239
239
  };
240
240
  }
241
- declare const requiredOAuthSignInConstraints: {
241
+ export declare const requiredOAuthSignInConstraints: {
242
242
  readonly flow: "unique(flow.moduleId,flow.flowId)";
243
243
  readonly command: "unique(flow.moduleId,flow.commandId)";
244
244
  readonly stateDigest: "unique(flow.stateDigest)";
@@ -247,18 +247,18 @@ declare const requiredOAuthSignInConstraints: {
247
247
  readonly credentialIdentity: "unique(credential.identityKey)";
248
248
  readonly authorityCredential: "unique(authority.subjectId,authority.credentialId)";
249
249
  };
250
- declare const requiredOAuthTupleConstraints: {
250
+ export declare const requiredOAuthTupleConstraints: {
251
251
  readonly identityKey: "unique(tuple.identityKey)";
252
252
  };
253
- declare const requiredOAuthRegistrationConstraints: {
253
+ export declare const requiredOAuthRegistrationConstraints: {
254
254
  readonly intentReference: "unique(intent.moduleId,intent.reference)";
255
255
  readonly intentFlow: "unique(intent.moduleId,intent.flowId)";
256
256
  readonly command: "unique(registrationCommand.moduleId,registrationCommand.commandId)";
257
257
  };
258
- declare const requiredOAuthAccountsConstraints: {
258
+ export declare const requiredOAuthAccountsConstraints: {
259
259
  readonly unlinkCommand: "unique(unlinkCommand.moduleId,unlinkCommand.commandId)";
260
260
  };
261
- interface OAuthSignInMapping<S extends Table, O extends Table, C extends Table, AC extends Table, F extends Table, N> {
261
+ export interface OAuthSignInMapping<S extends Table, O extends Table, C extends Table, AC extends Table, F extends Table, N> {
262
262
  readonly subject: OAuthSubjectReadTable<S>;
263
263
  readonly ownership: OAuthOwnershipReadTable<O, N>;
264
264
  readonly credential: OAuthCredentialReadTable<C>;
@@ -268,7 +268,7 @@ interface OAuthSignInMapping<S extends Table, O extends Table, C extends Table,
268
268
  readonly clock: OAuthClock;
269
269
  readonly constraints: typeof requiredOAuthSignInConstraints;
270
270
  }
271
- type OAuthOwnershipMutation<T extends Table, O extends Table, N> = {
271
+ export type OAuthOwnershipMutation<T extends Table, O extends Table, N> = {
272
272
  readonly mode: "integrated";
273
273
  readonly tuple: OAuthTupleAuthorityTable<T, N>;
274
274
  } | {
@@ -276,7 +276,7 @@ type OAuthOwnershipMutation<T extends Table, O extends Table, N> = {
276
276
  readonly tuple: OAuthTupleAuthorityTable<T, N>;
277
277
  readonly external: OAuthOwnershipTable<O, N>;
278
278
  };
279
- interface OAuthRegistrationIntentMapping<S extends Table, O extends Table, C extends Table, AC extends Table, F extends Table, T extends Table, I extends Table, N> {
279
+ export interface OAuthRegistrationIntentMapping<S extends Table, O extends Table, C extends Table, AC extends Table, F extends Table, T extends Table, I extends Table, N> {
280
280
  readonly signIn: OAuthSignInMapping<S, O, C, AC, F, N>;
281
281
  readonly ownership: OAuthOwnershipMutation<T, O, N>;
282
282
  readonly intent: OAuthRegistrationIntentTable<I>;
@@ -284,7 +284,7 @@ interface OAuthRegistrationIntentMapping<S extends Table, O extends Table, C ext
284
284
  readonly registrationConstraints: Pick<typeof requiredOAuthRegistrationConstraints, "intentReference" | "intentFlow">;
285
285
  readonly eligibility: OAuthRegistrationEligibility<N>;
286
286
  }
287
- interface OAuthRegistrationBase<Registration, T extends Table, O extends Table, I extends Table, R extends Table, N> {
287
+ export interface OAuthRegistrationBase<Registration, T extends Table, O extends Table, I extends Table, R extends Table, N> {
288
288
  readonly ownership: OAuthOwnershipMutation<T, O, N>;
289
289
  readonly intent: OAuthRegistrationIntentTable<I>;
290
290
  readonly command: OAuthRegistrationCommandTable<R, Registration>;
@@ -339,7 +339,7 @@ interface OAuthRegistrationBase<Registration, T extends Table, O extends Table,
339
339
  readonly allocateProvisioningIdentity: Effect.Effect<string, PersistenceMappingError>;
340
340
  readonly retentionMillis: number;
341
341
  }
342
- interface OAuthRegistrationGuardTable<T extends Table, Registration, N> {
342
+ export interface OAuthRegistrationGuardTable<T extends Table, Registration, N> {
343
343
  readonly table: T;
344
344
  readonly orderBy: Column<T>;
345
345
  readonly condition: (input: {
@@ -348,13 +348,13 @@ interface OAuthRegistrationGuardTable<T extends Table, Registration, N> {
348
348
  readonly nativeSubjectId?: N;
349
349
  }) => SQL;
350
350
  }
351
- interface OAuthRegistrationGuardDescriptor<Registration, N> {
351
+ export interface OAuthRegistrationGuardDescriptor<Registration, N> {
352
352
  readonly table: Table;
353
353
  readonly orderBy: string;
354
354
  readonly condition: OAuthRegistrationGuardTable<Table, Registration, N>["condition"];
355
355
  }
356
- declare const oauthRegistrationGuardTable: <T extends Table, Registration, N>(input: OAuthRegistrationGuardTable<T, Registration, N>) => OAuthRegistrationGuardDescriptor<Registration, N>;
357
- type OAuthRegistrationMapping<Registration, S extends Table, O extends Table, C extends Table, AC extends Table, T extends Table, I extends Table, R extends Table, N> = OAuthRegistrationBase<Registration, T, O, I, R, N> & ({
356
+ export declare const oauthRegistrationGuardTable: <T extends Table, Registration, N>(input: OAuthRegistrationGuardTable<T, Registration, N>) => OAuthRegistrationGuardDescriptor<Registration, N>;
357
+ export type OAuthRegistrationMapping<Registration, S extends Table, O extends Table, C extends Table, AC extends Table, T extends Table, I extends Table, R extends Table, N> = OAuthRegistrationBase<Registration, T, O, I, R, N> & ({
358
358
  readonly mode: "pending";
359
359
  readonly allocatePendingReference: Effect.Effect<string, PersistenceMappingError>;
360
360
  } | {
@@ -375,7 +375,7 @@ type OAuthRegistrationMapping<Registration, S extends Table, O extends Table, C
375
375
  }) => InferInsertModel<S>;
376
376
  });
377
377
  /** Heterogeneous descriptors are made by typed factories and projected privately. */
378
- interface OAuthEligibilityDescriptor<N> {
378
+ export interface OAuthEligibilityDescriptor<N> {
379
379
  readonly _tag: "OAuthEligibilityDescriptor";
380
380
  readonly scope: string;
381
381
  readonly table: Table;
@@ -385,17 +385,17 @@ interface OAuthEligibilityDescriptor<N> {
385
385
  readonly condition: (subjectId: N) => SQL;
386
386
  readonly decode: (row: unknown) => OAuthEligibilityFact | undefined;
387
387
  }
388
- declare const oauthEligibilityTable: <T extends Table, N>(input: OAuthEligibilityTable<T, N>) => OAuthEligibilityDescriptor<N>;
389
- interface OAuthCleanupDescriptor<N> {
388
+ export declare const oauthEligibilityTable: <T extends Table, N>(input: OAuthEligibilityTable<T, N>) => OAuthEligibilityDescriptor<N>;
389
+ export interface OAuthCleanupDescriptor<N> {
390
390
  readonly table: Table;
391
391
  readonly subjectId: string;
392
392
  readonly condition: OAuthCleanupTable<Table, N>["condition"];
393
393
  }
394
- declare const oauthCleanupTable: <T extends Table, N>(input: OAuthCleanupTable<T, N>) => OAuthCleanupDescriptor<N>;
394
+ export declare const oauthCleanupTable: <T extends Table, N>(input: OAuthCleanupTable<T, N>) => OAuthCleanupDescriptor<N>;
395
395
  /** A stable application/reference lock acquired before an ownership target.
396
396
  * Missing rows retain ownership. Conditions are synchronous and use detached
397
397
  * native IDs; every writer of the guarded reference follows the same order. */
398
- interface OAuthReferenceGuardTable<T extends Table, N> {
398
+ export interface OAuthReferenceGuardTable<T extends Table, N> {
399
399
  readonly table: T;
400
400
  readonly orderBy: Column<T>;
401
401
  readonly condition: (input: {
@@ -404,13 +404,13 @@ interface OAuthReferenceGuardTable<T extends Table, N> {
404
404
  readonly subjectId: N;
405
405
  }) => SQL;
406
406
  }
407
- interface OAuthReferenceGuardDescriptor<N> {
407
+ export interface OAuthReferenceGuardDescriptor<N> {
408
408
  readonly table: Table;
409
409
  readonly orderBy: string;
410
410
  readonly condition: OAuthReferenceGuardTable<Table, N>["condition"];
411
411
  }
412
- declare const oauthReferenceGuardTable: <T extends Table, N>(input: OAuthReferenceGuardTable<T, N>) => OAuthReferenceGuardDescriptor<N>;
413
- interface OAuthAccountsMapping<S extends Table, O extends Table, C extends Table, AC extends Table, F extends Table, T extends Table, U extends Table, N> {
412
+ export declare const oauthReferenceGuardTable: <T extends Table, N>(input: OAuthReferenceGuardTable<T, N>) => OAuthReferenceGuardDescriptor<N>;
413
+ export interface OAuthAccountsMapping<S extends Table, O extends Table, C extends Table, AC extends Table, F extends Table, T extends Table, U extends Table, N> {
414
414
  readonly subject: OAuthSubjectTable<S>;
415
415
  readonly ownership: OAuthOwnershipMutation<T, O, N>;
416
416
  readonly credential: OAuthCredentialTable<C, N>;
@@ -437,7 +437,7 @@ interface OAuthAccountsMapping<S extends Table, O extends Table, C extends Table
437
437
  readonly allocateCredentialId: Effect.Effect<string, PersistenceMappingError>;
438
438
  readonly allocateRevision: Effect.Effect<SecurityRevision, PersistenceMappingError>;
439
439
  }
440
- interface OAuthRegistrationAuthority<Registration> {
440
+ export interface OAuthRegistrationAuthority<Registration> {
441
441
  readonly read: (access: import("@yielded/auth/OAuth").OAuthRegistrationAccess) => Effect.Effect<import("@yielded/auth/OAuth").OAuthRegistrationInspection | undefined, import("@yielded/auth/OAuth").OAuthUnavailable>;
442
442
  readonly inspect: (input: {
443
443
  readonly intent: OAuthRegistrationIntent;
@@ -459,5 +459,4 @@ interface OAuthRegistrationAuthority<Registration> {
459
459
  }, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, import("@yielded/auth/OAuth").OAuthUnavailable>;
460
460
  }
461
461
  //#endregion
462
- export { OAuthAccountsMapping, OAuthAction, OAuthAuthorityReadTable, OAuthAuthorityTable, OAuthCleanupDescriptor, OAuthCleanupTable, OAuthClock, OAuthCredentialReadTable, OAuthCredentialTable, OAuthD1Mapping, OAuthEligibilityDescriptor, OAuthEligibilityFact, OAuthEligibilityTable, OAuthFlowState, OAuthFlowTable, OAuthMetadataPolicy, OAuthOwnershipMutation, OAuthOwnershipReadTable, OAuthOwnershipTable, OAuthReferenceGuardDescriptor, OAuthReferenceGuardTable, OAuthRegistrationAuthority, OAuthRegistrationBase, OAuthRegistrationCommandTable, OAuthRegistrationEligibility, OAuthRegistrationGuardDescriptor, OAuthRegistrationGuardTable, OAuthRegistrationIntentMapping, OAuthRegistrationIntentTable, OAuthRegistrationMapping, OAuthRegistrationState, OAuthSignInMapping, OAuthSubjectReadTable, OAuthSubjectTable, OAuthTupleAuthorityTable, OAuthTupleState, OAuthUnlinkCommandTable, oauthCleanupTable, oauthEligibilityTable, oauthReferenceGuardTable, oauthRegistrationGuardTable, requiredOAuthAccountsConstraints, requiredOAuthRegistrationConstraints, requiredOAuthSignInConstraints, requiredOAuthTupleConstraints };
463
462
  //# sourceMappingURL=oauth-model.d.mts.map
@@ -1,4 +1,12 @@
1
+ import { Observation, Row, TransactionOwner } from "../internal/transaction-kernel.mjs";
1
2
  import "./transaction-owner.mjs";
2
3
  import { Context } from "effect";
3
- import "@yielded/auth/Hooks";
4
- import { OAuthUnavailable } from "@yielded/auth/OAuth";
4
+ import { CommitJournal } from "@yielded/auth/Hooks";
5
+ import { OAuthUnavailable } from "@yielded/auth/OAuth";
6
+ //#region src/drizzle/oauth-owner.d.ts
7
+ export type OAuthOwner = TransactionOwner<OAuthUnavailable>;
8
+ declare const CurrentOAuthTransaction_base: Context.ServiceClass<CurrentOAuthTransaction, "effect-auth/drizzle/CurrentOAuthTransaction", OAuthOwner>;
9
+ export declare class CurrentOAuthTransaction extends CurrentOAuthTransaction_base {}
10
+ //#endregion
11
+ export type { Row };
12
+ //# sourceMappingURL=oauth-owner.d.mts.map
@@ -9,9 +9,9 @@ import { LifecycleHooks } from "@yielded/auth/Hooks";
9
9
  import { OAuthAccountRevision, OAuthAccountsPersistence, OAuthClaim, OAuthClaimDecision, OAuthCleanupInput, OAuthCredentialSnapshot, OAuthIssueDecision, OAuthLinkClaimDecision, OAuthLinkDecision, OAuthLinkIssueDecision, OAuthLinkPendingFlow, OAuthPendingFlow, OAuthRegistrationIntent, OAuthRegistrationIntents, OAuthSettlementDecision, OAuthSignInPersistence, OAuthUnavailable, OAuthUnlinkDecision, OAuthUnlinkInspection, OAuthVerifiedExternalIdentity, PrepareOAuthCommit } from "@yielded/auth/OAuth";
10
10
  import { Statement } from "effect/unstable/sql/Statement";
11
11
  //#region src/drizzle/oauth-target.d.ts
12
- type OAuthTargetConfiguration = TransactionTargetConfiguration<OAuthUnavailable>;
13
- type OAuthCoordinatorError<E> = TransactionCoordinatorError<E, OAuthUnavailable>;
14
- declare const makeTargetOAuthSignInServices: (database: any, mapping: any, configuration: OAuthTargetConfiguration) => Effect.Effect<{
12
+ export type OAuthTargetConfiguration = TransactionTargetConfiguration<OAuthUnavailable>;
13
+ export type OAuthCoordinatorError<E> = TransactionCoordinatorError<E, OAuthUnavailable>;
14
+ export declare const makeTargetOAuthSignInServices: (database: any, mapping: any, configuration: OAuthTargetConfiguration) => Effect.Effect<{
15
15
  oauthSignInPersistence: {
16
16
  readonly issue: <A>(input: OAuthPendingFlow, prepare: PrepareOAuthCommit<OAuthIssueDecision, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, OAuthUnavailable>;
17
17
  readonly claim: <A>(input: {
@@ -44,7 +44,7 @@ declare const makeTargetOAuthSignInServices: (database: any, mapping: any, confi
44
44
  }, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, OAuthUnavailable>;
45
45
  };
46
46
  }, never, LifecycleHooks>;
47
- declare const makeTargetOAuthRegistrationIntentServices: (database: any, mapping: any, configuration: OAuthTargetConfiguration) => Effect.Effect<{
47
+ export declare const makeTargetOAuthRegistrationIntentServices: (database: any, mapping: any, configuration: OAuthTargetConfiguration) => Effect.Effect<{
48
48
  oauthRegistrationIntents: {
49
49
  readonly settle: <A>(input: {
50
50
  readonly claim: OAuthClaim;
@@ -54,7 +54,7 @@ declare const makeTargetOAuthRegistrationIntentServices: (database: any, mapping
54
54
  }, prepare: PrepareOAuthCommit<import("@yielded/auth/OAuth").OAuthRegistrationSettlement, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, OAuthUnavailable>;
55
55
  };
56
56
  }, never, LifecycleHooks>;
57
- declare const makeTargetOAuthAccountsServices: (database: any, mapping: any, configuration: OAuthTargetConfiguration) => Effect.Effect<{
57
+ export declare const makeTargetOAuthAccountsServices: (database: any, mapping: any, configuration: OAuthTargetConfiguration) => Effect.Effect<{
58
58
  oauthAccountsPersistence: {
59
59
  readonly capture: (input: {
60
60
  readonly moduleId: string & import("effect/Brand").Brand<"effect-auth/OAuthModuleId">;
@@ -100,12 +100,11 @@ declare const makeTargetOAuthAccountsServices: (database: any, mapping: any, con
100
100
  }, A>) => Effect.Effect<import("@yielded/auth/Hooks").PreparedCommit<A>, OAuthUnavailable>;
101
101
  };
102
102
  }, never, LifecycleHooks>;
103
- declare const oauthAccountsPersistenceLayer: (services: ReturnType<typeof makeTargetOAuthAccountsServices>) => Layer.Layer<OAuthAccountsPersistence, never, LifecycleHooks>;
104
- declare const oauthSignInPersistenceLayer: (services: ReturnType<typeof makeTargetOAuthSignInServices>) => Layer.Layer<OAuthSignInPersistence, never, LifecycleHooks>;
105
- declare const oauthRegistrationIntentsLayer: (services: ReturnType<typeof makeTargetOAuthRegistrationIntentServices>) => Layer.Layer<OAuthRegistrationIntents, never, LifecycleHooks>;
106
- declare const oauthRegistrationAuthorityLayer: <Id, Registration>(tag: Context.Key<Id, OAuthRegistrationAuthority<Registration>>, services: Effect.Effect<{
103
+ export declare const oauthAccountsPersistenceLayer: (services: ReturnType<typeof makeTargetOAuthAccountsServices>) => Layer.Layer<OAuthAccountsPersistence, never, LifecycleHooks>;
104
+ export declare const oauthSignInPersistenceLayer: (services: ReturnType<typeof makeTargetOAuthSignInServices>) => Layer.Layer<OAuthSignInPersistence, never, LifecycleHooks>;
105
+ export declare const oauthRegistrationIntentsLayer: (services: ReturnType<typeof makeTargetOAuthRegistrationIntentServices>) => Layer.Layer<OAuthRegistrationIntents, never, LifecycleHooks>;
106
+ export declare const oauthRegistrationAuthorityLayer: <Id, Registration>(tag: Context.Key<Id, OAuthRegistrationAuthority<Registration>>, services: Effect.Effect<{
107
107
  readonly registrationAuthority: OAuthRegistrationAuthority<Registration>;
108
108
  }, never, LifecycleHooks>) => Layer.Layer<Id, never, LifecycleHooks>;
109
109
  //#endregion
110
- export { OAuthCoordinatorError, OAuthTargetConfiguration, makeTargetOAuthAccountsServices, makeTargetOAuthRegistrationIntentServices, makeTargetOAuthSignInServices, oauthAccountsPersistenceLayer, oauthRegistrationAuthorityLayer, oauthRegistrationIntentsLayer, oauthSignInPersistenceLayer };
111
110
  //# sourceMappingURL=oauth-target.d.mts.map