@atproto/pds 0.4.34 → 0.4.36

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/account-manager/db/migrations/004-oauth.d.ts +4 -0
  3. package/dist/account-manager/db/migrations/004-oauth.d.ts.map +1 -0
  4. package/dist/account-manager/db/migrations/004-oauth.js +106 -0
  5. package/dist/account-manager/db/migrations/004-oauth.js.map +1 -0
  6. package/dist/account-manager/db/migrations/index.d.ts +2 -0
  7. package/dist/account-manager/db/migrations/index.d.ts.map +1 -1
  8. package/dist/account-manager/db/migrations/index.js +2 -0
  9. package/dist/account-manager/db/migrations/index.js.map +1 -1
  10. package/dist/account-manager/db/schema/authorization-request.d.ts +19 -0
  11. package/dist/account-manager/db/schema/authorization-request.d.ts.map +1 -0
  12. package/dist/account-manager/db/schema/authorization-request.js +5 -0
  13. package/dist/account-manager/db/schema/authorization-request.js.map +1 -0
  14. package/dist/account-manager/db/schema/device-account.d.ts +14 -0
  15. package/dist/account-manager/db/schema/device-account.d.ts.map +1 -0
  16. package/dist/account-manager/db/schema/device-account.js +5 -0
  17. package/dist/account-manager/db/schema/device-account.js.map +1 -0
  18. package/dist/account-manager/db/schema/device.d.ts +16 -0
  19. package/dist/account-manager/db/schema/device.d.ts.map +1 -0
  20. package/dist/account-manager/db/schema/device.js +5 -0
  21. package/dist/account-manager/db/schema/device.js.map +1 -0
  22. package/dist/account-manager/db/schema/index.d.ts +11 -1
  23. package/dist/account-manager/db/schema/index.d.ts.map +1 -1
  24. package/dist/account-manager/db/schema/token.d.ts +24 -0
  25. package/dist/account-manager/db/schema/token.d.ts.map +1 -0
  26. package/dist/account-manager/db/schema/token.js +5 -0
  27. package/dist/account-manager/db/schema/token.js.map +1 -0
  28. package/dist/account-manager/db/schema/used-refresh-token.d.ts +12 -0
  29. package/dist/account-manager/db/schema/used-refresh-token.d.ts.map +1 -0
  30. package/dist/account-manager/db/schema/used-refresh-token.js +5 -0
  31. package/dist/account-manager/db/schema/used-refresh-token.js.map +1 -0
  32. package/dist/account-manager/helpers/account.d.ts +27 -5
  33. package/dist/account-manager/helpers/account.d.ts.map +1 -1
  34. package/dist/account-manager/helpers/account.js +15 -14
  35. package/dist/account-manager/helpers/account.js.map +1 -1
  36. package/dist/account-manager/helpers/authorization-request.d.ts +12 -0
  37. package/dist/account-manager/helpers/authorization-request.d.ts.map +1 -0
  38. package/dist/account-manager/helpers/authorization-request.js +59 -0
  39. package/dist/account-manager/helpers/authorization-request.js.map +1 -0
  40. package/dist/account-manager/helpers/device-account.d.ts +108 -0
  41. package/dist/account-manager/helpers/device-account.d.ts.map +1 -0
  42. package/dist/account-manager/helpers/device-account.js +82 -0
  43. package/dist/account-manager/helpers/device-account.js.map +1 -0
  44. package/dist/account-manager/helpers/device.d.ts +9 -0
  45. package/dist/account-manager/helpers/device.d.ts.map +1 -0
  46. package/dist/account-manager/helpers/device.js +32 -0
  47. package/dist/account-manager/helpers/device.js.map +1 -0
  48. package/dist/account-manager/helpers/token.d.ts +485 -0
  49. package/dist/account-manager/helpers/token.d.ts.map +1 -0
  50. package/dist/account-manager/helpers/token.js +123 -0
  51. package/dist/account-manager/helpers/token.js.map +1 -0
  52. package/dist/account-manager/helpers/used-refresh-token.d.ts +10 -0
  53. package/dist/account-manager/helpers/used-refresh-token.d.ts.map +1 -0
  54. package/dist/account-manager/helpers/used-refresh-token.js +25 -0
  55. package/dist/account-manager/helpers/used-refresh-token.js.map +1 -0
  56. package/dist/account-manager/index.d.ts +36 -6
  57. package/dist/account-manager/index.d.ts.map +1 -1
  58. package/dist/account-manager/index.js +223 -22
  59. package/dist/account-manager/index.js.map +1 -1
  60. package/dist/actor-store/preference/reader.js.map +1 -1
  61. package/dist/actor-store/record/reader.d.ts +1 -1
  62. package/dist/api/app/bsky/util/resolver.d.ts +1 -1
  63. package/dist/api/com/atproto/server/createSession.d.ts.map +1 -1
  64. package/dist/api/com/atproto/server/createSession.js +7 -31
  65. package/dist/api/com/atproto/server/createSession.js.map +1 -1
  66. package/dist/api/com/atproto/server/deleteSession.d.ts.map +1 -1
  67. package/dist/api/com/atproto/server/deleteSession.js +14 -13
  68. package/dist/api/com/atproto/server/deleteSession.js.map +1 -1
  69. package/dist/api/com/atproto/server/getSession.d.ts.map +1 -1
  70. package/dist/api/com/atproto/server/getSession.js +4 -2
  71. package/dist/api/com/atproto/server/getSession.js.map +1 -1
  72. package/dist/api/com/atproto/server/refreshSession.d.ts.map +1 -1
  73. package/dist/api/com/atproto/server/refreshSession.js +4 -2
  74. package/dist/api/com/atproto/server/refreshSession.js.map +1 -1
  75. package/dist/api/com/atproto/sync/getRepoStatus.d.ts.map +1 -1
  76. package/dist/api/com/atproto/sync/getRepoStatus.js +2 -1
  77. package/dist/api/com/atproto/sync/getRepoStatus.js.map +1 -1
  78. package/dist/api/com/atproto/sync/listRepos.js +2 -2
  79. package/dist/api/com/atproto/sync/listRepos.js.map +1 -1
  80. package/dist/api/proxy.d.ts.map +1 -1
  81. package/dist/api/proxy.js +15 -2
  82. package/dist/api/proxy.js.map +1 -1
  83. package/dist/auth-routes.d.ts +4 -0
  84. package/dist/auth-routes.d.ts.map +1 -0
  85. package/dist/auth-routes.js +24 -0
  86. package/dist/auth-routes.js.map +1 -0
  87. package/dist/auth-verifier.d.ts +32 -11
  88. package/dist/auth-verifier.d.ts.map +1 -1
  89. package/dist/auth-verifier.js +238 -79
  90. package/dist/auth-verifier.js.map +1 -1
  91. package/dist/config/config.d.ts +12 -0
  92. package/dist/config/config.d.ts.map +1 -1
  93. package/dist/config/config.js +45 -0
  94. package/dist/config/config.js.map +1 -1
  95. package/dist/config/env.d.ts +8 -0
  96. package/dist/config/env.d.ts.map +1 -1
  97. package/dist/config/env.js +10 -0
  98. package/dist/config/env.js.map +1 -1
  99. package/dist/config/secrets.d.ts +1 -0
  100. package/dist/config/secrets.d.ts.map +1 -1
  101. package/dist/config/secrets.js +1 -0
  102. package/dist/config/secrets.js.map +1 -1
  103. package/dist/context.d.ts +6 -0
  104. package/dist/context.d.ts.map +1 -1
  105. package/dist/context.js +71 -13
  106. package/dist/context.js.map +1 -1
  107. package/dist/db/cast.d.ts +15 -0
  108. package/dist/db/cast.d.ts.map +1 -0
  109. package/dist/db/cast.js +66 -0
  110. package/dist/db/cast.js.map +1 -0
  111. package/dist/db/db.d.ts +2 -2
  112. package/dist/db/db.d.ts.map +1 -1
  113. package/dist/db/db.js +9 -7
  114. package/dist/db/db.js.map +1 -1
  115. package/dist/db/index.d.ts +1 -0
  116. package/dist/db/index.d.ts.map +1 -1
  117. package/dist/db/index.js +1 -0
  118. package/dist/db/index.js.map +1 -1
  119. package/dist/error.d.ts.map +1 -1
  120. package/dist/error.js +5 -0
  121. package/dist/error.js.map +1 -1
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.js +2 -0
  124. package/dist/index.js.map +1 -1
  125. package/dist/logger.d.ts +13 -11
  126. package/dist/logger.d.ts.map +1 -1
  127. package/dist/logger.js +80 -64
  128. package/dist/logger.js.map +1 -1
  129. package/dist/oauth/detailed-account-store.d.ts +27 -0
  130. package/dist/oauth/detailed-account-store.d.ts.map +1 -0
  131. package/dist/oauth/detailed-account-store.js +76 -0
  132. package/dist/oauth/detailed-account-store.js.map +1 -0
  133. package/dist/oauth/provider.d.ts +16 -0
  134. package/dist/oauth/provider.d.ts.map +1 -0
  135. package/dist/oauth/provider.js +45 -0
  136. package/dist/oauth/provider.js.map +1 -0
  137. package/dist/pipethrough.d.ts.map +1 -1
  138. package/dist/pipethrough.js.map +1 -1
  139. package/dist/sequencer/events.d.ts +2 -2
  140. package/example.env +21 -3
  141. package/package.json +9 -7
  142. package/src/account-manager/db/migrations/004-oauth.ts +122 -0
  143. package/src/account-manager/db/migrations/index.ts +2 -0
  144. package/src/account-manager/db/schema/authorization-request.ts +26 -0
  145. package/src/account-manager/db/schema/device-account.ts +15 -0
  146. package/src/account-manager/db/schema/device.ts +18 -0
  147. package/src/account-manager/db/schema/index.ts +15 -0
  148. package/src/account-manager/db/schema/token.ts +34 -0
  149. package/src/account-manager/db/schema/used-refresh-token.ts +13 -0
  150. package/src/account-manager/helpers/account.ts +16 -21
  151. package/src/account-manager/helpers/authorization-request.ts +82 -0
  152. package/src/account-manager/helpers/device-account.ts +135 -0
  153. package/src/account-manager/helpers/device.ts +45 -0
  154. package/src/account-manager/helpers/token.ts +185 -0
  155. package/src/account-manager/helpers/used-refresh-token.ts +30 -0
  156. package/src/account-manager/index.ts +325 -20
  157. package/src/actor-store/preference/reader.ts +1 -1
  158. package/src/api/com/atproto/server/createSession.ts +8 -44
  159. package/src/api/com/atproto/server/deleteSession.ts +14 -20
  160. package/src/api/com/atproto/server/getSession.ts +7 -2
  161. package/src/api/com/atproto/server/refreshSession.ts +6 -2
  162. package/src/api/com/atproto/sync/getRepoStatus.ts +3 -1
  163. package/src/api/com/atproto/sync/listRepos.ts +1 -1
  164. package/src/api/proxy.ts +18 -2
  165. package/src/auth-routes.ts +27 -0
  166. package/src/auth-verifier.ts +312 -92
  167. package/src/config/config.ts +66 -0
  168. package/src/config/env.ts +24 -0
  169. package/src/config/secrets.ts +2 -0
  170. package/src/context.ts +80 -14
  171. package/src/db/cast.ts +59 -0
  172. package/src/db/db.ts +15 -12
  173. package/src/db/index.ts +1 -0
  174. package/src/error.ts +7 -0
  175. package/src/index.ts +2 -0
  176. package/src/logger.ts +83 -38
  177. package/src/oauth/detailed-account-store.ts +96 -0
  178. package/src/oauth/provider.ts +77 -0
  179. package/src/pipethrough.ts +3 -2
@@ -0,0 +1,485 @@
1
+ import { Code, NewTokenData, RefreshToken, TokenData, TokenId, TokenInfo } from '@atproto/oauth-provider';
2
+ import { Selectable } from 'kysely';
3
+ import { AccountDb, Token } from '../db';
4
+ import { ActorAccount } from './account';
5
+ import { SelectableDeviceAccount } from './device-account';
6
+ type LeftJoined<T> = {
7
+ [K in keyof T]: null | T[K];
8
+ };
9
+ export type ActorAccountToken = Selectable<ActorAccount> & Selectable<Omit<Token, 'id' | 'did'>> & LeftJoined<SelectableDeviceAccount>;
10
+ export declare const toTokenInfo: (row: ActorAccountToken, audience: string) => TokenInfo;
11
+ export declare const createQB: (db: AccountDb, tokenId: TokenId, data: TokenData, refreshToken?: RefreshToken) => import("kysely").InsertQueryBuilder<import("../db").DatabaseSchema, "token", import("kysely").InsertResult>;
12
+ export declare const forRotateQB: (db: AccountDb, id: TokenId) => import("kysely/dist/cjs/parser/select-parser").QueryBuilderWithSelection<import("kysely/dist/cjs/parser/table-parser").From<import("../db").DatabaseSchema, "token">, "token", {}, "id" | "currentRefreshToken">;
13
+ export declare const findByQB: (db: AccountDb, search: {
14
+ id?: number;
15
+ code?: Code;
16
+ tokenId?: TokenId;
17
+ currentRefreshToken?: RefreshToken;
18
+ }) => import("kysely").SelectQueryBuilder<{
19
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
20
+ token: Token;
21
+ actor: import("../db").Actor;
22
+ device: import("../db").Device;
23
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
24
+ authorization_request: import("../db").AuthorizationRequest;
25
+ used_refresh_token: import("../db").UsedRefreshToken;
26
+ repo_root: import("../db").RepoRoot;
27
+ refresh_token: import("../db").RefreshToken;
28
+ app_password: import("../db").AppPassword;
29
+ invite_code: import("../db").InviteCode;
30
+ invite_code_use: import("../db").InviteCodeUse;
31
+ email_token: import("../db").EmailToken;
32
+ }, "token" | "account" | "actor" | "device_account", import("kysely/dist/cjs/util/type-utils").MergePartial<import("kysely/dist/cjs/util/type-utils").MergePartial<import("kysely/dist/cjs/util/type-utils").MergePartial<import("kysely/dist/cjs/util/type-utils").MergePartial<Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
33
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
34
+ token: Token;
35
+ actor: import("../db").Actor;
36
+ device: import("../db").Device;
37
+ device_account: import("../db").DeviceAccount;
38
+ authorization_request: import("../db").AuthorizationRequest;
39
+ used_refresh_token: import("../db").UsedRefreshToken;
40
+ repo_root: import("../db").RepoRoot;
41
+ refresh_token: import("../db").RefreshToken;
42
+ app_password: import("../db").AppPassword;
43
+ invite_code: import("../db").InviteCode;
44
+ invite_code_use: import("../db").InviteCodeUse;
45
+ email_token: import("../db").EmailToken;
46
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
47
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
48
+ token: Token;
49
+ actor: import("../db").Actor;
50
+ device: import("../db").Device;
51
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
52
+ authorization_request: import("../db").AuthorizationRequest;
53
+ used_refresh_token: import("../db").UsedRefreshToken;
54
+ repo_root: import("../db").RepoRoot;
55
+ refresh_token: import("../db").RefreshToken;
56
+ app_password: import("../db").AppPassword;
57
+ invite_code: import("../db").InviteCode;
58
+ invite_code_use: import("../db").InviteCodeUse;
59
+ email_token: import("../db").EmailToken;
60
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">, Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
61
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
62
+ token: Token;
63
+ actor: import("../db").Actor;
64
+ device: import("../db").Device;
65
+ device_account: import("../db").DeviceAccount;
66
+ authorization_request: import("../db").AuthorizationRequest;
67
+ used_refresh_token: import("../db").UsedRefreshToken;
68
+ repo_root: import("../db").RepoRoot;
69
+ refresh_token: import("../db").RefreshToken;
70
+ app_password: import("../db").AppPassword;
71
+ invite_code: import("../db").InviteCode;
72
+ invite_code_use: import("../db").InviteCodeUse;
73
+ email_token: import("../db").EmailToken;
74
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
75
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
76
+ token: Token;
77
+ actor: import("../db").Actor;
78
+ device: import("../db").Device;
79
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
80
+ authorization_request: import("../db").AuthorizationRequest;
81
+ used_refresh_token: import("../db").UsedRefreshToken;
82
+ repo_root: import("../db").RepoRoot;
83
+ refresh_token: import("../db").RefreshToken;
84
+ app_password: import("../db").AppPassword;
85
+ invite_code: import("../db").InviteCode;
86
+ invite_code_use: import("../db").InviteCodeUse;
87
+ email_token: import("../db").EmailToken;
88
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">>, import("kysely/dist/cjs/util/type-utils").MergePartial<Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
89
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
90
+ token: Token;
91
+ actor: import("../db").Actor;
92
+ device: import("../db").Device;
93
+ device_account: import("../db").DeviceAccount;
94
+ authorization_request: import("../db").AuthorizationRequest;
95
+ used_refresh_token: import("../db").UsedRefreshToken;
96
+ repo_root: import("../db").RepoRoot;
97
+ refresh_token: import("../db").RefreshToken;
98
+ app_password: import("../db").AppPassword;
99
+ invite_code: import("../db").InviteCode;
100
+ invite_code_use: import("../db").InviteCodeUse;
101
+ email_token: import("../db").EmailToken;
102
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
103
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
104
+ token: Token;
105
+ actor: import("../db").Actor;
106
+ device: import("../db").Device;
107
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
108
+ authorization_request: import("../db").AuthorizationRequest;
109
+ used_refresh_token: import("../db").UsedRefreshToken;
110
+ repo_root: import("../db").RepoRoot;
111
+ refresh_token: import("../db").RefreshToken;
112
+ app_password: import("../db").AppPassword;
113
+ invite_code: import("../db").InviteCode;
114
+ invite_code_use: import("../db").InviteCodeUse;
115
+ email_token: import("../db").EmailToken;
116
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">, Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
117
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
118
+ token: Token;
119
+ actor: import("../db").Actor;
120
+ device: import("../db").Device;
121
+ device_account: import("../db").DeviceAccount;
122
+ authorization_request: import("../db").AuthorizationRequest;
123
+ used_refresh_token: import("../db").UsedRefreshToken;
124
+ repo_root: import("../db").RepoRoot;
125
+ refresh_token: import("../db").RefreshToken;
126
+ app_password: import("../db").AppPassword;
127
+ invite_code: import("../db").InviteCode;
128
+ invite_code_use: import("../db").InviteCodeUse;
129
+ email_token: import("../db").EmailToken;
130
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
131
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
132
+ token: Token;
133
+ actor: import("../db").Actor;
134
+ device: import("../db").Device;
135
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
136
+ authorization_request: import("../db").AuthorizationRequest;
137
+ used_refresh_token: import("../db").UsedRefreshToken;
138
+ repo_root: import("../db").RepoRoot;
139
+ refresh_token: import("../db").RefreshToken;
140
+ app_password: import("../db").AppPassword;
141
+ invite_code: import("../db").InviteCode;
142
+ invite_code_use: import("../db").InviteCodeUse;
143
+ email_token: import("../db").EmailToken;
144
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">>>, import("kysely/dist/cjs/util/type-utils").MergePartial<import("kysely/dist/cjs/util/type-utils").MergePartial<Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
145
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
146
+ token: Token;
147
+ actor: import("../db").Actor;
148
+ device: import("../db").Device;
149
+ device_account: import("../db").DeviceAccount;
150
+ authorization_request: import("../db").AuthorizationRequest;
151
+ used_refresh_token: import("../db").UsedRefreshToken;
152
+ repo_root: import("../db").RepoRoot;
153
+ refresh_token: import("../db").RefreshToken;
154
+ app_password: import("../db").AppPassword;
155
+ invite_code: import("../db").InviteCode;
156
+ invite_code_use: import("../db").InviteCodeUse;
157
+ email_token: import("../db").EmailToken;
158
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
159
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
160
+ token: Token;
161
+ actor: import("../db").Actor;
162
+ device: import("../db").Device;
163
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
164
+ authorization_request: import("../db").AuthorizationRequest;
165
+ used_refresh_token: import("../db").UsedRefreshToken;
166
+ repo_root: import("../db").RepoRoot;
167
+ refresh_token: import("../db").RefreshToken;
168
+ app_password: import("../db").AppPassword;
169
+ invite_code: import("../db").InviteCode;
170
+ invite_code_use: import("../db").InviteCodeUse;
171
+ email_token: import("../db").EmailToken;
172
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">, Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
173
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
174
+ token: Token;
175
+ actor: import("../db").Actor;
176
+ device: import("../db").Device;
177
+ device_account: import("../db").DeviceAccount;
178
+ authorization_request: import("../db").AuthorizationRequest;
179
+ used_refresh_token: import("../db").UsedRefreshToken;
180
+ repo_root: import("../db").RepoRoot;
181
+ refresh_token: import("../db").RefreshToken;
182
+ app_password: import("../db").AppPassword;
183
+ invite_code: import("../db").InviteCode;
184
+ invite_code_use: import("../db").InviteCodeUse;
185
+ email_token: import("../db").EmailToken;
186
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
187
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
188
+ token: Token;
189
+ actor: import("../db").Actor;
190
+ device: import("../db").Device;
191
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
192
+ authorization_request: import("../db").AuthorizationRequest;
193
+ used_refresh_token: import("../db").UsedRefreshToken;
194
+ repo_root: import("../db").RepoRoot;
195
+ refresh_token: import("../db").RefreshToken;
196
+ app_password: import("../db").AppPassword;
197
+ invite_code: import("../db").InviteCode;
198
+ invite_code_use: import("../db").InviteCodeUse;
199
+ email_token: import("../db").EmailToken;
200
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">>, import("kysely/dist/cjs/util/type-utils").MergePartial<Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
201
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
202
+ token: Token;
203
+ actor: import("../db").Actor;
204
+ device: import("../db").Device;
205
+ device_account: import("../db").DeviceAccount;
206
+ authorization_request: import("../db").AuthorizationRequest;
207
+ used_refresh_token: import("../db").UsedRefreshToken;
208
+ repo_root: import("../db").RepoRoot;
209
+ refresh_token: import("../db").RefreshToken;
210
+ app_password: import("../db").AppPassword;
211
+ invite_code: import("../db").InviteCode;
212
+ invite_code_use: import("../db").InviteCodeUse;
213
+ email_token: import("../db").EmailToken;
214
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
215
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
216
+ token: Token;
217
+ actor: import("../db").Actor;
218
+ device: import("../db").Device;
219
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
220
+ authorization_request: import("../db").AuthorizationRequest;
221
+ used_refresh_token: import("../db").UsedRefreshToken;
222
+ repo_root: import("../db").RepoRoot;
223
+ refresh_token: import("../db").RefreshToken;
224
+ app_password: import("../db").AppPassword;
225
+ invite_code: import("../db").InviteCode;
226
+ invite_code_use: import("../db").InviteCodeUse;
227
+ email_token: import("../db").EmailToken;
228
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">, Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
229
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
230
+ token: Token;
231
+ actor: import("../db").Actor;
232
+ device: import("../db").Device;
233
+ device_account: import("../db").DeviceAccount;
234
+ authorization_request: import("../db").AuthorizationRequest;
235
+ used_refresh_token: import("../db").UsedRefreshToken;
236
+ repo_root: import("../db").RepoRoot;
237
+ refresh_token: import("../db").RefreshToken;
238
+ app_password: import("../db").AppPassword;
239
+ invite_code: import("../db").InviteCode;
240
+ invite_code_use: import("../db").InviteCodeUse;
241
+ email_token: import("../db").EmailToken;
242
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
243
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
244
+ token: Token;
245
+ actor: import("../db").Actor;
246
+ device: import("../db").Device;
247
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
248
+ authorization_request: import("../db").AuthorizationRequest;
249
+ used_refresh_token: import("../db").UsedRefreshToken;
250
+ repo_root: import("../db").RepoRoot;
251
+ refresh_token: import("../db").RefreshToken;
252
+ app_password: import("../db").AppPassword;
253
+ invite_code: import("../db").InviteCode;
254
+ invite_code_use: import("../db").InviteCodeUse;
255
+ email_token: import("../db").EmailToken;
256
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">>>>, import("kysely/dist/cjs/util/type-utils").MergePartial<import("kysely/dist/cjs/util/type-utils").MergePartial<import("kysely/dist/cjs/util/type-utils").MergePartial<Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
257
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
258
+ token: Token;
259
+ actor: import("../db").Actor;
260
+ device: import("../db").Device;
261
+ device_account: import("../db").DeviceAccount;
262
+ authorization_request: import("../db").AuthorizationRequest;
263
+ used_refresh_token: import("../db").UsedRefreshToken;
264
+ repo_root: import("../db").RepoRoot;
265
+ refresh_token: import("../db").RefreshToken;
266
+ app_password: import("../db").AppPassword;
267
+ invite_code: import("../db").InviteCode;
268
+ invite_code_use: import("../db").InviteCodeUse;
269
+ email_token: import("../db").EmailToken;
270
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
271
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
272
+ token: Token;
273
+ actor: import("../db").Actor;
274
+ device: import("../db").Device;
275
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
276
+ authorization_request: import("../db").AuthorizationRequest;
277
+ used_refresh_token: import("../db").UsedRefreshToken;
278
+ repo_root: import("../db").RepoRoot;
279
+ refresh_token: import("../db").RefreshToken;
280
+ app_password: import("../db").AppPassword;
281
+ invite_code: import("../db").InviteCode;
282
+ invite_code_use: import("../db").InviteCodeUse;
283
+ email_token: import("../db").EmailToken;
284
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">, Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
285
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
286
+ token: Token;
287
+ actor: import("../db").Actor;
288
+ device: import("../db").Device;
289
+ device_account: import("../db").DeviceAccount;
290
+ authorization_request: import("../db").AuthorizationRequest;
291
+ used_refresh_token: import("../db").UsedRefreshToken;
292
+ repo_root: import("../db").RepoRoot;
293
+ refresh_token: import("../db").RefreshToken;
294
+ app_password: import("../db").AppPassword;
295
+ invite_code: import("../db").InviteCode;
296
+ invite_code_use: import("../db").InviteCodeUse;
297
+ email_token: import("../db").EmailToken;
298
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
299
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
300
+ token: Token;
301
+ actor: import("../db").Actor;
302
+ device: import("../db").Device;
303
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
304
+ authorization_request: import("../db").AuthorizationRequest;
305
+ used_refresh_token: import("../db").UsedRefreshToken;
306
+ repo_root: import("../db").RepoRoot;
307
+ refresh_token: import("../db").RefreshToken;
308
+ app_password: import("../db").AppPassword;
309
+ invite_code: import("../db").InviteCode;
310
+ invite_code_use: import("../db").InviteCodeUse;
311
+ email_token: import("../db").EmailToken;
312
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">>, import("kysely/dist/cjs/util/type-utils").MergePartial<Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
313
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
314
+ token: Token;
315
+ actor: import("../db").Actor;
316
+ device: import("../db").Device;
317
+ device_account: import("../db").DeviceAccount;
318
+ authorization_request: import("../db").AuthorizationRequest;
319
+ used_refresh_token: import("../db").UsedRefreshToken;
320
+ repo_root: import("../db").RepoRoot;
321
+ refresh_token: import("../db").RefreshToken;
322
+ app_password: import("../db").AppPassword;
323
+ invite_code: import("../db").InviteCode;
324
+ invite_code_use: import("../db").InviteCodeUse;
325
+ email_token: import("../db").EmailToken;
326
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
327
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
328
+ token: Token;
329
+ actor: import("../db").Actor;
330
+ device: import("../db").Device;
331
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
332
+ authorization_request: import("../db").AuthorizationRequest;
333
+ used_refresh_token: import("../db").UsedRefreshToken;
334
+ repo_root: import("../db").RepoRoot;
335
+ refresh_token: import("../db").RefreshToken;
336
+ app_password: import("../db").AppPassword;
337
+ invite_code: import("../db").InviteCode;
338
+ invite_code_use: import("../db").InviteCodeUse;
339
+ email_token: import("../db").EmailToken;
340
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">, Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
341
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
342
+ token: Token;
343
+ actor: import("../db").Actor;
344
+ device: import("../db").Device;
345
+ device_account: import("../db").DeviceAccount;
346
+ authorization_request: import("../db").AuthorizationRequest;
347
+ used_refresh_token: import("../db").UsedRefreshToken;
348
+ repo_root: import("../db").RepoRoot;
349
+ refresh_token: import("../db").RefreshToken;
350
+ app_password: import("../db").AppPassword;
351
+ invite_code: import("../db").InviteCode;
352
+ invite_code_use: import("../db").InviteCodeUse;
353
+ email_token: import("../db").EmailToken;
354
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
355
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
356
+ token: Token;
357
+ actor: import("../db").Actor;
358
+ device: import("../db").Device;
359
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
360
+ authorization_request: import("../db").AuthorizationRequest;
361
+ used_refresh_token: import("../db").UsedRefreshToken;
362
+ repo_root: import("../db").RepoRoot;
363
+ refresh_token: import("../db").RefreshToken;
364
+ app_password: import("../db").AppPassword;
365
+ invite_code: import("../db").InviteCode;
366
+ invite_code_use: import("../db").InviteCodeUse;
367
+ email_token: import("../db").EmailToken;
368
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">>>, import("kysely/dist/cjs/util/type-utils").MergePartial<import("kysely/dist/cjs/util/type-utils").MergePartial<Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
369
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
370
+ token: Token;
371
+ actor: import("../db").Actor;
372
+ device: import("../db").Device;
373
+ device_account: import("../db").DeviceAccount;
374
+ authorization_request: import("../db").AuthorizationRequest;
375
+ used_refresh_token: import("../db").UsedRefreshToken;
376
+ repo_root: import("../db").RepoRoot;
377
+ refresh_token: import("../db").RefreshToken;
378
+ app_password: import("../db").AppPassword;
379
+ invite_code: import("../db").InviteCode;
380
+ invite_code_use: import("../db").InviteCodeUse;
381
+ email_token: import("../db").EmailToken;
382
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
383
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
384
+ token: Token;
385
+ actor: import("../db").Actor;
386
+ device: import("../db").Device;
387
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
388
+ authorization_request: import("../db").AuthorizationRequest;
389
+ used_refresh_token: import("../db").UsedRefreshToken;
390
+ repo_root: import("../db").RepoRoot;
391
+ refresh_token: import("../db").RefreshToken;
392
+ app_password: import("../db").AppPassword;
393
+ invite_code: import("../db").InviteCode;
394
+ invite_code_use: import("../db").InviteCodeUse;
395
+ email_token: import("../db").EmailToken;
396
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">, Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
397
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
398
+ token: Token;
399
+ actor: import("../db").Actor;
400
+ device: import("../db").Device;
401
+ device_account: import("../db").DeviceAccount;
402
+ authorization_request: import("../db").AuthorizationRequest;
403
+ used_refresh_token: import("../db").UsedRefreshToken;
404
+ repo_root: import("../db").RepoRoot;
405
+ refresh_token: import("../db").RefreshToken;
406
+ app_password: import("../db").AppPassword;
407
+ invite_code: import("../db").InviteCode;
408
+ invite_code_use: import("../db").InviteCodeUse;
409
+ email_token: import("../db").EmailToken;
410
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
411
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
412
+ token: Token;
413
+ actor: import("../db").Actor;
414
+ device: import("../db").Device;
415
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
416
+ authorization_request: import("../db").AuthorizationRequest;
417
+ used_refresh_token: import("../db").UsedRefreshToken;
418
+ repo_root: import("../db").RepoRoot;
419
+ refresh_token: import("../db").RefreshToken;
420
+ app_password: import("../db").AppPassword;
421
+ invite_code: import("../db").InviteCode;
422
+ invite_code_use: import("../db").InviteCodeUse;
423
+ email_token: import("../db").EmailToken;
424
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">>, import("kysely/dist/cjs/util/type-utils").MergePartial<Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
425
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
426
+ token: Token;
427
+ actor: import("../db").Actor;
428
+ device: import("../db").Device;
429
+ device_account: import("../db").DeviceAccount;
430
+ authorization_request: import("../db").AuthorizationRequest;
431
+ used_refresh_token: import("../db").UsedRefreshToken;
432
+ repo_root: import("../db").RepoRoot;
433
+ refresh_token: import("../db").RefreshToken;
434
+ app_password: import("../db").AppPassword;
435
+ invite_code: import("../db").InviteCode;
436
+ invite_code_use: import("../db").InviteCodeUse;
437
+ email_token: import("../db").EmailToken;
438
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
439
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
440
+ token: Token;
441
+ actor: import("../db").Actor;
442
+ device: import("../db").Device;
443
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
444
+ authorization_request: import("../db").AuthorizationRequest;
445
+ used_refresh_token: import("../db").UsedRefreshToken;
446
+ repo_root: import("../db").RepoRoot;
447
+ refresh_token: import("../db").RefreshToken;
448
+ app_password: import("../db").AppPassword;
449
+ invite_code: import("../db").InviteCode;
450
+ invite_code_use: import("../db").InviteCodeUse;
451
+ email_token: import("../db").EmailToken;
452
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">, Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
453
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
454
+ token: Token;
455
+ actor: import("../db").Actor;
456
+ device: import("../db").Device;
457
+ device_account: import("../db").DeviceAccount;
458
+ authorization_request: import("../db").AuthorizationRequest;
459
+ used_refresh_token: import("../db").UsedRefreshToken;
460
+ repo_root: import("../db").RepoRoot;
461
+ refresh_token: import("../db").RefreshToken;
462
+ app_password: import("../db").AppPassword;
463
+ invite_code: import("../db").InviteCode;
464
+ invite_code_use: import("../db").InviteCodeUse;
465
+ email_token: import("../db").EmailToken;
466
+ }, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
467
+ account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
468
+ token: Token;
469
+ actor: import("../db").Actor;
470
+ device: import("../db").Device;
471
+ device_account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").DeviceAccount>;
472
+ authorization_request: import("../db").AuthorizationRequest;
473
+ used_refresh_token: import("../db").UsedRefreshToken;
474
+ repo_root: import("../db").RepoRoot;
475
+ refresh_token: import("../db").RefreshToken;
476
+ app_password: import("../db").AppPassword;
477
+ invite_code: import("../db").InviteCode;
478
+ invite_code_use: import("../db").InviteCodeUse;
479
+ email_token: import("../db").EmailToken;
480
+ }, "token" | "account" | "actor" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients" | "token.did" | "token.code" | "token.tokenId" | "token.createdAt" | "token.updatedAt" | "token.deviceId" | "token.clientId" | "token.clientAuth" | "token.parameters" | "token.expiresAt" | "token.details" | "token.currentRefreshToken">>>>>>;
481
+ export declare const removeByDidQB: (db: AccountDb, did: string) => import("kysely").DeleteQueryBuilder<import("kysely/dist/cjs/parser/table-parser").From<import("../db").DatabaseSchema, "token">, "token", import("kysely").DeleteResult>;
482
+ export declare const rotateQB: (db: AccountDb, id: number, newTokenId: TokenId, newRefreshToken: RefreshToken, newData: NewTokenData) => import("kysely").UpdateQueryBuilder<import("kysely/dist/cjs/parser/table-parser").From<import("../db").DatabaseSchema, "token">, "token", "token", import("kysely").UpdateResult>;
483
+ export declare const removeQB: (db: AccountDb, tokenId: TokenId) => import("kysely").DeleteQueryBuilder<import("kysely/dist/cjs/parser/table-parser").From<import("../db").DatabaseSchema, "token">, "token", import("kysely").DeleteResult>;
484
+ export {};
485
+ //# sourceMappingURL=token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/account-manager/helpers/token.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,YAAY,EAEZ,YAAY,EACZ,SAAS,EACT,OAAO,EACP,SAAS,EACV,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AASnC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,YAAY,EAAmB,MAAM,WAAW,CAAA;AACzD,OAAO,EACL,uBAAuB,EAGxB,MAAM,kBAAkB,CAAA;AAEzB,KAAK,UAAU,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAA;AAEpD,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,YAAY,CAAC,GACtD,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC,GACrC,UAAU,CAAC,uBAAuB,CAAC,CAAA;AAErC,eAAO,MAAM,WAAW,QACjB,iBAAiB,YACZ,MAAM,KACf,SAwBD,CAAA;AA+BF,eAAO,MAAM,QAAQ,2BAEV,OAAO,QACV,SAAS,iBACA,YAAY,gHAezB,CAAA;AAEJ,eAAO,MAAM,WAAW,sBAAuB,OAAO,qNAKZ,CAAA;AAE1C,eAAO,MAAM,QAAQ,0BAEX;IACN,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,mBAAmB,CAAC,EAAE,YAAY,CAAA;CACnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uYA+BF,CAAA;AAED,eAAO,MAAM,aAAa,uBAAwB,MAAM,6KAEN,CAAA;AAElD,eAAO,MAAM,QAAQ,sBAEf,MAAM,cACE,OAAO,mBACF,YAAY,WACpB,YAAY,sLAaE,CAAA;AAEzB,eAAO,MAAM,QAAQ,2BAA4B,OAAO,6KAEE,CAAA"}
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeQB = exports.rotateQB = exports.removeByDidQB = exports.findByQB = exports.forRotateQB = exports.createQB = exports.toTokenInfo = void 0;
4
+ const db_1 = require("../../db");
5
+ const account_1 = require("./account");
6
+ const device_account_1 = require("./device-account");
7
+ const toTokenInfo = (row, audience) => ({
8
+ id: row.tokenId,
9
+ data: {
10
+ createdAt: (0, db_1.fromDateISO)(row.createdAt),
11
+ expiresAt: (0, db_1.fromDateISO)(row.expiresAt),
12
+ updatedAt: (0, db_1.fromDateISO)(row.updatedAt),
13
+ clientId: row.clientId,
14
+ clientAuth: (0, db_1.fromJsonObject)(row.clientAuth),
15
+ deviceId: row.deviceId,
16
+ sub: row.did,
17
+ parameters: (0, db_1.fromJsonObject)(row.parameters),
18
+ details: row.details
19
+ ? (0, db_1.fromJsonArray)(row.details)
20
+ : null,
21
+ code: row.code,
22
+ },
23
+ account: (0, device_account_1.toAccount)(row, audience),
24
+ info: row.authenticatedAt != null &&
25
+ row.authorizedClients != null &&
26
+ row.remember != null
27
+ ? (0, device_account_1.toDeviceAccountInfo)(row)
28
+ : undefined,
29
+ currentRefreshToken: row.currentRefreshToken,
30
+ });
31
+ exports.toTokenInfo = toTokenInfo;
32
+ const selectTokenInfoQB = (db) => (0, account_1.selectAccountQB)(db, { includeDeactivated: true })
33
+ // uses "token_did_idx" index (though unlikely in practice)
34
+ .innerJoin('token', 'token.did', 'actor.did')
35
+ .leftJoin('device_account', (join) => join
36
+ // uses "device_account_pk" index
37
+ .on('device_account.did', '=', 'token.did')
38
+ // @ts-expect-error "deviceId" is nullable in token
39
+ .on('device_account.deviceId', '=', 'token.deviceId'))
40
+ .select([
41
+ 'token.tokenId',
42
+ 'token.createdAt',
43
+ 'token.updatedAt',
44
+ 'token.expiresAt',
45
+ 'token.clientId',
46
+ 'token.clientAuth',
47
+ 'token.deviceId',
48
+ 'token.did',
49
+ 'token.parameters',
50
+ 'token.details',
51
+ 'token.code',
52
+ 'token.currentRefreshToken',
53
+ 'device_account.authenticatedAt',
54
+ 'device_account.authorizedClients',
55
+ 'device_account.remember',
56
+ ]);
57
+ const createQB = (db, tokenId, data, refreshToken) => db.db.insertInto('token').values({
58
+ tokenId,
59
+ createdAt: (0, db_1.toDateISO)(data.createdAt),
60
+ expiresAt: (0, db_1.toDateISO)(data.expiresAt),
61
+ updatedAt: (0, db_1.toDateISO)(data.updatedAt),
62
+ clientId: data.clientId,
63
+ clientAuth: (0, db_1.toJsonObject)(data.clientAuth),
64
+ deviceId: data.deviceId,
65
+ did: data.sub,
66
+ parameters: (0, db_1.toJsonObject)(data.parameters),
67
+ details: data.details ? (0, db_1.toJsonArray)(data.details) : null,
68
+ code: data.code,
69
+ currentRefreshToken: refreshToken || null,
70
+ });
71
+ exports.createQB = createQB;
72
+ const forRotateQB = (db, id) => db.db
73
+ .selectFrom('token')
74
+ .where('tokenId', '=', id)
75
+ .where('currentRefreshToken', 'is not', null)
76
+ .select(['id', 'currentRefreshToken']);
77
+ exports.forRotateQB = forRotateQB;
78
+ const findByQB = (db, search) => {
79
+ if (search.id === undefined &&
80
+ search.code === undefined &&
81
+ search.tokenId === undefined &&
82
+ search.currentRefreshToken === undefined) {
83
+ // Prevent accidental scan
84
+ throw new TypeError('At least one search parameter is required');
85
+ }
86
+ return selectTokenInfoQB(db)
87
+ .if(search.id !== undefined, (qb) =>
88
+ // uses primary key index
89
+ qb.where('token.id', '=', search.id))
90
+ .if(search.code !== undefined, (qb) =>
91
+ // uses "token_code_idx" partial index (hence the null check)
92
+ qb
93
+ .where('token.code', '=', search.code)
94
+ .where('token.code', 'is not', null))
95
+ .if(search.tokenId !== undefined, (qb) =>
96
+ // uses "token_token_id_idx"
97
+ qb.where('token.tokenId', '=', search.tokenId))
98
+ .if(search.currentRefreshToken !== undefined, (qb) =>
99
+ // uses "token_refresh_token_unique_idx"
100
+ qb.where('token.currentRefreshToken', '=', search.currentRefreshToken));
101
+ };
102
+ exports.findByQB = findByQB;
103
+ const removeByDidQB = (db, did) =>
104
+ // uses "token_did_idx" index
105
+ db.db.deleteFrom('token').where('did', '=', did);
106
+ exports.removeByDidQB = removeByDidQB;
107
+ const rotateQB = (db, id, newTokenId, newRefreshToken, newData) => db.db
108
+ .updateTable('token')
109
+ .set({
110
+ tokenId: newTokenId,
111
+ currentRefreshToken: newRefreshToken,
112
+ expiresAt: (0, db_1.toDateISO)(newData.expiresAt),
113
+ updatedAt: (0, db_1.toDateISO)(newData.updatedAt),
114
+ clientAuth: (0, db_1.toJsonObject)(newData.clientAuth),
115
+ })
116
+ // uses primary key index
117
+ .where('id', '=', id);
118
+ exports.rotateQB = rotateQB;
119
+ const removeQB = (db, tokenId) =>
120
+ // uses "used_refresh_token_fk" to cascade delete
121
+ db.db.deleteFrom('token').where('tokenId', '=', tokenId);
122
+ exports.removeQB = removeQB;
123
+ //# sourceMappingURL=token.js.map