@headless-lms/adapter-db 0.2.0 → 0.3.0
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.
- package/dist/index.d.ts +7 -6
- package/dist/index.js +7 -6
- package/dist/repositories/admin.d.ts +23 -0
- package/dist/repositories/admin.js +393 -0
- package/dist/repositories/admin.js.map +1 -0
- package/dist/repositories/assets.d.ts +6 -2
- package/dist/repositories/assets.js +50 -9
- package/dist/repositories/assets.js.map +1 -1
- package/dist/repositories/automations.d.ts +6 -2
- package/dist/repositories/automations.js +45 -2
- package/dist/repositories/automations.js.map +1 -1
- package/dist/repositories/chats.d.ts +55 -0
- package/dist/repositories/chats.js +454 -0
- package/dist/repositories/chats.js.map +1 -0
- package/dist/repositories/content.d.ts +24 -1
- package/dist/repositories/content.js +293 -9
- package/dist/repositories/content.js.map +1 -1
- package/dist/repositories/discussion.d.ts +10 -3
- package/dist/repositories/discussion.js +70 -15
- package/dist/repositories/discussion.js.map +1 -1
- package/dist/repositories/entitlements.d.ts +29 -9
- package/dist/repositories/entitlements.js +207 -17
- package/dist/repositories/entitlements.js.map +1 -1
- package/dist/repositories/grant-covers.d.ts +20 -0
- package/dist/repositories/grant-covers.js +55 -0
- package/dist/repositories/grant-covers.js.map +1 -0
- package/dist/repositories/identity.d.ts +4 -2
- package/dist/repositories/identity.js +32 -1
- package/dist/repositories/identity.js.map +1 -1
- package/dist/repositories/member.d.ts +16 -0
- package/dist/repositories/member.js +63 -0
- package/dist/repositories/member.js.map +1 -0
- package/dist/repositories/members.js +2 -2
- package/dist/repositories/members.js.map +1 -1
- package/dist/repositories/notifications.d.ts +23 -0
- package/dist/repositories/notifications.js +70 -0
- package/dist/repositories/notifications.js.map +1 -0
- package/dist/repositories/org-user-profile.d.ts +214 -1
- package/dist/repositories/org-user-profile.js +23 -2
- package/dist/repositories/org-user-profile.js.map +1 -1
- package/dist/repositories/organizations.d.ts +3 -2
- package/dist/repositories/organizations.js +20 -8
- package/dist/repositories/organizations.js.map +1 -1
- package/dist/repositories/pg-errors.js +3 -1
- package/dist/repositories/pg-errors.js.map +1 -1
- package/dist/repositories/posts.d.ts +39 -0
- package/dist/repositories/posts.js +255 -0
- package/dist/repositories/posts.js.map +1 -0
- package/dist/schema/assets.d.ts +19 -2
- package/dist/schema/assets.js +10 -4
- package/dist/schema/assets.js.map +1 -1
- package/dist/schema/automations.d.ts +38 -0
- package/dist/schema/automations.js +5 -1
- package/dist/schema/automations.js.map +1 -1
- package/dist/schema/better-auth.d.ts +1613 -238
- package/dist/schema/better-auth.js +107 -22
- package/dist/schema/better-auth.js.map +1 -1
- package/dist/schema/content.d.ts +642 -5
- package/dist/schema/content.js +119 -10
- package/dist/schema/content.js.map +1 -1
- package/dist/schema/discussion.d.ts +2045 -55
- package/dist/schema/discussion.js +426 -11
- package/dist/schema/discussion.js.map +1 -1
- package/dist/schema/entitlements.d.ts +432 -1
- package/dist/schema/entitlements.js +109 -4
- package/dist/schema/entitlements.js.map +1 -1
- package/dist/schema/identity.d.ts +517 -1
- package/dist/schema/identity.js +118 -2
- package/dist/schema/identity.js.map +1 -1
- package/dist/schema/index.d.ts +6 -6
- package/dist/schema/index.js +30 -7
- package/dist/schema/organizations.d.ts +4 -4
- package/dist/schema/organizations.js +2 -0
- package/dist/schema/organizations.js.map +1 -1
- package/drizzle/0003_community.sql +340 -0
- package/drizzle/0004_assets_sources.sql +1 -0
- package/drizzle/0005_notices_and_seed_index.sql +12 -0
- package/drizzle/0006_community_review_fixes.sql +24 -0
- package/drizzle/0007_notifications.sql +37 -0
- package/drizzle/0008_content_access.sql +13 -0
- package/drizzle/0009_community_indexes.sql +56 -0
- package/drizzle/0010_mcp_access.sql +114 -0
- package/drizzle/meta/0003_snapshot.json +7061 -0
- package/drizzle/meta/0004_snapshot.json +7068 -0
- package/drizzle/meta/0005_snapshot.json +7180 -0
- package/drizzle/meta/0006_snapshot.json +7298 -0
- package/drizzle/meta/0007_snapshot.json +7620 -0
- package/drizzle/meta/0008_snapshot.json +7666 -0
- package/drizzle/meta/0009_snapshot.json +8185 -0
- package/drizzle/meta/0010_snapshot.json +8813 -0
- package/drizzle/meta/_journal.json +57 -1
- package/package.json +2 -2
- package/dist/repositories/course-analytics.d.ts +0 -15
- package/dist/repositories/course-analytics.js +0 -137
- package/dist/repositories/course-analytics.js.map +0 -1
- package/dist/repositories/dashboard.d.ts +0 -14
- package/dist/repositories/dashboard.js +0 -57
- package/dist/repositories/dashboard.js.map +0 -1
- package/dist/repositories/learn.d.ts +0 -19
- package/dist/repositories/learn.js +0 -56
- package/dist/repositories/learn.js.map +0 -1
- package/dist/repositories/students.d.ts +0 -16
- package/dist/repositories/students.js +0 -160
- package/dist/repositories/students.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { boolean, index, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
1
|
+
import { boolean, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
|
|
2
2
|
//#region src/schema/better-auth.ts
|
|
3
3
|
const user = pgTable("ba_user", {
|
|
4
4
|
id: text("id").primaryKey(),
|
|
@@ -73,12 +73,16 @@ const oauthClient = pgTable("ba_oauth_client", {
|
|
|
73
73
|
id: text("id").primaryKey(),
|
|
74
74
|
clientId: text("client_id").notNull().unique(),
|
|
75
75
|
clientSecret: text("client_secret"),
|
|
76
|
+
clientDiscoveryId: text("client_discovery_id"),
|
|
76
77
|
disabled: boolean("disabled").default(false),
|
|
77
78
|
skipConsent: boolean("skip_consent"),
|
|
78
79
|
enableEndSession: boolean("enable_end_session"),
|
|
79
80
|
subjectType: text("subject_type"),
|
|
80
81
|
scopes: text("scopes").array(),
|
|
82
|
+
clientCredentialsScopes: text("client_credentials_scopes").array().default([]),
|
|
81
83
|
userId: text("user_id").references(() => user.id, { onDelete: "cascade" }),
|
|
84
|
+
createdAt: timestamp("created_at", { withTimezone: true }),
|
|
85
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }),
|
|
82
86
|
name: text("name"),
|
|
83
87
|
uri: text("uri"),
|
|
84
88
|
icon: text("icon"),
|
|
@@ -90,67 +94,148 @@ const oauthClient = pgTable("ba_oauth_client", {
|
|
|
90
94
|
softwareStatement: text("software_statement"),
|
|
91
95
|
redirectUris: text("redirect_uris").array().notNull(),
|
|
92
96
|
postLogoutRedirectUris: text("post_logout_redirect_uris").array(),
|
|
97
|
+
backchannelLogoutUri: text("backchannel_logout_uri"),
|
|
98
|
+
backchannelLogoutSessionRequired: boolean("backchannel_logout_session_required"),
|
|
93
99
|
tokenEndpointAuthMethod: text("token_endpoint_auth_method"),
|
|
100
|
+
applicationType: text("application_type"),
|
|
101
|
+
jwks: text("jwks"),
|
|
102
|
+
jwksUri: text("jwks_uri"),
|
|
94
103
|
grantTypes: text("grant_types").array(),
|
|
95
104
|
responseTypes: text("response_types").array(),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
requirePkce: boolean("require_pkce"),
|
|
105
|
+
requirePKCE: boolean("require_pkce"),
|
|
106
|
+
dpopBoundAccessTokens: boolean("dpop_bound_access_tokens").default(false),
|
|
99
107
|
referenceId: text("reference_id"),
|
|
100
|
-
metadata:
|
|
101
|
-
createdAt: timestamp("created_at", { withTimezone: true }),
|
|
102
|
-
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
108
|
+
metadata: jsonb("metadata")
|
|
103
109
|
}, (t) => [index("ba_oauth_client_user_id_idx").on(t.userId)]);
|
|
104
110
|
const oauthRefreshToken = pgTable("ba_oauth_refresh_token", {
|
|
105
111
|
id: text("id").primaryKey(),
|
|
106
112
|
token: text("token").notNull().unique(),
|
|
107
|
-
clientId: text("client_id").notNull().references(() => oauthClient.clientId),
|
|
113
|
+
clientId: text("client_id").notNull().references(() => oauthClient.clientId, { onDelete: "cascade" }),
|
|
108
114
|
sessionId: text("session_id").references(() => session.id, { onDelete: "set null" }),
|
|
109
115
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
110
116
|
referenceId: text("reference_id"),
|
|
111
|
-
|
|
112
|
-
|
|
117
|
+
authorizationCodeId: text("authorization_code_id"),
|
|
118
|
+
resources: text("resources").array(),
|
|
119
|
+
requestedUserInfoClaims: text("requested_user_info_claims").array(),
|
|
120
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }),
|
|
121
|
+
createdAt: timestamp("created_at", { withTimezone: true }),
|
|
113
122
|
revoked: timestamp("revoked", { withTimezone: true }),
|
|
123
|
+
rotatedAt: timestamp("rotated_at", { withTimezone: true }),
|
|
124
|
+
rotationReplayResponse: text("rotation_replay_response"),
|
|
125
|
+
rotationReplayExpiresAt: timestamp("rotation_replay_expires_at", { withTimezone: true }),
|
|
114
126
|
authTime: timestamp("auth_time", { withTimezone: true }),
|
|
127
|
+
confirmation: jsonb("confirmation"),
|
|
115
128
|
scopes: text("scopes").array().notNull()
|
|
116
129
|
}, (t) => [
|
|
117
130
|
index("ba_oauth_refresh_token_client_id_idx").on(t.clientId),
|
|
118
131
|
index("ba_oauth_refresh_token_session_id_idx").on(t.sessionId),
|
|
119
|
-
index("ba_oauth_refresh_token_user_id_idx").on(t.userId)
|
|
132
|
+
index("ba_oauth_refresh_token_user_id_idx").on(t.userId),
|
|
133
|
+
index("ba_oauth_refresh_token_authorization_code_id_idx").on(t.authorizationCodeId)
|
|
120
134
|
]);
|
|
121
135
|
const oauthAccessToken = pgTable("ba_oauth_access_token", {
|
|
122
136
|
id: text("id").primaryKey(),
|
|
123
|
-
token: text("token").
|
|
124
|
-
clientId: text("client_id").notNull().references(() => oauthClient.clientId),
|
|
137
|
+
token: text("token").unique(),
|
|
138
|
+
clientId: text("client_id").notNull().references(() => oauthClient.clientId, { onDelete: "cascade" }),
|
|
125
139
|
sessionId: text("session_id").references(() => session.id, { onDelete: "set null" }),
|
|
126
140
|
userId: text("user_id").references(() => user.id, { onDelete: "cascade" }),
|
|
127
141
|
referenceId: text("reference_id"),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
142
|
+
authorizationCodeId: text("authorization_code_id"),
|
|
143
|
+
resources: text("resources").array(),
|
|
144
|
+
requestedUserInfoClaims: text("requested_user_info_claims").array(),
|
|
145
|
+
refreshId: text("refresh_id").references(() => oauthRefreshToken.id, { onDelete: "cascade" }),
|
|
146
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }),
|
|
147
|
+
createdAt: timestamp("created_at", { withTimezone: true }),
|
|
148
|
+
revoked: timestamp("revoked", { withTimezone: true }),
|
|
149
|
+
confirmation: jsonb("confirmation"),
|
|
131
150
|
scopes: text("scopes").array().notNull()
|
|
132
151
|
}, (t) => [
|
|
133
152
|
index("ba_oauth_access_token_client_id_idx").on(t.clientId),
|
|
134
153
|
index("ba_oauth_access_token_session_id_idx").on(t.sessionId),
|
|
135
154
|
index("ba_oauth_access_token_user_id_idx").on(t.userId),
|
|
136
|
-
index("ba_oauth_access_token_refresh_id_idx").on(t.refreshId)
|
|
155
|
+
index("ba_oauth_access_token_refresh_id_idx").on(t.refreshId),
|
|
156
|
+
index("ba_oauth_access_token_authorization_code_id_idx").on(t.authorizationCodeId)
|
|
137
157
|
]);
|
|
138
158
|
const oauthConsent = pgTable("ba_oauth_consent", {
|
|
139
159
|
id: text("id").primaryKey(),
|
|
140
|
-
clientId: text("client_id").notNull().references(() => oauthClient.clientId),
|
|
160
|
+
clientId: text("client_id").notNull().references(() => oauthClient.clientId, { onDelete: "cascade" }),
|
|
141
161
|
userId: text("user_id").references(() => user.id, { onDelete: "cascade" }),
|
|
142
162
|
referenceId: text("reference_id"),
|
|
163
|
+
resources: text("resources").array(),
|
|
164
|
+
requestedUserInfoClaims: text("requested_user_info_claims").array(),
|
|
143
165
|
scopes: text("scopes").array().notNull(),
|
|
144
|
-
createdAt: timestamp("created_at", { withTimezone: true })
|
|
145
|
-
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
166
|
+
createdAt: timestamp("created_at", { withTimezone: true }),
|
|
167
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
146
168
|
}, (t) => [index("ba_oauth_consent_client_id_idx").on(t.clientId), index("ba_oauth_consent_user_id_idx").on(t.userId)]);
|
|
169
|
+
const oauthResource = pgTable("ba_oauth_resource", {
|
|
170
|
+
id: text("id").primaryKey(),
|
|
171
|
+
identifier: text("identifier").notNull().unique(),
|
|
172
|
+
name: text("name").notNull(),
|
|
173
|
+
accessTokenTtl: integer("access_token_ttl"),
|
|
174
|
+
refreshTokenTtl: integer("refresh_token_ttl"),
|
|
175
|
+
signingAlgorithm: text("signing_algorithm"),
|
|
176
|
+
signingKeyId: text("signing_key_id"),
|
|
177
|
+
allowedScopes: text("allowed_scopes").array(),
|
|
178
|
+
customClaims: jsonb("custom_claims"),
|
|
179
|
+
dpopBoundAccessTokensRequired: boolean("dpop_bound_access_tokens_required").default(false),
|
|
180
|
+
disabled: boolean("disabled").default(false),
|
|
181
|
+
createdAt: timestamp("created_at", { withTimezone: true }),
|
|
182
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }),
|
|
183
|
+
policyVersion: integer("policy_version").default(1),
|
|
184
|
+
metadata: jsonb("metadata")
|
|
185
|
+
});
|
|
186
|
+
const oauthClientResource = pgTable("ba_oauth_client_resource", {
|
|
187
|
+
id: text("id").primaryKey(),
|
|
188
|
+
clientId: text("client_id").notNull().references(() => oauthClient.clientId, { onDelete: "cascade" }),
|
|
189
|
+
resourceId: text("resource_id").notNull().references(() => oauthResource.identifier, { onDelete: "cascade" }),
|
|
190
|
+
metadata: jsonb("metadata"),
|
|
191
|
+
createdAt: timestamp("created_at", { withTimezone: true })
|
|
192
|
+
}, (t) => [
|
|
193
|
+
index("ba_oauth_client_resource_client_id_idx").on(t.clientId),
|
|
194
|
+
index("ba_oauth_client_resource_resource_id_idx").on(t.resourceId),
|
|
195
|
+
uniqueIndex("ba_oauth_client_resource_client_resource_uidx").on(t.clientId, t.resourceId)
|
|
196
|
+
]);
|
|
197
|
+
const oauthClientAssertion = pgTable("ba_oauth_client_assertion", {
|
|
198
|
+
id: text("id").primaryKey(),
|
|
199
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull()
|
|
200
|
+
});
|
|
147
201
|
const jwks = pgTable("ba_jwks", {
|
|
148
202
|
id: text("id").primaryKey(),
|
|
149
203
|
publicKey: text("public_key").notNull(),
|
|
150
204
|
privateKey: text("private_key").notNull(),
|
|
151
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull()
|
|
205
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
206
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }),
|
|
207
|
+
alg: text("alg"),
|
|
208
|
+
crv: text("crv")
|
|
152
209
|
});
|
|
210
|
+
const apikey = pgTable("ba_apikey", {
|
|
211
|
+
id: text("id").primaryKey(),
|
|
212
|
+
configId: text("config_id").notNull().default("default"),
|
|
213
|
+
name: text("name"),
|
|
214
|
+
start: text("start"),
|
|
215
|
+
referenceId: text("reference_id").notNull(),
|
|
216
|
+
prefix: text("prefix"),
|
|
217
|
+
key: text("key").notNull(),
|
|
218
|
+
refillInterval: integer("refill_interval"),
|
|
219
|
+
refillAmount: integer("refill_amount"),
|
|
220
|
+
lastRefillAt: timestamp("last_refill_at", { withTimezone: true }),
|
|
221
|
+
enabled: boolean("enabled").default(true),
|
|
222
|
+
rateLimitEnabled: boolean("rate_limit_enabled").default(true),
|
|
223
|
+
rateLimitTimeWindow: integer("rate_limit_time_window").default(864e5),
|
|
224
|
+
rateLimitMax: integer("rate_limit_max").default(10),
|
|
225
|
+
requestCount: integer("request_count").default(0),
|
|
226
|
+
remaining: integer("remaining"),
|
|
227
|
+
lastRequest: timestamp("last_request", { withTimezone: true }),
|
|
228
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }),
|
|
229
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
230
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
231
|
+
permissions: text("permissions"),
|
|
232
|
+
metadata: text("metadata")
|
|
233
|
+
}, (t) => [
|
|
234
|
+
index("ba_apikey_config_id_idx").on(t.configId),
|
|
235
|
+
index("ba_apikey_reference_id_idx").on(t.referenceId),
|
|
236
|
+
index("ba_apikey_key_idx").on(t.key)
|
|
237
|
+
]);
|
|
153
238
|
//#endregion
|
|
154
|
-
export { account, invitation, jwks, member, oauthAccessToken, oauthClient, oauthConsent, oauthRefreshToken, organization, session, user, verification };
|
|
239
|
+
export { account, apikey, invitation, jwks, member, oauthAccessToken, oauthClient, oauthClientAssertion, oauthClientResource, oauthConsent, oauthRefreshToken, oauthResource, organization, session, user, verification };
|
|
155
240
|
|
|
156
241
|
//# sourceMappingURL=better-auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"better-auth.js","names":[],"sources":["../../src/schema/better-auth.ts"],"sourcesContent":["// Better Auth's own tables. Every physical table is prefixed `ba_` so the auth\n// engine's storage is visibly separate from the domain's own tables (`users`,\n// `organizations`, …) it is mirrored into. The exported identifiers stay the\n// better-auth model names — that is the key `drizzleAdapter` looks each model\n// up by, so it must not carry the prefix.\nimport { pgTable, text, timestamp, boolean, index } from \"drizzle-orm/pg-core\";\n\nexport const user = pgTable(\"ba_user\", {\n id: text(\"id\").primaryKey(),\n name: text(\"name\").notNull(),\n email: text(\"email\").notNull().unique(),\n emailVerified: boolean(\"email_verified\")\n .$defaultFn(() => false)\n .notNull(),\n image: text(\"image\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true })\n .$defaultFn(() => new Date())\n .notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true })\n .$defaultFn(() => new Date())\n .notNull(),\n});\n\nexport const session = pgTable(\"ba_session\", {\n id: text(\"id\").primaryKey(),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }).notNull(),\n token: text(\"token\").notNull().unique(),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }).notNull(),\n ipAddress: text(\"ip_address\"),\n userAgent: text(\"user_agent\"),\n userId: text(\"user_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n // organization plugin: the org the session is currently acting in.\n activeOrganizationId: text(\"active_organization_id\"),\n});\n\nexport const account = pgTable(\"ba_account\", {\n id: text(\"id\").primaryKey(),\n accountId: text(\"account_id\").notNull(),\n providerId: text(\"provider_id\").notNull(),\n userId: text(\"user_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n accessToken: text(\"access_token\"),\n refreshToken: text(\"refresh_token\"),\n idToken: text(\"id_token\"),\n accessTokenExpiresAt: timestamp(\"access_token_expires_at\", { withTimezone: true }),\n refreshTokenExpiresAt: timestamp(\"refresh_token_expires_at\", { withTimezone: true }),\n scope: text(\"scope\"),\n password: text(\"password\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }).notNull(),\n});\n\nexport const verification = pgTable(\"ba_verification\", {\n id: text(\"id\").primaryKey(),\n identifier: text(\"identifier\").notNull(),\n value: text(\"value\").notNull(),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }).notNull(),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).$defaultFn(() => new Date()),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }).$defaultFn(() => new Date()),\n});\n\n// --- organization plugin tables ---\n\nexport const organization = pgTable(\"ba_organization\", {\n id: text(\"id\").primaryKey(),\n name: text(\"name\").notNull(),\n slug: text(\"slug\").notNull().unique(),\n logo: text(\"logo\"),\n metadata: text(\"metadata\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }),\n});\n\nexport const member = pgTable(\"ba_member\", {\n id: text(\"id\").primaryKey(),\n organizationId: text(\"organization_id\")\n .notNull()\n .references(() => organization.id, { onDelete: \"cascade\" }),\n userId: text(\"user_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n role: text(\"role\").notNull().default(\"member\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n});\n\nexport const invitation = pgTable(\"ba_invitation\", {\n id: text(\"id\").primaryKey(),\n organizationId: text(\"organization_id\")\n .notNull()\n .references(() => organization.id, { onDelete: \"cascade\" }),\n email: text(\"email\").notNull(),\n role: text(\"role\").notNull(),\n status: text(\"status\").notNull().default(\"pending\"),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }),\n inviterId: text(\"inviter_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n});\n\n// --- OAuth 2.1 provider tables (MCP). Owned by @better-auth/oauth-provider. ---\n// `reference_id` is the plugin's tenant slot: the organization the person chose\n// at consent. It is the only thing that tells a token which org it acts in.\nexport const oauthClient = pgTable(\n \"ba_oauth_client\",\n {\n id: text(\"id\").primaryKey(),\n clientId: text(\"client_id\").notNull().unique(),\n clientSecret: text(\"client_secret\"),\n disabled: boolean(\"disabled\").default(false),\n skipConsent: boolean(\"skip_consent\"),\n enableEndSession: boolean(\"enable_end_session\"),\n subjectType: text(\"subject_type\"),\n scopes: text(\"scopes\").array(),\n userId: text(\"user_id\").references(() => user.id, { onDelete: \"cascade\" }),\n name: text(\"name\"),\n uri: text(\"uri\"),\n icon: text(\"icon\"),\n contacts: text(\"contacts\").array(),\n tos: text(\"tos\"),\n policy: text(\"policy\"),\n softwareId: text(\"software_id\"),\n softwareVersion: text(\"software_version\"),\n softwareStatement: text(\"software_statement\"),\n redirectUris: text(\"redirect_uris\").array().notNull(),\n postLogoutRedirectUris: text(\"post_logout_redirect_uris\").array(),\n tokenEndpointAuthMethod: text(\"token_endpoint_auth_method\"),\n grantTypes: text(\"grant_types\").array(),\n responseTypes: text(\"response_types\").array(),\n public: boolean(\"public\"),\n type: text(\"type\"),\n requirePkce: boolean(\"require_pkce\"),\n referenceId: text(\"reference_id\"),\n metadata: text(\"metadata\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true }),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }),\n },\n (t) => [index(\"ba_oauth_client_user_id_idx\").on(t.userId)],\n);\n\nexport const oauthRefreshToken = pgTable(\n \"ba_oauth_refresh_token\",\n {\n id: text(\"id\").primaryKey(),\n token: text(\"token\").notNull().unique(),\n clientId: text(\"client_id\")\n .notNull()\n .references(() => oauthClient.clientId),\n sessionId: text(\"session_id\").references(() => session.id, { onDelete: \"set null\" }),\n userId: text(\"user_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n referenceId: text(\"reference_id\"),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }).notNull(),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n revoked: timestamp(\"revoked\", { withTimezone: true }),\n authTime: timestamp(\"auth_time\", { withTimezone: true }),\n scopes: text(\"scopes\").array().notNull(),\n },\n (t) => [\n index(\"ba_oauth_refresh_token_client_id_idx\").on(t.clientId),\n index(\"ba_oauth_refresh_token_session_id_idx\").on(t.sessionId),\n index(\"ba_oauth_refresh_token_user_id_idx\").on(t.userId),\n ],\n);\n\nexport const oauthAccessToken = pgTable(\n \"ba_oauth_access_token\",\n {\n id: text(\"id\").primaryKey(),\n token: text(\"token\").notNull().unique(),\n clientId: text(\"client_id\")\n .notNull()\n .references(() => oauthClient.clientId),\n sessionId: text(\"session_id\").references(() => session.id, { onDelete: \"set null\" }),\n userId: text(\"user_id\").references(() => user.id, { onDelete: \"cascade\" }),\n referenceId: text(\"reference_id\"),\n refreshId: text(\"refresh_id\").references(() => oauthRefreshToken.id),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }).notNull(),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n scopes: text(\"scopes\").array().notNull(),\n },\n (t) => [\n index(\"ba_oauth_access_token_client_id_idx\").on(t.clientId),\n index(\"ba_oauth_access_token_session_id_idx\").on(t.sessionId),\n index(\"ba_oauth_access_token_user_id_idx\").on(t.userId),\n index(\"ba_oauth_access_token_refresh_id_idx\").on(t.refreshId),\n ],\n);\n\nexport const oauthConsent = pgTable(\n \"ba_oauth_consent\",\n {\n id: text(\"id\").primaryKey(),\n clientId: text(\"client_id\")\n .notNull()\n .references(() => oauthClient.clientId),\n userId: text(\"user_id\").references(() => user.id, { onDelete: \"cascade\" }),\n referenceId: text(\"reference_id\"),\n scopes: text(\"scopes\").array().notNull(),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }).notNull(),\n },\n (t) => [\n index(\"ba_oauth_consent_client_id_idx\").on(t.clientId),\n index(\"ba_oauth_consent_user_id_idx\").on(t.userId),\n ],\n);\n\n// better-auth's jwt plugin: the signing keys behind JWT access tokens.\nexport const jwks = pgTable(\"ba_jwks\", {\n id: text(\"id\").primaryKey(),\n publicKey: text(\"public_key\").notNull(),\n privateKey: text(\"private_key\").notNull(),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n});\n"],"mappings":";;AAOA,MAAa,OAAO,QAAQ,WAAW;CACrC,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ;CAC3B,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO;CACtC,eAAe,QAAQ,gBAAgB,CAAC,CACrC,iBAAiB,KAAK,CAAC,CACvB,QAAQ;CACX,OAAO,KAAK,OAAO;CACnB,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CACvD,iCAAiB,IAAI,KAAK,CAAC,CAAC,CAC5B,QAAQ;CACX,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CACvD,iCAAiB,IAAI,KAAK,CAAC,CAAC,CAC5B,QAAQ;AACb,CAAC;AAED,MAAa,UAAU,QAAQ,cAAc;CAC3C,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,UAAU,cAAc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c,EAAE,cAAc,KAAK,CAAC,CAAC,CAAC,QAAQ;CACnE,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CAAC,QAAQ;AACrE,IACC,MAAM,CACL,MAAM,gCAAgC,CAAC,CAAC,GAAG,EAAE,QAAQ,GACrD,MAAM,8BAA8B,CAAC,CAAC,GAAG,EAAE,MAAM,CACnD,CACF;AAGA,MAAa,OAAO,QAAQ,WAAW;CACrC,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;CACtC,YAAY,KAAK,aAAa,CAAC,CAAC,QAAQ;CACxC,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CAAC,QAAQ;AACrE,CAAC"}
|
|
1
|
+
{"version":3,"file":"better-auth.js","names":[],"sources":["../../src/schema/better-auth.ts"],"sourcesContent":["// Better Auth's own tables. Every physical table is prefixed `ba_` so the auth\n// engine's storage is visibly separate from the domain's own tables (`users`,\n// `organizations`, …) it is mirrored into. The exported identifiers stay the\n// better-auth model names — that is the key `drizzleAdapter` looks each model\n// up by, so it must not carry the prefix.\nimport {\n pgTable,\n text,\n timestamp,\n boolean,\n index,\n integer,\n jsonb,\n uniqueIndex,\n} from \"drizzle-orm/pg-core\";\n\nexport const user = pgTable(\"ba_user\", {\n id: text(\"id\").primaryKey(),\n name: text(\"name\").notNull(),\n email: text(\"email\").notNull().unique(),\n emailVerified: boolean(\"email_verified\")\n .$defaultFn(() => false)\n .notNull(),\n image: text(\"image\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true })\n .$defaultFn(() => new Date())\n .notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true })\n .$defaultFn(() => new Date())\n .notNull(),\n});\n\nexport const session = pgTable(\"ba_session\", {\n id: text(\"id\").primaryKey(),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }).notNull(),\n token: text(\"token\").notNull().unique(),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }).notNull(),\n ipAddress: text(\"ip_address\"),\n userAgent: text(\"user_agent\"),\n userId: text(\"user_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n // organization plugin: the org the session is currently acting in.\n activeOrganizationId: text(\"active_organization_id\"),\n});\n\nexport const account = pgTable(\"ba_account\", {\n id: text(\"id\").primaryKey(),\n accountId: text(\"account_id\").notNull(),\n providerId: text(\"provider_id\").notNull(),\n userId: text(\"user_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n accessToken: text(\"access_token\"),\n refreshToken: text(\"refresh_token\"),\n idToken: text(\"id_token\"),\n accessTokenExpiresAt: timestamp(\"access_token_expires_at\", { withTimezone: true }),\n refreshTokenExpiresAt: timestamp(\"refresh_token_expires_at\", { withTimezone: true }),\n scope: text(\"scope\"),\n password: text(\"password\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }).notNull(),\n});\n\nexport const verification = pgTable(\"ba_verification\", {\n id: text(\"id\").primaryKey(),\n identifier: text(\"identifier\").notNull(),\n value: text(\"value\").notNull(),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }).notNull(),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).$defaultFn(() => new Date()),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }).$defaultFn(() => new Date()),\n});\n\n// --- organization plugin tables ---\n\nexport const organization = pgTable(\"ba_organization\", {\n id: text(\"id\").primaryKey(),\n name: text(\"name\").notNull(),\n slug: text(\"slug\").notNull().unique(),\n logo: text(\"logo\"),\n metadata: text(\"metadata\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }),\n});\n\nexport const member = pgTable(\"ba_member\", {\n id: text(\"id\").primaryKey(),\n organizationId: text(\"organization_id\")\n .notNull()\n .references(() => organization.id, { onDelete: \"cascade\" }),\n userId: text(\"user_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n role: text(\"role\").notNull().default(\"member\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n});\n\nexport const invitation = pgTable(\"ba_invitation\", {\n id: text(\"id\").primaryKey(),\n organizationId: text(\"organization_id\")\n .notNull()\n .references(() => organization.id, { onDelete: \"cascade\" }),\n email: text(\"email\").notNull(),\n role: text(\"role\").notNull(),\n status: text(\"status\").notNull().default(\"pending\"),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }),\n inviterId: text(\"inviter_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n});\n\n// --- OAuth 2.1 provider tables (MCP). Owned by @better-auth/oauth-provider. ---\n// `reference_id` is the plugin's tenant slot: the organization the person chose\n// at consent. It is the only thing that tells a token which org it acts in.\nexport const oauthClient = pgTable(\n \"ba_oauth_client\",\n {\n id: text(\"id\").primaryKey(),\n clientId: text(\"client_id\").notNull().unique(),\n clientSecret: text(\"client_secret\"),\n clientDiscoveryId: text(\"client_discovery_id\"),\n disabled: boolean(\"disabled\").default(false),\n skipConsent: boolean(\"skip_consent\"),\n enableEndSession: boolean(\"enable_end_session\"),\n subjectType: text(\"subject_type\"),\n scopes: text(\"scopes\").array(),\n clientCredentialsScopes: text(\"client_credentials_scopes\").array().default([]),\n userId: text(\"user_id\").references(() => user.id, { onDelete: \"cascade\" }),\n createdAt: timestamp(\"created_at\", { withTimezone: true }),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }),\n name: text(\"name\"),\n uri: text(\"uri\"),\n icon: text(\"icon\"),\n contacts: text(\"contacts\").array(),\n tos: text(\"tos\"),\n policy: text(\"policy\"),\n softwareId: text(\"software_id\"),\n softwareVersion: text(\"software_version\"),\n softwareStatement: text(\"software_statement\"),\n redirectUris: text(\"redirect_uris\").array().notNull(),\n postLogoutRedirectUris: text(\"post_logout_redirect_uris\").array(),\n backchannelLogoutUri: text(\"backchannel_logout_uri\"),\n backchannelLogoutSessionRequired: boolean(\"backchannel_logout_session_required\"),\n tokenEndpointAuthMethod: text(\"token_endpoint_auth_method\"),\n applicationType: text(\"application_type\"),\n jwks: text(\"jwks\"),\n jwksUri: text(\"jwks_uri\"),\n grantTypes: text(\"grant_types\").array(),\n responseTypes: text(\"response_types\").array(),\n requirePKCE: boolean(\"require_pkce\"),\n dpopBoundAccessTokens: boolean(\"dpop_bound_access_tokens\").default(false),\n referenceId: text(\"reference_id\"),\n metadata: jsonb(\"metadata\"),\n },\n (t) => [index(\"ba_oauth_client_user_id_idx\").on(t.userId)],\n);\n\nexport const oauthRefreshToken = pgTable(\n \"ba_oauth_refresh_token\",\n {\n id: text(\"id\").primaryKey(),\n token: text(\"token\").notNull().unique(),\n clientId: text(\"client_id\")\n .notNull()\n .references(() => oauthClient.clientId, { onDelete: \"cascade\" }),\n sessionId: text(\"session_id\").references(() => session.id, { onDelete: \"set null\" }),\n userId: text(\"user_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n referenceId: text(\"reference_id\"),\n authorizationCodeId: text(\"authorization_code_id\"),\n resources: text(\"resources\").array(),\n requestedUserInfoClaims: text(\"requested_user_info_claims\").array(),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }),\n createdAt: timestamp(\"created_at\", { withTimezone: true }),\n revoked: timestamp(\"revoked\", { withTimezone: true }),\n rotatedAt: timestamp(\"rotated_at\", { withTimezone: true }),\n rotationReplayResponse: text(\"rotation_replay_response\"),\n rotationReplayExpiresAt: timestamp(\"rotation_replay_expires_at\", { withTimezone: true }),\n authTime: timestamp(\"auth_time\", { withTimezone: true }),\n confirmation: jsonb(\"confirmation\"),\n scopes: text(\"scopes\").array().notNull(),\n },\n (t) => [\n index(\"ba_oauth_refresh_token_client_id_idx\").on(t.clientId),\n index(\"ba_oauth_refresh_token_session_id_idx\").on(t.sessionId),\n index(\"ba_oauth_refresh_token_user_id_idx\").on(t.userId),\n index(\"ba_oauth_refresh_token_authorization_code_id_idx\").on(t.authorizationCodeId),\n ],\n);\n\nexport const oauthAccessToken = pgTable(\n \"ba_oauth_access_token\",\n {\n id: text(\"id\").primaryKey(),\n token: text(\"token\").unique(),\n clientId: text(\"client_id\")\n .notNull()\n .references(() => oauthClient.clientId, { onDelete: \"cascade\" }),\n sessionId: text(\"session_id\").references(() => session.id, { onDelete: \"set null\" }),\n userId: text(\"user_id\").references(() => user.id, { onDelete: \"cascade\" }),\n referenceId: text(\"reference_id\"),\n authorizationCodeId: text(\"authorization_code_id\"),\n resources: text(\"resources\").array(),\n requestedUserInfoClaims: text(\"requested_user_info_claims\").array(),\n refreshId: text(\"refresh_id\").references(() => oauthRefreshToken.id, { onDelete: \"cascade\" }),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }),\n createdAt: timestamp(\"created_at\", { withTimezone: true }),\n revoked: timestamp(\"revoked\", { withTimezone: true }),\n confirmation: jsonb(\"confirmation\"),\n scopes: text(\"scopes\").array().notNull(),\n },\n (t) => [\n index(\"ba_oauth_access_token_client_id_idx\").on(t.clientId),\n index(\"ba_oauth_access_token_session_id_idx\").on(t.sessionId),\n index(\"ba_oauth_access_token_user_id_idx\").on(t.userId),\n index(\"ba_oauth_access_token_refresh_id_idx\").on(t.refreshId),\n index(\"ba_oauth_access_token_authorization_code_id_idx\").on(t.authorizationCodeId),\n ],\n);\n\nexport const oauthConsent = pgTable(\n \"ba_oauth_consent\",\n {\n id: text(\"id\").primaryKey(),\n clientId: text(\"client_id\")\n .notNull()\n .references(() => oauthClient.clientId, { onDelete: \"cascade\" }),\n userId: text(\"user_id\").references(() => user.id, { onDelete: \"cascade\" }),\n referenceId: text(\"reference_id\"),\n resources: text(\"resources\").array(),\n requestedUserInfoClaims: text(\"requested_user_info_claims\").array(),\n scopes: text(\"scopes\").array().notNull(),\n createdAt: timestamp(\"created_at\", { withTimezone: true }),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }),\n },\n (t) => [\n index(\"ba_oauth_consent_client_id_idx\").on(t.clientId),\n index(\"ba_oauth_consent_user_id_idx\").on(t.userId),\n ],\n);\n\nexport const oauthResource = pgTable(\"ba_oauth_resource\", {\n id: text(\"id\").primaryKey(),\n identifier: text(\"identifier\").notNull().unique(),\n name: text(\"name\").notNull(),\n accessTokenTtl: integer(\"access_token_ttl\"),\n refreshTokenTtl: integer(\"refresh_token_ttl\"),\n signingAlgorithm: text(\"signing_algorithm\"),\n signingKeyId: text(\"signing_key_id\"),\n allowedScopes: text(\"allowed_scopes\").array(),\n customClaims: jsonb(\"custom_claims\"),\n dpopBoundAccessTokensRequired: boolean(\"dpop_bound_access_tokens_required\").default(false),\n disabled: boolean(\"disabled\").default(false),\n createdAt: timestamp(\"created_at\", { withTimezone: true }),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }),\n policyVersion: integer(\"policy_version\").default(1),\n metadata: jsonb(\"metadata\"),\n});\n\nexport const oauthClientResource = pgTable(\n \"ba_oauth_client_resource\",\n {\n id: text(\"id\").primaryKey(),\n clientId: text(\"client_id\")\n .notNull()\n .references(() => oauthClient.clientId, { onDelete: \"cascade\" }),\n resourceId: text(\"resource_id\")\n .notNull()\n .references(() => oauthResource.identifier, { onDelete: \"cascade\" }),\n metadata: jsonb(\"metadata\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true }),\n },\n (t) => [\n index(\"ba_oauth_client_resource_client_id_idx\").on(t.clientId),\n index(\"ba_oauth_client_resource_resource_id_idx\").on(t.resourceId),\n uniqueIndex(\"ba_oauth_client_resource_client_resource_uidx\").on(t.clientId, t.resourceId),\n ],\n);\n\nexport const oauthClientAssertion = pgTable(\"ba_oauth_client_assertion\", {\n id: text(\"id\").primaryKey(),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }).notNull(),\n});\n\n// better-auth's jwt plugin: the signing keys behind JWT access tokens.\nexport const jwks = pgTable(\"ba_jwks\", {\n id: text(\"id\").primaryKey(),\n publicKey: text(\"public_key\").notNull(),\n privateKey: text(\"private_key\").notNull(),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }),\n alg: text(\"alg\"),\n crv: text(\"crv\"),\n});\n\nexport const apikey = pgTable(\n \"ba_apikey\",\n {\n id: text(\"id\").primaryKey(),\n configId: text(\"config_id\").notNull().default(\"default\"),\n name: text(\"name\"),\n start: text(\"start\"),\n referenceId: text(\"reference_id\").notNull(),\n prefix: text(\"prefix\"),\n key: text(\"key\").notNull(),\n refillInterval: integer(\"refill_interval\"),\n refillAmount: integer(\"refill_amount\"),\n lastRefillAt: timestamp(\"last_refill_at\", { withTimezone: true }),\n enabled: boolean(\"enabled\").default(true),\n rateLimitEnabled: boolean(\"rate_limit_enabled\").default(true),\n rateLimitTimeWindow: integer(\"rate_limit_time_window\").default(86400000),\n rateLimitMax: integer(\"rate_limit_max\").default(10),\n requestCount: integer(\"request_count\").default(0),\n remaining: integer(\"remaining\"),\n lastRequest: timestamp(\"last_request\", { withTimezone: true }),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }).notNull(),\n permissions: text(\"permissions\"),\n metadata: text(\"metadata\"),\n },\n (t) => [\n index(\"ba_apikey_config_id_idx\").on(t.configId),\n index(\"ba_apikey_reference_id_idx\").on(t.referenceId),\n index(\"ba_apikey_key_idx\").on(t.key),\n ],\n);\n"],"mappings":";;AAgBA,MAAa,OAAO,QAAQ,WAAW;CACrC,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ;CAC3B,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO;CACtC,eAAe,QAAQ,gBAAgB,CAAC,CACrC,iBAAiB,KAAK,CAAC,CACvB,QAAQ;CACX,OAAO,KAA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