@headless-lms/adapter-db 0.1.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/LICENSE +21 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/client.d.ts +17 -0
- package/dist/client.js +11 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +22 -0
- package/dist/migrate.d.ts +7 -0
- package/dist/migrate.js +27 -0
- package/dist/migrate.js.map +1 -0
- package/dist/repositories/assets.d.ts +17 -0
- package/dist/repositories/assets.js +90 -0
- package/dist/repositories/assets.js.map +1 -0
- package/dist/repositories/automations.d.ts +30 -0
- package/dist/repositories/automations.js +165 -0
- package/dist/repositories/automations.js.map +1 -0
- package/dist/repositories/content.d.ts +52 -0
- package/dist/repositories/content.js +350 -0
- package/dist/repositories/content.js.map +1 -0
- package/dist/repositories/credentials.d.ts +25 -0
- package/dist/repositories/credentials.js +86 -0
- package/dist/repositories/credentials.js.map +1 -0
- package/dist/repositories/dashboard.d.ts +14 -0
- package/dist/repositories/dashboard.js +55 -0
- package/dist/repositories/dashboard.js.map +1 -0
- package/dist/repositories/discussion.d.ts +31 -0
- package/dist/repositories/discussion.js +201 -0
- package/dist/repositories/discussion.js.map +1 -0
- package/dist/repositories/entitlements.d.ts +23 -0
- package/dist/repositories/entitlements.js +129 -0
- package/dist/repositories/entitlements.js.map +1 -0
- package/dist/repositories/identity.d.ts +17 -0
- package/dist/repositories/identity.js +44 -0
- package/dist/repositories/identity.js.map +1 -0
- package/dist/repositories/integrations.d.ts +18 -0
- package/dist/repositories/integrations.js +65 -0
- package/dist/repositories/integrations.js.map +1 -0
- package/dist/repositories/learn.d.ts +19 -0
- package/dist/repositories/learn.js +54 -0
- package/dist/repositories/learn.js.map +1 -0
- package/dist/repositories/members.d.ts +16 -0
- package/dist/repositories/members.js +116 -0
- package/dist/repositories/members.js.map +1 -0
- package/dist/repositories/org-user-profile.d.ts +92 -0
- package/dist/repositories/org-user-profile.js +16 -0
- package/dist/repositories/org-user-profile.js.map +1 -0
- package/dist/repositories/organizations.d.ts +33 -0
- package/dist/repositories/organizations.js +198 -0
- package/dist/repositories/organizations.js.map +1 -0
- package/dist/repositories/outbox.d.ts +24 -0
- package/dist/repositories/outbox.js +56 -0
- package/dist/repositories/outbox.js.map +1 -0
- package/dist/repositories/pg-errors.d.ts +11 -0
- package/dist/repositories/pg-errors.js +15 -0
- package/dist/repositories/pg-errors.js.map +1 -0
- package/dist/repositories/progress.d.ts +18 -0
- package/dist/repositories/progress.js +59 -0
- package/dist/repositories/progress.js.map +1 -0
- package/dist/repositories/settings.d.ts +22 -0
- package/dist/repositories/settings.js +73 -0
- package/dist/repositories/settings.js.map +1 -0
- package/dist/repositories/students.d.ts +15 -0
- package/dist/repositories/students.js +83 -0
- package/dist/repositories/students.js.map +1 -0
- package/dist/schema/assets.d.ts +181 -0
- package/dist/schema/assets.js +24 -0
- package/dist/schema/assets.js.map +1 -0
- package/dist/schema/automations.d.ts +364 -0
- package/dist/schema/automations.js +42 -0
- package/dist/schema/automations.js.map +1 -0
- package/dist/schema/better-auth.d.ts +2311 -0
- package/dist/schema/better-auth.js +156 -0
- package/dist/schema/better-auth.js.map +1 -0
- package/dist/schema/content.d.ts +966 -0
- package/dist/schema/content.js +163 -0
- package/dist/schema/content.js.map +1 -0
- package/dist/schema/credentials.d.ts +113 -0
- package/dist/schema/credentials.js +15 -0
- package/dist/schema/credentials.js.map +1 -0
- package/dist/schema/discussion.d.ts +399 -0
- package/dist/schema/discussion.js +89 -0
- package/dist/schema/discussion.js.map +1 -0
- package/dist/schema/drift.d.ts +9 -0
- package/dist/schema/drift.js +1 -0
- package/dist/schema/entitlements.d.ts +147 -0
- package/dist/schema/entitlements.js +30 -0
- package/dist/schema/entitlements.js.map +1 -0
- package/dist/schema/identity.d.ts +130 -0
- package/dist/schema/identity.js +16 -0
- package/dist/schema/identity.js.map +1 -0
- package/dist/schema/index.d.ts +18 -0
- package/dist/schema/index.js +43 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/integrations.d.ts +149 -0
- package/dist/schema/integrations.js +25 -0
- package/dist/schema/integrations.js.map +1 -0
- package/dist/schema/organizations.d.ts +416 -0
- package/dist/schema/organizations.js +58 -0
- package/dist/schema/organizations.js.map +1 -0
- package/dist/schema/outbox.d.ts +166 -0
- package/dist/schema/outbox.js +19 -0
- package/dist/schema/outbox.js.map +1 -0
- package/dist/schema/progress.d.ts +166 -0
- package/dist/schema/progress.js +30 -0
- package/dist/schema/progress.js.map +1 -0
- package/dist/schema/settings.d.ts +115 -0
- package/dist/schema/settings.js +19 -0
- package/dist/schema/settings.js.map +1 -0
- package/dist/unit-of-work.d.ts +13 -0
- package/dist/unit-of-work.js +16 -0
- package/dist/unit-of-work.js.map +1 -0
- package/drizzle/0000_baseline.sql +526 -0
- package/drizzle/meta/0000_snapshot.json +3925 -0
- package/drizzle/meta/_journal.json +13 -0
- package/package.json +56 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { boolean, index, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
2
|
+
//#region src/schema/better-auth.ts
|
|
3
|
+
const user = pgTable("ba_user", {
|
|
4
|
+
id: text("id").primaryKey(),
|
|
5
|
+
name: text("name").notNull(),
|
|
6
|
+
email: text("email").notNull().unique(),
|
|
7
|
+
emailVerified: boolean("email_verified").$defaultFn(() => false).notNull(),
|
|
8
|
+
image: text("image"),
|
|
9
|
+
createdAt: timestamp("created_at", { withTimezone: true }).$defaultFn(() => /* @__PURE__ */ new Date()).notNull(),
|
|
10
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).$defaultFn(() => /* @__PURE__ */ new Date()).notNull()
|
|
11
|
+
});
|
|
12
|
+
const session = pgTable("ba_session", {
|
|
13
|
+
id: text("id").primaryKey(),
|
|
14
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
|
15
|
+
token: text("token").notNull().unique(),
|
|
16
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
17
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
18
|
+
ipAddress: text("ip_address"),
|
|
19
|
+
userAgent: text("user_agent"),
|
|
20
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
21
|
+
activeOrganizationId: text("active_organization_id")
|
|
22
|
+
});
|
|
23
|
+
const account = pgTable("ba_account", {
|
|
24
|
+
id: text("id").primaryKey(),
|
|
25
|
+
accountId: text("account_id").notNull(),
|
|
26
|
+
providerId: text("provider_id").notNull(),
|
|
27
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
28
|
+
accessToken: text("access_token"),
|
|
29
|
+
refreshToken: text("refresh_token"),
|
|
30
|
+
idToken: text("id_token"),
|
|
31
|
+
accessTokenExpiresAt: timestamp("access_token_expires_at", { withTimezone: true }),
|
|
32
|
+
refreshTokenExpiresAt: timestamp("refresh_token_expires_at", { withTimezone: true }),
|
|
33
|
+
scope: text("scope"),
|
|
34
|
+
password: text("password"),
|
|
35
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
36
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
37
|
+
});
|
|
38
|
+
const verification = pgTable("ba_verification", {
|
|
39
|
+
id: text("id").primaryKey(),
|
|
40
|
+
identifier: text("identifier").notNull(),
|
|
41
|
+
value: text("value").notNull(),
|
|
42
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
|
43
|
+
createdAt: timestamp("created_at", { withTimezone: true }).$defaultFn(() => /* @__PURE__ */ new Date()),
|
|
44
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).$defaultFn(() => /* @__PURE__ */ new Date())
|
|
45
|
+
});
|
|
46
|
+
const organization = pgTable("ba_organization", {
|
|
47
|
+
id: text("id").primaryKey(),
|
|
48
|
+
name: text("name").notNull(),
|
|
49
|
+
slug: text("slug").notNull().unique(),
|
|
50
|
+
logo: text("logo"),
|
|
51
|
+
metadata: text("metadata"),
|
|
52
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
53
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
54
|
+
});
|
|
55
|
+
const member = pgTable("ba_member", {
|
|
56
|
+
id: text("id").primaryKey(),
|
|
57
|
+
organizationId: text("organization_id").notNull().references(() => organization.id, { onDelete: "cascade" }),
|
|
58
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
59
|
+
role: text("role").notNull().default("member"),
|
|
60
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull()
|
|
61
|
+
});
|
|
62
|
+
const invitation = pgTable("ba_invitation", {
|
|
63
|
+
id: text("id").primaryKey(),
|
|
64
|
+
organizationId: text("organization_id").notNull().references(() => organization.id, { onDelete: "cascade" }),
|
|
65
|
+
email: text("email").notNull(),
|
|
66
|
+
role: text("role").notNull(),
|
|
67
|
+
status: text("status").notNull().default("pending"),
|
|
68
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }),
|
|
69
|
+
inviterId: text("inviter_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
70
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull()
|
|
71
|
+
});
|
|
72
|
+
const oauthClient = pgTable("ba_oauth_client", {
|
|
73
|
+
id: text("id").primaryKey(),
|
|
74
|
+
clientId: text("client_id").notNull().unique(),
|
|
75
|
+
clientSecret: text("client_secret"),
|
|
76
|
+
disabled: boolean("disabled").default(false),
|
|
77
|
+
skipConsent: boolean("skip_consent"),
|
|
78
|
+
enableEndSession: boolean("enable_end_session"),
|
|
79
|
+
subjectType: text("subject_type"),
|
|
80
|
+
scopes: text("scopes").array(),
|
|
81
|
+
userId: text("user_id").references(() => user.id, { onDelete: "cascade" }),
|
|
82
|
+
name: text("name"),
|
|
83
|
+
uri: text("uri"),
|
|
84
|
+
icon: text("icon"),
|
|
85
|
+
contacts: text("contacts").array(),
|
|
86
|
+
tos: text("tos"),
|
|
87
|
+
policy: text("policy"),
|
|
88
|
+
softwareId: text("software_id"),
|
|
89
|
+
softwareVersion: text("software_version"),
|
|
90
|
+
softwareStatement: text("software_statement"),
|
|
91
|
+
redirectUris: text("redirect_uris").array().notNull(),
|
|
92
|
+
postLogoutRedirectUris: text("post_logout_redirect_uris").array(),
|
|
93
|
+
tokenEndpointAuthMethod: text("token_endpoint_auth_method"),
|
|
94
|
+
grantTypes: text("grant_types").array(),
|
|
95
|
+
responseTypes: text("response_types").array(),
|
|
96
|
+
public: boolean("public"),
|
|
97
|
+
type: text("type"),
|
|
98
|
+
requirePkce: boolean("require_pkce"),
|
|
99
|
+
referenceId: text("reference_id"),
|
|
100
|
+
metadata: text("metadata"),
|
|
101
|
+
createdAt: timestamp("created_at", { withTimezone: true }),
|
|
102
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
103
|
+
}, (t) => [index("ba_oauth_client_user_id_idx").on(t.userId)]);
|
|
104
|
+
const oauthRefreshToken = pgTable("ba_oauth_refresh_token", {
|
|
105
|
+
id: text("id").primaryKey(),
|
|
106
|
+
token: text("token").notNull().unique(),
|
|
107
|
+
clientId: text("client_id").notNull().references(() => oauthClient.clientId),
|
|
108
|
+
sessionId: text("session_id").references(() => session.id, { onDelete: "set null" }),
|
|
109
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
110
|
+
referenceId: text("reference_id"),
|
|
111
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
|
112
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
113
|
+
revoked: timestamp("revoked", { withTimezone: true }),
|
|
114
|
+
authTime: timestamp("auth_time", { withTimezone: true }),
|
|
115
|
+
scopes: text("scopes").array().notNull()
|
|
116
|
+
}, (t) => [
|
|
117
|
+
index("ba_oauth_refresh_token_client_id_idx").on(t.clientId),
|
|
118
|
+
index("ba_oauth_refresh_token_session_id_idx").on(t.sessionId),
|
|
119
|
+
index("ba_oauth_refresh_token_user_id_idx").on(t.userId)
|
|
120
|
+
]);
|
|
121
|
+
const oauthAccessToken = pgTable("ba_oauth_access_token", {
|
|
122
|
+
id: text("id").primaryKey(),
|
|
123
|
+
token: text("token").notNull().unique(),
|
|
124
|
+
clientId: text("client_id").notNull().references(() => oauthClient.clientId),
|
|
125
|
+
sessionId: text("session_id").references(() => session.id, { onDelete: "set null" }),
|
|
126
|
+
userId: text("user_id").references(() => user.id, { onDelete: "cascade" }),
|
|
127
|
+
referenceId: text("reference_id"),
|
|
128
|
+
refreshId: text("refresh_id").references(() => oauthRefreshToken.id),
|
|
129
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
|
130
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
131
|
+
scopes: text("scopes").array().notNull()
|
|
132
|
+
}, (t) => [
|
|
133
|
+
index("ba_oauth_access_token_client_id_idx").on(t.clientId),
|
|
134
|
+
index("ba_oauth_access_token_session_id_idx").on(t.sessionId),
|
|
135
|
+
index("ba_oauth_access_token_user_id_idx").on(t.userId),
|
|
136
|
+
index("ba_oauth_access_token_refresh_id_idx").on(t.refreshId)
|
|
137
|
+
]);
|
|
138
|
+
const oauthConsent = pgTable("ba_oauth_consent", {
|
|
139
|
+
id: text("id").primaryKey(),
|
|
140
|
+
clientId: text("client_id").notNull().references(() => oauthClient.clientId),
|
|
141
|
+
userId: text("user_id").references(() => user.id, { onDelete: "cascade" }),
|
|
142
|
+
referenceId: text("reference_id"),
|
|
143
|
+
scopes: text("scopes").array().notNull(),
|
|
144
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
145
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
146
|
+
}, (t) => [index("ba_oauth_consent_client_id_idx").on(t.clientId), index("ba_oauth_consent_user_id_idx").on(t.userId)]);
|
|
147
|
+
const jwks = pgTable("ba_jwks", {
|
|
148
|
+
id: text("id").primaryKey(),
|
|
149
|
+
publicKey: text("public_key").notNull(),
|
|
150
|
+
privateKey: text("private_key").notNull(),
|
|
151
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull()
|
|
152
|
+
});
|
|
153
|
+
//#endregion
|
|
154
|
+
export { account, invitation, jwks, member, oauthAccessToken, oauthClient, oauthConsent, oauthRefreshToken, organization, session, user, verification };
|
|
155
|
+
|
|
156
|
+
//# sourceMappingURL=better-auth.js.map
|
|
@@ -0,0 +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":";;AAO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