@effect-auth/core 0.1.0-alpha.10 → 0.1.0-alpha.13

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 (93) hide show
  1. package/README.md +65 -4
  2. package/dist/AuditLog.d.ts +60 -0
  3. package/dist/AuditLog.d.ts.map +1 -1
  4. package/dist/AuditLog.js +105 -0
  5. package/dist/AuditLog.js.map +1 -1
  6. package/dist/AuthKernel.d.ts +1 -1
  7. package/dist/Client.d.ts +72 -1
  8. package/dist/Client.d.ts.map +1 -1
  9. package/dist/Client.js +218 -1
  10. package/dist/Client.js.map +1 -1
  11. package/dist/DomainVerification.d.ts +200 -0
  12. package/dist/DomainVerification.d.ts.map +1 -0
  13. package/dist/DomainVerification.js +304 -0
  14. package/dist/DomainVerification.js.map +1 -0
  15. package/dist/EffectQbSqliteStorage.d.ts +389 -4
  16. package/dist/EffectQbSqliteStorage.d.ts.map +1 -1
  17. package/dist/EffectQbSqliteStorage.js +1191 -4
  18. package/dist/EffectQbSqliteStorage.js.map +1 -1
  19. package/dist/EmailOtp.d.ts +2 -2
  20. package/dist/HttpApi/Api.d.ts +477 -23
  21. package/dist/HttpApi/Api.d.ts.map +1 -1
  22. package/dist/HttpApi/Api.js +705 -4
  23. package/dist/HttpApi/Api.js.map +1 -1
  24. package/dist/HttpApi/Endpoints.d.ts +133 -5
  25. package/dist/HttpApi/Endpoints.d.ts.map +1 -1
  26. package/dist/HttpApi/Endpoints.js +57 -2
  27. package/dist/HttpApi/Endpoints.js.map +1 -1
  28. package/dist/HttpApi/Errors.d.ts +32 -0
  29. package/dist/HttpApi/Errors.d.ts.map +1 -1
  30. package/dist/HttpApi/Errors.js +46 -0
  31. package/dist/HttpApi/Errors.js.map +1 -1
  32. package/dist/HttpApi/Schemas.d.ts +149 -8
  33. package/dist/HttpApi/Schemas.d.ts.map +1 -1
  34. package/dist/HttpApi/Schemas.js +128 -0
  35. package/dist/HttpApi/Schemas.js.map +1 -1
  36. package/dist/Identifiers.d.ts +3 -0
  37. package/dist/Identifiers.d.ts.map +1 -1
  38. package/dist/Identifiers.js +2 -0
  39. package/dist/Identifiers.js.map +1 -1
  40. package/dist/IncidentAction.d.ts +80 -0
  41. package/dist/IncidentAction.d.ts.map +1 -0
  42. package/dist/IncidentAction.js +158 -0
  43. package/dist/IncidentAction.js.map +1 -0
  44. package/dist/Jwt.d.ts +10 -0
  45. package/dist/Jwt.d.ts.map +1 -1
  46. package/dist/Jwt.js +209 -0
  47. package/dist/Jwt.js.map +1 -1
  48. package/dist/LoginNotification.d.ts +1 -1
  49. package/dist/LoginRisk.d.ts +272 -1
  50. package/dist/LoginRisk.d.ts.map +1 -1
  51. package/dist/LoginRisk.js +427 -0
  52. package/dist/LoginRisk.js.map +1 -1
  53. package/dist/MachineAuth.d.ts +73 -0
  54. package/dist/MachineAuth.d.ts.map +1 -0
  55. package/dist/MachineAuth.js +147 -0
  56. package/dist/MachineAuth.js.map +1 -0
  57. package/dist/MagicLink.d.ts +2 -2
  58. package/dist/OAuth.d.ts +957 -1
  59. package/dist/OAuth.d.ts.map +1 -1
  60. package/dist/OAuth.js +1403 -1
  61. package/dist/OAuth.js.map +1 -1
  62. package/dist/Password.d.ts +2 -2
  63. package/dist/Retention.d.ts +98 -0
  64. package/dist/Retention.d.ts.map +1 -0
  65. package/dist/Retention.js +204 -0
  66. package/dist/Retention.js.map +1 -0
  67. package/dist/SecurityTimeline.d.ts +8 -2
  68. package/dist/SecurityTimeline.d.ts.map +1 -1
  69. package/dist/SecurityTimeline.js +75 -0
  70. package/dist/SecurityTimeline.js.map +1 -1
  71. package/dist/StorageMigrations.d.ts +11 -1
  72. package/dist/StorageMigrations.d.ts.map +1 -1
  73. package/dist/StorageMigrations.js +206 -0
  74. package/dist/StorageMigrations.js.map +1 -1
  75. package/dist/Webhook.d.ts +310 -2
  76. package/dist/Webhook.d.ts.map +1 -1
  77. package/dist/Webhook.js +511 -1
  78. package/dist/Webhook.js.map +1 -1
  79. package/dist/index.d.ts +4 -0
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +4 -0
  82. package/dist/index.js.map +1 -1
  83. package/migrations/0014_auth_webhook_outbox.sql +16 -0
  84. package/migrations/0015_auth_webhook_replay.sql +7 -0
  85. package/migrations/0016_auth_login_risk_history.sql +23 -0
  86. package/migrations/0017_auth_audit_log.sql +17 -0
  87. package/migrations/0018_auth_domain_verification.sql +18 -0
  88. package/migrations/0019_auth_oauth_authorization_code.sql +17 -0
  89. package/migrations/0020_auth_oauth_provider_mode_token.sql +24 -0
  90. package/migrations/0021_auth_oauth_client_secret.sql +14 -0
  91. package/migrations/0022_auth_oauth_client.sql +15 -0
  92. package/migrations/0023_auth_oauth_consent.sql +15 -0
  93. package/package.json +17 -1
@@ -1,14 +1,20 @@
1
1
  import { Layer } from "effect";
2
2
  import { Executor, Query, Scalar, Table } from "effect-qb/sqlite";
3
+ import { AuditLogStore } from "./AuditLog.js";
4
+ import type { AuditLogStoreService, AuthAuditEvent } from "./AuditLog.js";
3
5
  import { ApiKeyStore } from "./ApiKey.js";
4
6
  import type { ApiKeyMarkUsedInput, ApiKeyRecord, ApiKeyRevokeInput, ApiKeyStoreService } from "./ApiKey.js";
7
+ import { DomainVerificationStore } from "./DomainVerification.js";
8
+ import type { DomainVerificationRecord, DomainVerificationStoreMarkVerifiedInput, DomainVerificationStoreRevokeInput, DomainVerificationStoreService } from "./DomainVerification.js";
5
9
  import { UnixMillis } from "./Identifiers.js";
6
10
  import { JwtRevocationStore } from "./Jwt.js";
7
11
  import type { JwtRevocationRecord, JwtRevocationStoreService } from "./Jwt.js";
8
12
  import { LoginApprovalReviewStore } from "./LoginApproval.js";
9
13
  import type { LoginApprovalReviewRecord, LoginApprovalReviewStoreService, LoginApprovalReviewerId } from "./LoginApproval.js";
10
- import { OAuthAccountStore, OAuthProviderTokenVault } from "./OAuth.js";
11
- import type { OAuthAccountRecord, OAuthAccountStoreService, OAuthAccountUnlinkInput, OAuthProviderTokenVaultMarkRevokedInput, OAuthProviderTokenVaultRecord, OAuthProviderTokenVaultService } from "./OAuth.js";
14
+ import { LoginRiskHistory } from "./LoginRisk.js";
15
+ import type { LoginRiskHistoryRecordInput, LoginRiskHistoryService } from "./LoginRisk.js";
16
+ import { OAuthAccountStore, OAuthAuthorizationCodeStore, OAuthClientStore, OAuthConsentStore, OAuthClientSecretStore, OAuthProviderModeTokenStore, OAuthProviderTokenVault } from "./OAuth.js";
17
+ import type { OAuthAccountRecord, OAuthAccountStoreService, OAuthAccountUnlinkInput, OAuthAuthorizationCodeRecord, OAuthAuthorizationCodeStoreMarkConsumedInput, OAuthAuthorizationCodeStoreService, OAuthClientRecord, OAuthClientStoreService, OAuthConsentRecord, OAuthConsentRevokeInput, OAuthConsentStoreService, OAuthClientSecretRecord, OAuthClientSecretStoreMarkUsedInput, OAuthClientSecretStoreRevokeInput, OAuthClientSecretStoreService, OAuthProviderModeTokenRecord, OAuthProviderModeTokenStoreRevokeInput, OAuthProviderModeTokenStoreRotateInput, OAuthProviderModeTokenStoreService, OAuthProviderTokenVaultMarkRevokedInput, OAuthProviderTokenVaultRecord, OAuthProviderTokenVaultService } from "./OAuth.js";
12
18
  import { PasskeyCredentialStore } from "./Passkey.js";
13
19
  import type { PasskeyCredentialRecord, PasskeyCredentialRevokeInput, PasskeyCredentialStoreService, PasskeyCredentialUpdateSignCountInput } from "./Passkey.js";
14
20
  import { RecoveryCodeStore } from "./RecoveryCode.js";
@@ -24,6 +30,8 @@ import { TotpFactorStore } from "./Totp.js";
24
30
  import type { TotpFactorConfirmInput, TotpFactorMarkUsedInput, TotpFactorRecord, TotpFactorRevokeInput, TotpFactorStoreService } from "./Totp.js";
25
31
  import { TrustedDeviceStore } from "./TrustedDevice.js";
26
32
  import type { TrustedDeviceRecord, TrustedDeviceStoreService, TrustedDeviceStoreUpsertInput } from "./TrustedDevice.js";
33
+ import { WebhookOutboxStore, WebhookReplayStore } from "./Webhook.js";
34
+ import type { WebhookOutboxMarkDeadLetteredInput, WebhookOutboxMarkDeliveredInput, WebhookOutboxMarkFailedInput, WebhookOutboxRecord, WebhookOutboxStoreService, WebhookReplayClaimInput, WebhookReplayStoreService } from "./Webhook.js";
27
35
  export interface D1EffectQbResult<Row extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>> {
28
36
  readonly success?: boolean;
29
37
  readonly error?: string;
@@ -88,6 +96,17 @@ export interface EffectQbAuthVerificationSelectedRow {
88
96
  readonly metadata: unknown;
89
97
  readonly consumedAt: number | null;
90
98
  }
99
+ export interface EffectQbAuthAuditLogSelectedRow {
100
+ readonly id: string | null;
101
+ readonly type: string;
102
+ readonly userId: string | null;
103
+ readonly actorUserId: string | null;
104
+ readonly occurredAt: number;
105
+ readonly requestIpHash: string | null;
106
+ readonly requestUserAgentHash: string | null;
107
+ readonly event: unknown;
108
+ readonly createdAt: number;
109
+ }
91
110
  export interface EffectQbAuthLoginApprovalReviewSelectedRow {
92
111
  readonly approvalChallengeId: string;
93
112
  readonly flowId: string;
@@ -106,6 +125,24 @@ export interface EffectQbAuthLoginApprovalReviewSelectedRow {
106
125
  readonly metadata: unknown;
107
126
  readonly reviewMetadata: unknown;
108
127
  }
128
+ export interface EffectQbAuthLoginRiskHistorySelectedRow {
129
+ readonly id: string;
130
+ readonly userId: string;
131
+ readonly occurredAt: number;
132
+ readonly outcome: string;
133
+ readonly method: string;
134
+ readonly amr: string | readonly AuthMethodReference[];
135
+ readonly aal: string;
136
+ readonly deviceStatus: string;
137
+ readonly deviceKey: string | null;
138
+ readonly locationKey: string | null;
139
+ readonly country: string | null;
140
+ readonly region: string | null;
141
+ readonly latitudeMicro: number | null;
142
+ readonly longitudeMicro: number | null;
143
+ readonly riskLevel: string | null;
144
+ readonly createdAt: number;
145
+ }
109
146
  export interface EffectQbAuthTrustedDeviceSelectedRow {
110
147
  readonly userId: string;
111
148
  readonly tokenHash: string;
@@ -208,6 +245,84 @@ export interface EffectQbAuthOAuthProviderTokenVaultSelectedRow {
208
245
  readonly revokedAt: number | null;
209
246
  readonly revocationReason: string | null;
210
247
  }
248
+ export interface EffectQbAuthOAuthClientSelectedRow {
249
+ readonly id: string;
250
+ readonly type: string;
251
+ readonly status: string;
252
+ readonly name: string | null;
253
+ readonly redirectUris: unknown;
254
+ readonly allowedGrantTypes: unknown;
255
+ readonly allowedResponseTypes: unknown;
256
+ readonly allowedScopes: unknown;
257
+ readonly createdAt: number | null;
258
+ readonly updatedAt: number | null;
259
+ readonly metadata: unknown;
260
+ }
261
+ export interface EffectQbAuthOAuthConsentSelectedRow {
262
+ readonly id: string;
263
+ readonly userId: string;
264
+ readonly clientId: string;
265
+ readonly scopes: unknown;
266
+ readonly grantedAt: number;
267
+ readonly expiresAt: number | null;
268
+ readonly revokedAt: number | null;
269
+ readonly metadata: unknown;
270
+ }
271
+ export interface EffectQbAuthOAuthAuthorizationCodeSelectedRow {
272
+ readonly codeHash: string;
273
+ readonly clientId: string;
274
+ readonly subject: string;
275
+ readonly redirectUri: string;
276
+ readonly scopes: unknown;
277
+ readonly codeChallenge: string | null;
278
+ readonly codeChallengeMethod: string | null;
279
+ readonly issuedAt: number;
280
+ readonly expiresAt: number;
281
+ readonly consumedAt: number | null;
282
+ readonly metadata: unknown;
283
+ }
284
+ export interface EffectQbAuthOAuthClientSecretSelectedRow {
285
+ readonly prefix: string;
286
+ readonly clientId: string;
287
+ readonly secretHash: string;
288
+ readonly authenticationMethods: unknown;
289
+ readonly createdAt: number;
290
+ readonly expiresAt: number | null;
291
+ readonly lastUsedAt: number | null;
292
+ readonly revokedAt: number | null;
293
+ readonly metadata: unknown;
294
+ }
295
+ export interface EffectQbAuthOAuthProviderModeTokenSelectedRow {
296
+ readonly tokenHash: string;
297
+ readonly tokenType: string;
298
+ readonly clientId: string;
299
+ readonly subject: string;
300
+ readonly scopes: unknown;
301
+ readonly issuedAt: number;
302
+ readonly expiresAt: number;
303
+ readonly issuer: string | null;
304
+ readonly audience: unknown;
305
+ readonly jwtId: string | null;
306
+ readonly revokedAt: number | null;
307
+ readonly revocationReason: string | null;
308
+ readonly rotatedAt: number | null;
309
+ readonly replacedByTokenHash: string | null;
310
+ readonly metadata: unknown;
311
+ }
312
+ export interface EffectQbAuthDomainVerificationSelectedRow {
313
+ readonly id: string;
314
+ readonly ownerId: string;
315
+ readonly domain: string;
316
+ readonly proofMethod: string;
317
+ readonly proofToken: string;
318
+ readonly status: string;
319
+ readonly createdAt: number;
320
+ readonly expiresAt: number;
321
+ readonly verifiedAt: number | null;
322
+ readonly revokedAt: number | null;
323
+ readonly lastCheckedAt: number | null;
324
+ readonly metadata: unknown;
325
+ }
211
326
  export interface EffectQbAuthSecurityTimelineSelectedRow {
212
327
  readonly id: string;
213
328
  readonly userId: string;
@@ -220,13 +335,32 @@ export interface EffectQbAuthSecurityTimelineSelectedRow {
220
335
  readonly request: unknown;
221
336
  readonly metadata: unknown;
222
337
  }
338
+ export interface EffectQbAuthWebhookOutboxSelectedRow {
339
+ readonly id: string;
340
+ readonly endpointKey: string;
341
+ readonly event: unknown;
342
+ readonly status: string;
343
+ readonly attempts: number;
344
+ readonly nextAttemptAt: number;
345
+ readonly createdAt: number;
346
+ readonly updatedAt: number;
347
+ readonly deliveredAt: number | null;
348
+ readonly lastError: string | null;
349
+ }
350
+ export interface EffectQbAuthWebhookReplaySelectedRow {
351
+ readonly id: string;
352
+ readonly expiresAt: number;
353
+ readonly createdAt: number;
354
+ }
223
355
  declare const authSqliteTablesTypeId: unique symbol;
224
356
  export interface AuthSqliteTableNames {
225
357
  readonly user?: string;
226
358
  readonly credential?: string;
227
359
  readonly session?: string;
228
360
  readonly verification?: string;
361
+ readonly auditLog?: string;
229
362
  readonly loginApprovalReview?: string;
363
+ readonly loginRiskHistory?: string;
230
364
  readonly trustedDevice?: string;
231
365
  readonly passkeyCredential?: string;
232
366
  readonly totpFactor?: string;
@@ -235,8 +369,16 @@ export interface AuthSqliteTableNames {
235
369
  readonly refreshToken?: string;
236
370
  readonly jwtRevocation?: string;
237
371
  readonly oauthAccount?: string;
372
+ readonly oauthClient?: string;
373
+ readonly oauthConsent?: string;
374
+ readonly oauthAuthorizationCode?: string;
375
+ readonly oauthClientSecret?: string;
376
+ readonly oauthProviderModeToken?: string;
238
377
  readonly oauthProviderTokenVault?: string;
378
+ readonly domainVerification?: string;
239
379
  readonly securityTimeline?: string;
380
+ readonly webhookOutbox?: string;
381
+ readonly webhookReplay?: string;
240
382
  }
241
383
  type EffectQbSqliteTable = Table.AnyTable;
242
384
  type EffectQbInsertInput<TableValue extends EffectQbSqliteTable> = Query.MutationInputOf<Table.InsertOf<TableValue>>;
@@ -317,6 +459,22 @@ export interface EffectQbAuthVerificationTable<TableValue extends EffectQbSqlite
317
459
  readonly consume: (input: VerificationConsumeInput) => EffectQbUpdateInput<TableValue>;
318
460
  readonly decode?: (row: EffectQbAuthVerificationSelectedRow) => VerificationRow;
319
461
  }
462
+ export interface EffectQbAuthAuditLogTable<TableValue extends EffectQbSqliteTable = EffectQbSqliteTable> {
463
+ readonly table: TableValue;
464
+ readonly select: EffectQbSelection & {
465
+ readonly id: EffectQbSqliteExpression;
466
+ readonly type: EffectQbSqliteExpression;
467
+ readonly userId: EffectQbSqliteExpression;
468
+ readonly actorUserId: EffectQbSqliteExpression;
469
+ readonly occurredAt: EffectQbSqliteExpression;
470
+ readonly requestIpHash: EffectQbSqliteExpression;
471
+ readonly requestUserAgentHash: EffectQbSqliteExpression;
472
+ readonly event: EffectQbSqliteExpression;
473
+ readonly createdAt: EffectQbSqliteExpression;
474
+ };
475
+ readonly insert: (event: AuthAuditEvent, createdAt: UnixMillis) => EffectQbInsertInput<TableValue>;
476
+ readonly decode?: (row: EffectQbAuthAuditLogSelectedRow) => AuthAuditEvent;
477
+ }
320
478
  export interface EffectQbAuthLoginApprovalReviewTable<TableValue extends EffectQbSqliteTable = EffectQbSqliteTable> {
321
479
  readonly table: TableValue;
322
480
  readonly select: EffectQbSelection & {
@@ -351,6 +509,33 @@ export interface EffectQbAuthLoginApprovalReviewTable<TableValue extends EffectQ
351
509
  }) => EffectQbUpdateInput<TableValue>;
352
510
  readonly decode?: (row: EffectQbAuthLoginApprovalReviewSelectedRow) => LoginApprovalReviewRecord;
353
511
  }
512
+ export interface EffectQbAuthLoginRiskHistoryTable<TableValue extends EffectQbSqliteTable = EffectQbSqliteTable> {
513
+ readonly table: TableValue;
514
+ readonly select: EffectQbSelection & {
515
+ readonly id: EffectQbSqliteExpression;
516
+ readonly userId: EffectQbSqliteExpression;
517
+ readonly occurredAt: EffectQbSqliteExpression;
518
+ readonly outcome: EffectQbSqliteExpression;
519
+ readonly method: EffectQbSqliteExpression;
520
+ readonly amr: EffectQbSqliteExpression;
521
+ readonly aal: EffectQbSqliteExpression;
522
+ readonly deviceStatus: EffectQbSqliteExpression;
523
+ readonly deviceKey: EffectQbSqliteExpression;
524
+ readonly locationKey: EffectQbSqliteExpression;
525
+ readonly country: EffectQbSqliteExpression;
526
+ readonly region: EffectQbSqliteExpression;
527
+ readonly latitudeMicro: EffectQbSqliteExpression;
528
+ readonly longitudeMicro: EffectQbSqliteExpression;
529
+ readonly riskLevel: EffectQbSqliteExpression;
530
+ readonly createdAt: EffectQbSqliteExpression;
531
+ };
532
+ readonly insert: (row: LoginRiskHistoryRecordInput & {
533
+ readonly createdAt: UnixMillis;
534
+ }) => EffectQbInsertInput<TableValue>;
535
+ readonly decode?: (row: EffectQbAuthLoginRiskHistorySelectedRow) => LoginRiskHistoryRecordInput & {
536
+ readonly createdAt: UnixMillis;
537
+ };
538
+ }
354
539
  export interface EffectQbAuthTrustedDeviceTable<TableValue extends EffectQbSqliteTable = EffectQbSqliteTable> {
355
540
  readonly table: TableValue;
356
541
  readonly select: EffectQbSelection & {
@@ -516,6 +701,128 @@ export interface EffectQbAuthOAuthProviderTokenVaultTable<TableValue extends Eff
516
701
  readonly markRevoked: (input: OAuthProviderTokenVaultMarkRevokedInput) => EffectQbUpdateInput<TableValue>;
517
702
  readonly decode?: (row: EffectQbAuthOAuthProviderTokenVaultSelectedRow) => OAuthProviderTokenVaultRecord;
518
703
  }
704
+ export interface EffectQbAuthOAuthClientTable<TableValue extends EffectQbSqliteTable = EffectQbSqliteTable> {
705
+ readonly table: TableValue;
706
+ readonly select: EffectQbSelection & {
707
+ readonly id: EffectQbSqliteExpression;
708
+ readonly type: EffectQbSqliteExpression;
709
+ readonly status: EffectQbSqliteExpression;
710
+ readonly name: EffectQbSqliteExpression;
711
+ readonly redirectUris: EffectQbSqliteExpression;
712
+ readonly allowedGrantTypes: EffectQbSqliteExpression;
713
+ readonly allowedResponseTypes: EffectQbSqliteExpression;
714
+ readonly allowedScopes: EffectQbSqliteExpression;
715
+ readonly createdAt: EffectQbSqliteExpression;
716
+ readonly updatedAt: EffectQbSqliteExpression;
717
+ readonly metadata: EffectQbSqliteExpression;
718
+ };
719
+ readonly insert: (record: OAuthClientRecord) => EffectQbInsertInput<TableValue>;
720
+ readonly update: (record: OAuthClientRecord) => EffectQbUpdateInput<TableValue>;
721
+ readonly decode?: (row: EffectQbAuthOAuthClientSelectedRow) => OAuthClientRecord;
722
+ }
723
+ export interface EffectQbAuthOAuthConsentTable<TableValue extends EffectQbSqliteTable = EffectQbSqliteTable> {
724
+ readonly table: TableValue;
725
+ readonly select: EffectQbSelection & {
726
+ readonly id: EffectQbSqliteExpression;
727
+ readonly userId: EffectQbSqliteExpression;
728
+ readonly clientId: EffectQbSqliteExpression;
729
+ readonly scopes: EffectQbSqliteExpression;
730
+ readonly grantedAt: EffectQbSqliteExpression;
731
+ readonly expiresAt: EffectQbSqliteExpression;
732
+ readonly revokedAt: EffectQbSqliteExpression;
733
+ readonly metadata: EffectQbSqliteExpression;
734
+ };
735
+ readonly insert: (record: OAuthConsentRecord) => EffectQbInsertInput<TableValue>;
736
+ readonly update: (record: OAuthConsentRecord) => EffectQbUpdateInput<TableValue>;
737
+ readonly revoke: (input: OAuthConsentRevokeInput, row: OAuthConsentRecord) => EffectQbUpdateInput<TableValue>;
738
+ readonly decode?: (row: EffectQbAuthOAuthConsentSelectedRow) => OAuthConsentRecord;
739
+ }
740
+ export interface EffectQbAuthOAuthAuthorizationCodeTable<TableValue extends EffectQbSqliteTable = EffectQbSqliteTable> {
741
+ readonly table: TableValue;
742
+ readonly select: EffectQbSelection & {
743
+ readonly codeHash: EffectQbSqliteExpression;
744
+ readonly clientId: EffectQbSqliteExpression;
745
+ readonly subject: EffectQbSqliteExpression;
746
+ readonly redirectUri: EffectQbSqliteExpression;
747
+ readonly scopes: EffectQbSqliteExpression;
748
+ readonly codeChallenge: EffectQbSqliteExpression;
749
+ readonly codeChallengeMethod: EffectQbSqliteExpression;
750
+ readonly issuedAt: EffectQbSqliteExpression;
751
+ readonly expiresAt: EffectQbSqliteExpression;
752
+ readonly consumedAt: EffectQbSqliteExpression;
753
+ readonly metadata: EffectQbSqliteExpression;
754
+ };
755
+ readonly insert: (record: OAuthAuthorizationCodeRecord) => EffectQbInsertInput<TableValue>;
756
+ readonly update: (record: OAuthAuthorizationCodeRecord) => EffectQbUpdateInput<TableValue>;
757
+ readonly markConsumed: (input: OAuthAuthorizationCodeStoreMarkConsumedInput) => EffectQbUpdateInput<TableValue>;
758
+ readonly decode?: (row: EffectQbAuthOAuthAuthorizationCodeSelectedRow) => OAuthAuthorizationCodeRecord;
759
+ }
760
+ export interface EffectQbAuthOAuthClientSecretTable<TableValue extends EffectQbSqliteTable = EffectQbSqliteTable> {
761
+ readonly table: TableValue;
762
+ readonly select: EffectQbSelection & {
763
+ readonly prefix: EffectQbSqliteExpression;
764
+ readonly clientId: EffectQbSqliteExpression;
765
+ readonly secretHash: EffectQbSqliteExpression;
766
+ readonly authenticationMethods: EffectQbSqliteExpression;
767
+ readonly createdAt: EffectQbSqliteExpression;
768
+ readonly expiresAt: EffectQbSqliteExpression;
769
+ readonly lastUsedAt: EffectQbSqliteExpression;
770
+ readonly revokedAt: EffectQbSqliteExpression;
771
+ readonly metadata: EffectQbSqliteExpression;
772
+ };
773
+ readonly insert: (record: OAuthClientSecretRecord) => EffectQbInsertInput<TableValue>;
774
+ readonly update: (record: OAuthClientSecretRecord) => EffectQbUpdateInput<TableValue>;
775
+ readonly markUsed: (input: OAuthClientSecretStoreMarkUsedInput) => EffectQbUpdateInput<TableValue>;
776
+ readonly revoke: (input: OAuthClientSecretStoreRevokeInput, row: OAuthClientSecretRecord) => EffectQbUpdateInput<TableValue>;
777
+ readonly decode?: (row: EffectQbAuthOAuthClientSecretSelectedRow) => OAuthClientSecretRecord;
778
+ }
779
+ export interface EffectQbAuthOAuthProviderModeTokenTable<TableValue extends EffectQbSqliteTable = EffectQbSqliteTable> {
780
+ readonly table: TableValue;
781
+ readonly select: EffectQbSelection & {
782
+ readonly tokenHash: EffectQbSqliteExpression;
783
+ readonly tokenType: EffectQbSqliteExpression;
784
+ readonly clientId: EffectQbSqliteExpression;
785
+ readonly subject: EffectQbSqliteExpression;
786
+ readonly scopes: EffectQbSqliteExpression;
787
+ readonly issuedAt: EffectQbSqliteExpression;
788
+ readonly expiresAt: EffectQbSqliteExpression;
789
+ readonly issuer: EffectQbSqliteExpression;
790
+ readonly audience: EffectQbSqliteExpression;
791
+ readonly jwtId: EffectQbSqliteExpression;
792
+ readonly revokedAt: EffectQbSqliteExpression;
793
+ readonly revocationReason: EffectQbSqliteExpression;
794
+ readonly rotatedAt: EffectQbSqliteExpression;
795
+ readonly replacedByTokenHash: EffectQbSqliteExpression;
796
+ readonly metadata: EffectQbSqliteExpression;
797
+ };
798
+ readonly insert: (record: OAuthProviderModeTokenRecord) => EffectQbInsertInput<TableValue>;
799
+ readonly update: (record: OAuthProviderModeTokenRecord) => EffectQbUpdateInput<TableValue>;
800
+ readonly revoke: (input: OAuthProviderModeTokenStoreRevokeInput, row: OAuthProviderModeTokenRecord) => EffectQbUpdateInput<TableValue>;
801
+ readonly rotate: (input: OAuthProviderModeTokenStoreRotateInput) => EffectQbUpdateInput<TableValue>;
802
+ readonly decode?: (row: EffectQbAuthOAuthProviderModeTokenSelectedRow) => OAuthProviderModeTokenRecord;
803
+ }
804
+ export interface EffectQbAuthDomainVerificationTable<TableValue extends EffectQbSqliteTable = EffectQbSqliteTable> {
805
+ readonly table: TableValue;
806
+ readonly select: EffectQbSelection & {
807
+ readonly id: EffectQbSqliteExpression;
808
+ readonly ownerId: EffectQbSqliteExpression;
809
+ readonly domain: EffectQbSqliteExpression;
810
+ readonly proofMethod: EffectQbSqliteExpression;
811
+ readonly proofToken: EffectQbSqliteExpression;
812
+ readonly status: EffectQbSqliteExpression;
813
+ readonly createdAt: EffectQbSqliteExpression;
814
+ readonly expiresAt: EffectQbSqliteExpression;
815
+ readonly verifiedAt: EffectQbSqliteExpression;
816
+ readonly revokedAt: EffectQbSqliteExpression;
817
+ readonly lastCheckedAt: EffectQbSqliteExpression;
818
+ readonly metadata: EffectQbSqliteExpression;
819
+ };
820
+ readonly insert: (record: DomainVerificationRecord) => EffectQbInsertInput<TableValue>;
821
+ readonly update: (record: DomainVerificationRecord) => EffectQbUpdateInput<TableValue>;
822
+ readonly markVerified: (input: DomainVerificationStoreMarkVerifiedInput) => EffectQbUpdateInput<TableValue>;
823
+ readonly revoke: (input: DomainVerificationStoreRevokeInput, row: DomainVerificationRecord) => EffectQbUpdateInput<TableValue>;
824
+ readonly decode?: (row: EffectQbAuthDomainVerificationSelectedRow) => DomainVerificationRecord;
825
+ }
519
826
  export interface EffectQbAuthSecurityTimelineTable<TableValue extends EffectQbSqliteTable = EffectQbSqliteTable> {
520
827
  readonly table: TableValue;
521
828
  readonly select: EffectQbSelection & {
@@ -533,12 +840,55 @@ export interface EffectQbAuthSecurityTimelineTable<TableValue extends EffectQbSq
533
840
  readonly insert: (event: SecurityTimelineEvent) => EffectQbInsertInput<TableValue>;
534
841
  readonly decode?: (row: EffectQbAuthSecurityTimelineSelectedRow) => SecurityTimelineEvent;
535
842
  }
843
+ export interface EffectQbAuthWebhookOutboxTable<TableValue extends EffectQbSqliteTable = EffectQbSqliteTable> {
844
+ readonly table: TableValue;
845
+ readonly select: EffectQbSelection & {
846
+ readonly id: EffectQbSqliteExpression;
847
+ readonly endpointKey: EffectQbSqliteExpression;
848
+ readonly event: EffectQbSqliteExpression;
849
+ readonly status: EffectQbSqliteExpression;
850
+ readonly attempts: EffectQbSqliteExpression;
851
+ readonly nextAttemptAt: EffectQbSqliteExpression;
852
+ readonly createdAt: EffectQbSqliteExpression;
853
+ readonly updatedAt: EffectQbSqliteExpression;
854
+ readonly deliveredAt: EffectQbSqliteExpression;
855
+ readonly lastError: EffectQbSqliteExpression;
856
+ };
857
+ readonly insert: (record: WebhookOutboxRecord) => EffectQbInsertInput<TableValue>;
858
+ readonly markDelivered: (input: WebhookOutboxMarkDeliveredInput & {
859
+ readonly deliveredAt: UnixMillis;
860
+ }) => EffectQbUpdateInput<TableValue>;
861
+ readonly markFailed: (input: WebhookOutboxMarkFailedInput & {
862
+ readonly failedAt: UnixMillis;
863
+ readonly attempts: number;
864
+ }) => EffectQbUpdateInput<TableValue>;
865
+ readonly markDeadLettered: (input: WebhookOutboxMarkDeadLetteredInput & {
866
+ readonly deadLetteredAt: UnixMillis;
867
+ }) => EffectQbUpdateInput<TableValue>;
868
+ readonly decode?: (row: EffectQbAuthWebhookOutboxSelectedRow) => WebhookOutboxRecord;
869
+ }
870
+ export interface EffectQbAuthWebhookReplayTable<TableValue extends EffectQbSqliteTable = EffectQbSqliteTable> {
871
+ readonly table: TableValue;
872
+ readonly select: EffectQbSelection & {
873
+ readonly id: EffectQbSqliteExpression;
874
+ readonly expiresAt: EffectQbSqliteExpression;
875
+ readonly createdAt: EffectQbSqliteExpression;
876
+ };
877
+ readonly insert: (input: WebhookReplayClaimInput & {
878
+ readonly now: UnixMillis;
879
+ }) => EffectQbInsertInput<TableValue>;
880
+ readonly update: (input: WebhookReplayClaimInput & {
881
+ readonly now: UnixMillis;
882
+ }) => EffectQbUpdateInput<TableValue>;
883
+ }
536
884
  export interface EffectQbAuthTablesInput {
537
885
  readonly user: EffectQbAuthUserTable;
538
886
  readonly credential: EffectQbAuthCredentialTable;
539
887
  readonly session: EffectQbAuthSessionTable;
540
888
  readonly verification: EffectQbAuthVerificationTable;
889
+ readonly auditLog: EffectQbAuthAuditLogTable;
541
890
  readonly loginApprovalReview: EffectQbAuthLoginApprovalReviewTable;
891
+ readonly loginRiskHistory: EffectQbAuthLoginRiskHistoryTable;
542
892
  readonly trustedDevice: EffectQbAuthTrustedDeviceTable;
543
893
  readonly passkeyCredential: EffectQbAuthPasskeyCredentialTable;
544
894
  readonly totpFactor: EffectQbAuthTotpFactorTable;
@@ -547,21 +897,38 @@ export interface EffectQbAuthTablesInput {
547
897
  readonly refreshToken: EffectQbAuthRefreshTokenTable;
548
898
  readonly jwtRevocation: EffectQbAuthJwtRevocationTable;
549
899
  readonly oauthAccount: EffectQbAuthOAuthAccountTable;
900
+ readonly oauthClient: EffectQbAuthOAuthClientTable;
901
+ readonly oauthConsent: EffectQbAuthOAuthConsentTable;
902
+ readonly oauthAuthorizationCode: EffectQbAuthOAuthAuthorizationCodeTable;
903
+ readonly oauthClientSecret: EffectQbAuthOAuthClientSecretTable;
904
+ readonly oauthProviderModeToken: EffectQbAuthOAuthProviderModeTokenTable;
550
905
  readonly oauthProviderTokenVault: EffectQbAuthOAuthProviderTokenVaultTable;
906
+ readonly domainVerification: EffectQbAuthDomainVerificationTable;
551
907
  readonly securityTimeline: EffectQbAuthSecurityTimelineTable;
908
+ readonly webhookOutbox: EffectQbAuthWebhookOutboxTable;
909
+ readonly webhookReplay: EffectQbAuthWebhookReplayTable;
552
910
  }
553
911
  export interface AuthSqliteTables extends EffectQbAuthTablesInput {
554
912
  readonly [authSqliteTablesTypeId]: typeof authSqliteTablesTypeId;
555
913
  }
914
+ export interface EffectQbSqliteLoginRiskHistoryOptions {
915
+ readonly recentWindowMillis?: number;
916
+ readonly historyWindowMillis?: number;
917
+ readonly impossibleTravelWindowMillis?: number;
918
+ readonly impossibleTravelKmh?: number;
919
+ }
556
920
  export interface EffectQbSqliteAuthStorageOptions {
557
921
  readonly tables?: AuthSqliteTables;
922
+ readonly loginRiskHistory?: EffectQbSqliteLoginRiskHistoryOptions;
558
923
  }
559
924
  export interface EffectQbSqliteStorageStores {
560
925
  readonly userStore: UserStoreService;
561
926
  readonly credentialStore: CredentialStoreService;
562
927
  readonly sessionStore: SessionStoreService;
563
928
  readonly verificationStore: VerificationStoreService;
929
+ readonly auditLogStore: AuditLogStoreService;
564
930
  readonly loginApprovalReviewStore: LoginApprovalReviewStoreService;
931
+ readonly loginRiskHistoryStore: LoginRiskHistoryService;
565
932
  readonly trustedDeviceStore: TrustedDeviceStoreService;
566
933
  readonly passkeyCredentialStore: PasskeyCredentialStoreService;
567
934
  readonly totpFactorStore: TotpFactorStoreService;
@@ -570,8 +937,16 @@ export interface EffectQbSqliteStorageStores {
570
937
  readonly refreshTokenStore: RefreshTokenStoreService;
571
938
  readonly jwtRevocationStore: JwtRevocationStoreService;
572
939
  readonly oauthAccountStore: OAuthAccountStoreService;
940
+ readonly oauthClientStore: OAuthClientStoreService;
941
+ readonly oauthConsentStore: OAuthConsentStoreService;
942
+ readonly oauthAuthorizationCodeStore: OAuthAuthorizationCodeStoreService;
943
+ readonly oauthClientSecretStore: OAuthClientSecretStoreService;
944
+ readonly oauthProviderModeTokenStore: OAuthProviderModeTokenStoreService;
573
945
  readonly oauthProviderTokenVault: OAuthProviderTokenVaultService;
946
+ readonly domainVerificationStore: DomainVerificationStoreService;
574
947
  readonly securityTimelineStore: SecurityTimelineStoreService;
948
+ readonly webhookOutboxStore: WebhookOutboxStoreService;
949
+ readonly webhookReplayStore: WebhookReplayStoreService;
575
950
  }
576
951
  type EffectQbSqliteExecutor = Executor.QueryExecutor<never>;
577
952
  export declare const defineEffectQbAuthTables: <const Tables extends EffectQbAuthTablesInput>(tables: Tables) => AuthSqliteTables & Tables;
@@ -581,7 +956,9 @@ export declare const makeEffectQbSqliteUserStore: (executor: EffectQbSqliteExecu
581
956
  export declare const makeEffectQbSqliteCredentialStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => CredentialStoreService;
582
957
  export declare const makeEffectQbSqliteSessionStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => SessionStoreService;
583
958
  export declare const makeEffectQbSqliteVerificationStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => VerificationStoreService;
959
+ export declare const makeEffectQbSqliteAuditLogStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => AuditLogStoreService;
584
960
  export declare const makeEffectQbSqliteLoginApprovalReviewStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => LoginApprovalReviewStoreService;
961
+ export declare const makeEffectQbSqliteLoginRiskHistoryStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => LoginRiskHistoryService;
585
962
  export declare const makeEffectQbSqliteTrustedDeviceStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => TrustedDeviceStoreService;
586
963
  export declare const makeEffectQbSqlitePasskeyCredentialStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => PasskeyCredentialStoreService;
587
964
  export declare const makeEffectQbSqliteTotpFactorStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => TotpFactorStoreService;
@@ -590,11 +967,19 @@ export declare const makeEffectQbSqliteApiKeyStore: (executor: EffectQbSqliteExe
590
967
  export declare const makeEffectQbSqliteRefreshTokenStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => RefreshTokenStoreService;
591
968
  export declare const makeEffectQbSqliteJwtRevocationStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => JwtRevocationStoreService;
592
969
  export declare const makeEffectQbSqliteOAuthAccountStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => OAuthAccountStoreService;
970
+ export declare const makeEffectQbSqliteOAuthClientStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => OAuthClientStoreService;
971
+ export declare const makeEffectQbSqliteOAuthConsentStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => OAuthConsentStoreService;
972
+ export declare const makeEffectQbSqliteOAuthAuthorizationCodeStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => OAuthAuthorizationCodeStoreService;
973
+ export declare const makeEffectQbSqliteOAuthClientSecretStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => OAuthClientSecretStoreService;
974
+ export declare const makeEffectQbSqliteOAuthProviderModeTokenStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => OAuthProviderModeTokenStoreService;
593
975
  export declare const makeEffectQbSqliteOAuthProviderTokenVault: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => OAuthProviderTokenVaultService;
976
+ export declare const makeEffectQbSqliteDomainVerificationStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => DomainVerificationStoreService;
594
977
  export declare const makeEffectQbSqliteSecurityTimelineStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => SecurityTimelineStoreService;
978
+ export declare const makeEffectQbSqliteWebhookOutboxStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => WebhookOutboxStoreService;
979
+ export declare const makeEffectQbSqliteWebhookReplayStore: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => WebhookReplayStoreService;
595
980
  export declare const makeEffectQbSqliteStorage: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => EffectQbSqliteStorageStores;
596
- export declare const EffectQbSqliteAuthStorageLive: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => Layer.Layer<ApiKeyStore | UserStore | CredentialStore | SessionStore | VerificationStore | LoginApprovalReviewStore | TrustedDeviceStore | PasskeyCredentialStore | RefreshTokenStore | JwtRevocationStore | OAuthProviderTokenVault | OAuthAccountStore | RecoveryCodeStore | SecurityTimelineStore | TotpFactorStore, never, never>;
981
+ export declare const EffectQbSqliteAuthStorageLive: (executor: EffectQbSqliteExecutor, options?: EffectQbSqliteAuthStorageOptions) => Layer.Layer<ApiKeyStore | RefreshTokenStore | UserStore | CredentialStore | SessionStore | VerificationStore | LoginRiskHistory | LoginApprovalReviewStore | TrustedDeviceStore | PasskeyCredentialStore | AuditLogStore | JwtRevocationStore | OAuthClientStore | OAuthConsentStore | OAuthClientSecretStore | OAuthAuthorizationCodeStore | OAuthProviderModeTokenStore | OAuthProviderTokenVault | OAuthAccountStore | RecoveryCodeStore | SecurityTimelineStore | TotpFactorStore | DomainVerificationStore | WebhookOutboxStore | WebhookReplayStore, never, never>;
597
982
  export declare const makeD1EffectQbSqliteExecutor: (database: D1EffectQbDatabaseLike) => EffectQbSqliteExecutor;
598
- export declare const D1EffectQbSqliteAuthStorageLive: (database: D1EffectQbDatabaseLike, options?: EffectQbSqliteAuthStorageOptions) => Layer.Layer<ApiKeyStore | UserStore | CredentialStore | SessionStore | VerificationStore | LoginApprovalReviewStore | TrustedDeviceStore | PasskeyCredentialStore | RefreshTokenStore | JwtRevocationStore | OAuthProviderTokenVault | OAuthAccountStore | RecoveryCodeStore | SecurityTimelineStore | TotpFactorStore, never, never>;
983
+ export declare const D1EffectQbSqliteAuthStorageLive: (database: D1EffectQbDatabaseLike, options?: EffectQbSqliteAuthStorageOptions) => Layer.Layer<ApiKeyStore | RefreshTokenStore | UserStore | CredentialStore | SessionStore | VerificationStore | LoginRiskHistory | LoginApprovalReviewStore | TrustedDeviceStore | PasskeyCredentialStore | AuditLogStore | JwtRevocationStore | OAuthClientStore | OAuthConsentStore | OAuthClientSecretStore | OAuthAuthorizationCodeStore | OAuthProviderModeTokenStore | OAuthProviderTokenVault | OAuthAccountStore | RecoveryCodeStore | SecurityTimelineStore | TotpFactorStore | DomainVerificationStore | WebhookOutboxStore | WebhookReplayStore, never, never>;
599
984
  export {};
600
985
  //# sourceMappingURL=EffectQbSqliteStorage.d.ts.map