@contentgrowth/content-auth 0.4.8 → 0.5.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/README.md +68 -2
- package/dist/backend/index.d.ts +185 -1903
- package/dist/backend/index.js +1 -1
- package/dist/{chunk-CTASTCWI.js → chunk-3HNFZJ7S.js} +6 -6
- package/dist/{chunk-WI4UHTAT.js → chunk-52ZT54FA.js} +71 -186
- package/dist/chunk-CBNSTIX6.js +17 -0
- package/dist/chunk-F2G7XJIZ.js +17 -0
- package/dist/frontend/astro.d.ts +6 -0
- package/dist/frontend/astro.js +9 -0
- package/dist/frontend/client.d.ts +54 -18
- package/dist/frontend/clients/astro-client.d.ts +3134 -0
- package/dist/frontend/clients/astro-client.js +9 -0
- package/dist/frontend/clients/vue-client.d.ts +3520 -0
- package/dist/frontend/clients/vue-client.js +9 -0
- package/dist/frontend/components/astro/astro/AuthForm.astro +389 -0
- package/dist/frontend/components/astro/astro/ForgotPasswordForm.astro +127 -0
- package/dist/frontend/components/astro/astro/Organization.astro +254 -0
- package/dist/frontend/components/astro/astro/PasswordChanger.astro +128 -0
- package/dist/frontend/components/astro/astro/ProfileEditor.astro +133 -0
- package/dist/frontend/components/astro/astro/ResetPasswordForm.astro +172 -0
- package/dist/frontend/components/vue/vue/AuthForm.vue +337 -0
- package/dist/frontend/components/vue/vue/ForgotPasswordForm.vue +108 -0
- package/dist/frontend/components/vue/vue/Organization.vue +215 -0
- package/dist/frontend/components/vue/vue/PasswordChanger.vue +115 -0
- package/dist/frontend/components/vue/vue/ProfileEditor.vue +112 -0
- package/dist/frontend/components/vue/vue/ResetPasswordForm.vue +150 -0
- package/dist/frontend/index.js +1 -1
- package/dist/frontend/vue.d.ts +12 -0
- package/dist/frontend/vue.js +23 -0
- package/dist/index.js +2 -2
- package/package.json +32 -6
package/dist/backend/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
authClient
|
|
3
3
|
} from "./chunk-NKDKDBM2.js";
|
|
4
4
|
|
|
5
|
-
// src/frontend/components/AuthForm.tsx
|
|
5
|
+
// src/frontend/components/react/AuthForm.tsx
|
|
6
6
|
import { useState, useRef, useEffect } from "react";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
var AuthForm = ({
|
|
@@ -296,7 +296,7 @@ var AuthForm = ({
|
|
|
296
296
|
] });
|
|
297
297
|
};
|
|
298
298
|
|
|
299
|
-
// src/frontend/components/ForgotPasswordForm.tsx
|
|
299
|
+
// src/frontend/components/react/ForgotPasswordForm.tsx
|
|
300
300
|
import { useState as useState2 } from "react";
|
|
301
301
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
302
302
|
var ForgotPasswordForm = ({
|
|
@@ -378,7 +378,7 @@ var ForgotPasswordForm = ({
|
|
|
378
378
|
] });
|
|
379
379
|
};
|
|
380
380
|
|
|
381
|
-
// src/frontend/components/ResetPasswordForm.tsx
|
|
381
|
+
// src/frontend/components/react/ResetPasswordForm.tsx
|
|
382
382
|
import { useState as useState3 } from "react";
|
|
383
383
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
384
384
|
var ResetPasswordForm = ({
|
|
@@ -496,7 +496,7 @@ var ResetPasswordForm = ({
|
|
|
496
496
|
] });
|
|
497
497
|
};
|
|
498
498
|
|
|
499
|
-
// src/frontend/components/Organization.tsx
|
|
499
|
+
// src/frontend/components/react/Organization.tsx
|
|
500
500
|
import { useState as useState4, useEffect as useEffect2 } from "react";
|
|
501
501
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
502
502
|
var CreateOrganizationForm = ({
|
|
@@ -661,7 +661,7 @@ var InviteMemberForm = ({
|
|
|
661
661
|
] });
|
|
662
662
|
};
|
|
663
663
|
|
|
664
|
-
// src/frontend/components/ProfileEditor.tsx
|
|
664
|
+
// src/frontend/components/react/ProfileEditor.tsx
|
|
665
665
|
import { useState as useState5, useEffect as useEffect3 } from "react";
|
|
666
666
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
667
667
|
var ProfileEditor = ({
|
|
@@ -746,7 +746,7 @@ var ProfileEditor = ({
|
|
|
746
746
|
] });
|
|
747
747
|
};
|
|
748
748
|
|
|
749
|
-
// src/frontend/components/PasswordChanger.tsx
|
|
749
|
+
// src/frontend/components/react/PasswordChanger.tsx
|
|
750
750
|
import { useState as useState6 } from "react";
|
|
751
751
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
752
752
|
var PasswordChanger = ({
|
|
@@ -147,206 +147,92 @@ var createAdditionalColumns = (additionalFields) => {
|
|
|
147
147
|
});
|
|
148
148
|
return columns;
|
|
149
149
|
};
|
|
150
|
-
var createUsersTable = (tableName = "users", fields, additionalFields) => {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
name: nameCol,
|
|
162
|
-
[fields?.name || "name"]: nameCol,
|
|
163
|
-
email: emailCol,
|
|
164
|
-
[fields?.email || "email"]: emailCol,
|
|
165
|
-
emailVerified: emailVerifiedCol,
|
|
166
|
-
[fields?.emailVerified || "emailVerified"]: emailVerifiedCol,
|
|
167
|
-
image: imageCol,
|
|
168
|
-
[fields?.image || "image"]: imageCol,
|
|
169
|
-
createdAt: createdAtCol,
|
|
170
|
-
[fields?.createdAt || "createdAt"]: createdAtCol,
|
|
171
|
-
updatedAt: updatedAtCol,
|
|
172
|
-
[fields?.updatedAt || "updatedAt"]: updatedAtCol,
|
|
173
|
-
...createAdditionalColumns(additionalFields)
|
|
174
|
-
});
|
|
175
|
-
};
|
|
176
|
-
var createSessionsTable = (tableName = "sessions", usersTableOrFn = users, fields, userPkField = "id", additionalFields) => {
|
|
150
|
+
var createUsersTable = (tableName = "users", fields, additionalFields) => sqliteTable(tableName, {
|
|
151
|
+
id: text(fields?.id || "id").primaryKey(),
|
|
152
|
+
[fields?.name || "name"]: text(fields?.name || "name").notNull(),
|
|
153
|
+
[fields?.email || "email"]: text(fields?.email || "email").notNull().unique(),
|
|
154
|
+
[fields?.emailVerified || "emailVerified"]: integer(fields?.emailVerified || "emailVerified", { mode: "boolean" }).notNull(),
|
|
155
|
+
[fields?.image || "image"]: text(fields?.image || "image"),
|
|
156
|
+
[fields?.createdAt || "createdAt"]: integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull(),
|
|
157
|
+
[fields?.updatedAt || "updatedAt"]: integer(fields?.updatedAt || "updatedAt", { mode: "timestamp" }).notNull(),
|
|
158
|
+
...createAdditionalColumns(additionalFields)
|
|
159
|
+
});
|
|
160
|
+
var createSessionsTable = (tableName = "sessions", usersTableOrFn = users, fields, additionalFields) => {
|
|
177
161
|
const usersTable = typeof usersTableOrFn === "function" ? usersTableOrFn() : usersTableOrFn;
|
|
178
|
-
const idCol = text(fields?.id || "id").primaryKey();
|
|
179
|
-
const expiresAtCol = integer(fields?.expiresAt || "expiresAt", { mode: "timestamp" }).notNull();
|
|
180
|
-
const tokenCol = text(fields?.token || "token").notNull().unique();
|
|
181
|
-
const createdAtCol = integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull();
|
|
182
|
-
const updatedAtCol = integer(fields?.updatedAt || "updatedAt", { mode: "timestamp" }).notNull();
|
|
183
|
-
const ipAddressCol = text(fields?.ipAddress || "ipAddress");
|
|
184
|
-
const userAgentCol = text(fields?.userAgent || "userAgent");
|
|
185
|
-
const userIdCol = text(fields?.userId || "userId").notNull().references(() => usersTable[userPkField] || usersTable.id, { onDelete: "cascade" });
|
|
186
|
-
const activeOrganizationIdCol = text(fields?.activeOrganizationId || "activeOrganizationId");
|
|
187
162
|
return sqliteTable(tableName, {
|
|
188
|
-
id:
|
|
189
|
-
[fields?.
|
|
190
|
-
|
|
191
|
-
[fields?.
|
|
192
|
-
|
|
193
|
-
[fields?.
|
|
194
|
-
|
|
195
|
-
[fields?.
|
|
196
|
-
|
|
197
|
-
[fields?.updatedAt || "updatedAt"]: updatedAtCol,
|
|
198
|
-
ipAddress: ipAddressCol,
|
|
199
|
-
[fields?.ipAddress || "ipAddress"]: ipAddressCol,
|
|
200
|
-
userAgent: userAgentCol,
|
|
201
|
-
[fields?.userAgent || "userAgent"]: userAgentCol,
|
|
202
|
-
userId: userIdCol,
|
|
203
|
-
[fields?.userId || "userId"]: userIdCol,
|
|
204
|
-
activeOrganizationId: activeOrganizationIdCol,
|
|
205
|
-
[fields?.activeOrganizationId || "activeOrganizationId"]: activeOrganizationIdCol,
|
|
163
|
+
id: text(fields?.id || "id").primaryKey(),
|
|
164
|
+
[fields?.expiresAt || "expiresAt"]: integer(fields?.expiresAt || "expiresAt", { mode: "timestamp" }).notNull(),
|
|
165
|
+
[fields?.token || "token"]: text(fields?.token || "token").notNull().unique(),
|
|
166
|
+
[fields?.createdAt || "createdAt"]: integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull(),
|
|
167
|
+
[fields?.updatedAt || "updatedAt"]: integer(fields?.updatedAt || "updatedAt", { mode: "timestamp" }).notNull(),
|
|
168
|
+
[fields?.ipAddress || "ipAddress"]: text(fields?.ipAddress || "ipAddress"),
|
|
169
|
+
[fields?.userAgent || "userAgent"]: text(fields?.userAgent || "userAgent"),
|
|
170
|
+
[fields?.userId || "userId"]: text(fields?.userId || "userId").notNull().references(() => usersTable.id, { onDelete: "cascade" }),
|
|
171
|
+
[fields?.activeOrganizationId || "activeOrganizationId"]: text(fields?.activeOrganizationId || "activeOrganizationId"),
|
|
206
172
|
...createAdditionalColumns(additionalFields)
|
|
207
173
|
});
|
|
208
174
|
};
|
|
209
|
-
var createAccountsTable = (tableName = "accounts", usersTableOrFn = users, fields,
|
|
175
|
+
var createAccountsTable = (tableName = "accounts", usersTableOrFn = users, fields, additionalFields) => {
|
|
210
176
|
const usersTable = typeof usersTableOrFn === "function" ? usersTableOrFn() : usersTableOrFn;
|
|
211
|
-
const idCol = text(fields?.id || "id").primaryKey();
|
|
212
|
-
const accountIdCol = text(fields?.accountId || "accountId").notNull();
|
|
213
|
-
const providerIdCol = text(fields?.providerId || "providerId").notNull();
|
|
214
|
-
const userIdCol = text(fields?.userId || "userId").notNull().references(() => usersTable[userPkField] || usersTable.id, { onDelete: "cascade" });
|
|
215
|
-
const accessTokenCol = text(fields?.accessToken || "accessToken");
|
|
216
|
-
const refreshTokenCol = text(fields?.refreshToken || "refreshToken");
|
|
217
|
-
const idTokenCol = text(fields?.idToken || "idToken");
|
|
218
|
-
const accessTokenExpiresAtCol = integer(fields?.accessTokenExpiresAt || "accessTokenExpiresAt", { mode: "timestamp" });
|
|
219
|
-
const refreshTokenExpiresAtCol = integer(fields?.refreshTokenExpiresAt || "refreshTokenExpiresAt", { mode: "timestamp" });
|
|
220
|
-
const scopeCol = text(fields?.scope || "scope");
|
|
221
|
-
const passwordCol = text(fields?.password || "password");
|
|
222
|
-
const createdAtCol = integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull();
|
|
223
|
-
const updatedAtCol = integer(fields?.updatedAt || "updatedAt", { mode: "timestamp" }).notNull();
|
|
224
177
|
return sqliteTable(tableName, {
|
|
225
|
-
id:
|
|
226
|
-
[fields?.
|
|
227
|
-
|
|
228
|
-
[fields?.
|
|
229
|
-
|
|
230
|
-
[fields?.
|
|
231
|
-
|
|
232
|
-
[fields?.
|
|
233
|
-
|
|
234
|
-
[fields?.
|
|
235
|
-
|
|
236
|
-
[fields?.
|
|
237
|
-
|
|
238
|
-
[fields?.idToken || "idToken"]: idTokenCol,
|
|
239
|
-
accessTokenExpiresAt: accessTokenExpiresAtCol,
|
|
240
|
-
[fields?.accessTokenExpiresAt || "accessTokenExpiresAt"]: accessTokenExpiresAtCol,
|
|
241
|
-
refreshTokenExpiresAt: refreshTokenExpiresAtCol,
|
|
242
|
-
[fields?.refreshTokenExpiresAt || "refreshTokenExpiresAt"]: refreshTokenExpiresAtCol,
|
|
243
|
-
scope: scopeCol,
|
|
244
|
-
[fields?.scope || "scope"]: scopeCol,
|
|
245
|
-
password: passwordCol,
|
|
246
|
-
[fields?.password || "password"]: passwordCol,
|
|
247
|
-
createdAt: createdAtCol,
|
|
248
|
-
[fields?.createdAt || "createdAt"]: createdAtCol,
|
|
249
|
-
updatedAt: updatedAtCol,
|
|
250
|
-
[fields?.updatedAt || "updatedAt"]: updatedAtCol,
|
|
178
|
+
id: text(fields?.id || "id").primaryKey(),
|
|
179
|
+
[fields?.accountId || "accountId"]: text(fields?.accountId || "accountId").notNull(),
|
|
180
|
+
[fields?.providerId || "providerId"]: text(fields?.providerId || "providerId").notNull(),
|
|
181
|
+
[fields?.userId || "userId"]: text(fields?.userId || "userId").notNull().references(() => usersTable.id, { onDelete: "cascade" }),
|
|
182
|
+
[fields?.accessToken || "accessToken"]: text(fields?.accessToken || "accessToken"),
|
|
183
|
+
[fields?.refreshToken || "refreshToken"]: text(fields?.refreshToken || "refreshToken"),
|
|
184
|
+
[fields?.idToken || "idToken"]: text(fields?.idToken || "idToken"),
|
|
185
|
+
[fields?.accessTokenExpiresAt || "accessTokenExpiresAt"]: integer(fields?.accessTokenExpiresAt || "accessTokenExpiresAt", { mode: "timestamp" }),
|
|
186
|
+
[fields?.refreshTokenExpiresAt || "refreshTokenExpiresAt"]: integer(fields?.refreshTokenExpiresAt || "refreshTokenExpiresAt", { mode: "timestamp" }),
|
|
187
|
+
[fields?.scope || "scope"]: text(fields?.scope || "scope"),
|
|
188
|
+
[fields?.password || "password"]: text(fields?.password || "password"),
|
|
189
|
+
[fields?.createdAt || "createdAt"]: integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull(),
|
|
190
|
+
[fields?.updatedAt || "updatedAt"]: integer(fields?.updatedAt || "updatedAt", { mode: "timestamp" }).notNull(),
|
|
251
191
|
...createAdditionalColumns(additionalFields)
|
|
252
192
|
});
|
|
253
193
|
};
|
|
254
|
-
var createVerificationsTable = (tableName = "verifications", fields, additionalFields) => {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
[fields?.updatedAt || "updatedAt"]: updatedAtCol,
|
|
274
|
-
...createAdditionalColumns(additionalFields)
|
|
275
|
-
});
|
|
276
|
-
};
|
|
277
|
-
var createOrganizationsTable = (tableName = "organizations", fields, additionalFields) => {
|
|
278
|
-
const idCol = text(fields?.id || "id").primaryKey();
|
|
279
|
-
const nameCol = text(fields?.name || "name").notNull();
|
|
280
|
-
const slugCol = text(fields?.slug || "slug").unique();
|
|
281
|
-
const logoCol = text(fields?.logo || "logo");
|
|
282
|
-
const createdAtCol = integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull();
|
|
283
|
-
const metadataCol = text(fields?.metadata || "metadata");
|
|
284
|
-
return sqliteTable(tableName, {
|
|
285
|
-
id: idCol,
|
|
286
|
-
[fields?.id || "id"]: idCol,
|
|
287
|
-
name: nameCol,
|
|
288
|
-
[fields?.name || "name"]: nameCol,
|
|
289
|
-
slug: slugCol,
|
|
290
|
-
[fields?.slug || "slug"]: slugCol,
|
|
291
|
-
logo: logoCol,
|
|
292
|
-
[fields?.logo || "logo"]: logoCol,
|
|
293
|
-
createdAt: createdAtCol,
|
|
294
|
-
[fields?.createdAt || "createdAt"]: createdAtCol,
|
|
295
|
-
metadata: metadataCol,
|
|
296
|
-
[fields?.metadata || "metadata"]: metadataCol,
|
|
297
|
-
...createAdditionalColumns(additionalFields)
|
|
298
|
-
});
|
|
299
|
-
};
|
|
300
|
-
var createMembersTable = (tableName = "members", organizationsTableOrFn = organizations, usersTableOrFn = users, fields, userPkField = "id", additionalFields) => {
|
|
194
|
+
var createVerificationsTable = (tableName = "verifications", fields, additionalFields) => sqliteTable(tableName, {
|
|
195
|
+
id: text(fields?.id || "id").primaryKey(),
|
|
196
|
+
[fields?.identifier || "identifier"]: text(fields?.identifier || "identifier").notNull(),
|
|
197
|
+
[fields?.value || "value"]: text(fields?.value || "value").notNull(),
|
|
198
|
+
[fields?.expiresAt || "expiresAt"]: integer(fields?.expiresAt || "expiresAt", { mode: "timestamp" }).notNull(),
|
|
199
|
+
[fields?.createdAt || "createdAt"]: integer(fields?.createdAt || "createdAt", { mode: "timestamp" }),
|
|
200
|
+
[fields?.updatedAt || "updatedAt"]: integer(fields?.updatedAt || "updatedAt", { mode: "timestamp" }),
|
|
201
|
+
...createAdditionalColumns(additionalFields)
|
|
202
|
+
});
|
|
203
|
+
var createOrganizationsTable = (tableName = "organizations", fields, additionalFields) => sqliteTable(tableName, {
|
|
204
|
+
id: text(fields?.id || "id").primaryKey(),
|
|
205
|
+
[fields?.name || "name"]: text(fields?.name || "name").notNull(),
|
|
206
|
+
[fields?.slug || "slug"]: text(fields?.slug || "slug").unique(),
|
|
207
|
+
[fields?.logo || "logo"]: text(fields?.logo || "logo"),
|
|
208
|
+
[fields?.createdAt || "createdAt"]: integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull(),
|
|
209
|
+
[fields?.metadata || "metadata"]: text(fields?.metadata || "metadata"),
|
|
210
|
+
...createAdditionalColumns(additionalFields)
|
|
211
|
+
});
|
|
212
|
+
var createMembersTable = (tableName = "members", organizationsTableOrFn = organizations, usersTableOrFn = users, fields, additionalFields) => {
|
|
301
213
|
const organizationsTable = typeof organizationsTableOrFn === "function" ? organizationsTableOrFn() : organizationsTableOrFn;
|
|
302
214
|
const usersTable = typeof usersTableOrFn === "function" ? usersTableOrFn() : usersTableOrFn;
|
|
303
|
-
const idCol = text(fields?.id || "id").primaryKey();
|
|
304
|
-
const organizationIdCol = text(fields?.organizationId || "organizationId").notNull().references(() => organizationsTable[fields?.organizationId || "id"] || organizationsTable.id, { onDelete: "cascade" });
|
|
305
|
-
const userIdCol = text(fields?.userId || "userId").notNull().references(() => usersTable[userPkField] || usersTable.id, { onDelete: "cascade" });
|
|
306
|
-
const roleCol = text(fields?.role || "role").notNull();
|
|
307
|
-
const createdAtCol = integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull();
|
|
308
215
|
return sqliteTable(tableName, {
|
|
309
|
-
id:
|
|
310
|
-
[fields?.
|
|
311
|
-
|
|
312
|
-
[fields?.
|
|
313
|
-
|
|
314
|
-
[fields?.userId || "userId"]: userIdCol,
|
|
315
|
-
role: roleCol,
|
|
316
|
-
[fields?.role || "role"]: roleCol,
|
|
317
|
-
createdAt: createdAtCol,
|
|
318
|
-
[fields?.createdAt || "createdAt"]: createdAtCol,
|
|
216
|
+
id: text(fields?.id || "id").primaryKey(),
|
|
217
|
+
[fields?.organizationId || "organizationId"]: text(fields?.organizationId || "organizationId").notNull().references(() => organizationsTable.id, { onDelete: "cascade" }),
|
|
218
|
+
[fields?.userId || "userId"]: text(fields?.userId || "userId").notNull().references(() => usersTable.id, { onDelete: "cascade" }),
|
|
219
|
+
[fields?.role || "role"]: text(fields?.role || "role").notNull(),
|
|
220
|
+
[fields?.createdAt || "createdAt"]: integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull(),
|
|
319
221
|
...createAdditionalColumns(additionalFields)
|
|
320
222
|
});
|
|
321
223
|
};
|
|
322
|
-
var createInvitationsTable = (tableName = "invitations", organizationsTableOrFn = organizations, usersTableOrFn = users, fields,
|
|
224
|
+
var createInvitationsTable = (tableName = "invitations", organizationsTableOrFn = organizations, usersTableOrFn = users, fields, additionalFields) => {
|
|
323
225
|
const organizationsTable = typeof organizationsTableOrFn === "function" ? organizationsTableOrFn() : organizationsTableOrFn;
|
|
324
226
|
const usersTable = typeof usersTableOrFn === "function" ? usersTableOrFn() : usersTableOrFn;
|
|
325
|
-
const idCol = text(fields?.id || "id").primaryKey();
|
|
326
|
-
const organizationIdCol = text(fields?.organizationId || "organizationId").notNull().references(() => organizationsTable[fields?.organizationId || "id"] || organizationsTable.id, { onDelete: "cascade" });
|
|
327
|
-
const emailCol = text(fields?.email || "email").notNull();
|
|
328
|
-
const roleCol = text(fields?.role || "role");
|
|
329
|
-
const statusCol = text(fields?.status || "status").notNull();
|
|
330
|
-
const expiresAtCol = integer(fields?.expiresAt || "expiresAt", { mode: "timestamp" }).notNull();
|
|
331
|
-
const inviterIdCol = text(fields?.inviterId || "inviterId").notNull().references(() => usersTable[userPkField] || usersTable.id, { onDelete: "cascade" });
|
|
332
|
-
const createdAtCol = integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull();
|
|
333
227
|
return sqliteTable(tableName, {
|
|
334
|
-
id:
|
|
335
|
-
[fields?.
|
|
336
|
-
|
|
337
|
-
[fields?.
|
|
338
|
-
|
|
339
|
-
[fields?.
|
|
340
|
-
|
|
341
|
-
[fields?.
|
|
342
|
-
status: statusCol,
|
|
343
|
-
[fields?.status || "status"]: statusCol,
|
|
344
|
-
expiresAt: expiresAtCol,
|
|
345
|
-
[fields?.expiresAt || "expiresAt"]: expiresAtCol,
|
|
346
|
-
inviterId: inviterIdCol,
|
|
347
|
-
[fields?.inviterId || "inviterId"]: inviterIdCol,
|
|
348
|
-
createdAt: createdAtCol,
|
|
349
|
-
[fields?.createdAt || "createdAt"]: createdAtCol,
|
|
228
|
+
id: text(fields?.id || "id").primaryKey(),
|
|
229
|
+
[fields?.organizationId || "organizationId"]: text(fields?.organizationId || "organizationId").notNull().references(() => organizationsTable.id, { onDelete: "cascade" }),
|
|
230
|
+
[fields?.email || "email"]: text(fields?.email || "email").notNull(),
|
|
231
|
+
[fields?.role || "role"]: text(fields?.role || "role"),
|
|
232
|
+
[fields?.status || "status"]: text(fields?.status || "status").notNull(),
|
|
233
|
+
[fields?.expiresAt || "expiresAt"]: integer(fields?.expiresAt || "expiresAt", { mode: "timestamp" }).notNull(),
|
|
234
|
+
[fields?.inviterId || "inviterId"]: text(fields?.inviterId || "inviterId").notNull().references(() => usersTable.id, { onDelete: "cascade" }),
|
|
235
|
+
[fields?.createdAt || "createdAt"]: integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull(),
|
|
350
236
|
...createAdditionalColumns(additionalFields)
|
|
351
237
|
});
|
|
352
238
|
};
|
|
@@ -496,14 +382,13 @@ var createAuth = (config) => {
|
|
|
496
382
|
const orgTableName = schemaMapping?.organization?.tableName || "organizations";
|
|
497
383
|
const memberTableName = schemaMapping?.member?.tableName || "members";
|
|
498
384
|
const invitationTableName = schemaMapping?.invitation?.tableName || "invitations";
|
|
499
|
-
const userPkField = schemaMapping?.user?.fields?.id || "id";
|
|
500
385
|
const usersTable = createUsersTable(userTableName, schemaMapping?.user?.fields, schemaMapping?.user?.additionalFields);
|
|
501
386
|
const organizationsTable = createOrganizationsTable(orgTableName, schemaMapping?.organization?.fields, schemaMapping?.organization?.additionalFields);
|
|
502
|
-
const sessionsTable = createSessionsTable(sessionTableName, usersTable, schemaMapping?.session?.fields,
|
|
503
|
-
const accountsTable = createAccountsTable(accountTableName, usersTable, schemaMapping?.account?.fields,
|
|
387
|
+
const sessionsTable = createSessionsTable(sessionTableName, usersTable, schemaMapping?.session?.fields, schemaMapping?.session?.additionalFields);
|
|
388
|
+
const accountsTable = createAccountsTable(accountTableName, usersTable, schemaMapping?.account?.fields, schemaMapping?.account?.additionalFields);
|
|
504
389
|
const verificationsTable = createVerificationsTable(verificationTableName, schemaMapping?.verification?.fields, schemaMapping?.verification?.additionalFields);
|
|
505
|
-
const membersTable = createMembersTable(memberTableName, organizationsTable, usersTable, schemaMapping?.member?.fields,
|
|
506
|
-
const invitationsTable = createInvitationsTable(invitationTableName, organizationsTable, usersTable, schemaMapping?.invitation?.fields,
|
|
390
|
+
const membersTable = createMembersTable(memberTableName, organizationsTable, usersTable, schemaMapping?.member?.fields, schemaMapping?.member?.additionalFields);
|
|
391
|
+
const invitationsTable = createInvitationsTable(invitationTableName, organizationsTable, usersTable, schemaMapping?.invitation?.fields, schemaMapping?.invitation?.additionalFields);
|
|
507
392
|
const userKey = schemaMapping?.user?.tableName || "user";
|
|
508
393
|
const sessionKey = schemaMapping?.session?.tableName || "session";
|
|
509
394
|
const accountKey = schemaMapping?.account?.tableName || "account";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/frontend/clients/astro-client.ts
|
|
2
|
+
import { createAuthClient } from "better-auth/client";
|
|
3
|
+
import { organizationClient } from "better-auth/client/plugins";
|
|
4
|
+
var createClient = (baseUrl) => {
|
|
5
|
+
return createAuthClient({
|
|
6
|
+
baseURL: baseUrl,
|
|
7
|
+
plugins: [
|
|
8
|
+
organizationClient()
|
|
9
|
+
]
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var authClient = createClient();
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
createClient,
|
|
16
|
+
authClient
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/frontend/clients/vue-client.ts
|
|
2
|
+
import { createAuthClient } from "better-auth/vue";
|
|
3
|
+
import { organizationClient } from "better-auth/client/plugins";
|
|
4
|
+
var createClient = (baseUrl) => {
|
|
5
|
+
return createAuthClient({
|
|
6
|
+
baseURL: baseUrl,
|
|
7
|
+
plugins: [
|
|
8
|
+
organizationClient()
|
|
9
|
+
]
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var authClient = createClient();
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
createClient,
|
|
16
|
+
authClient
|
|
17
|
+
};
|
|
@@ -965,13 +965,13 @@ declare const createClient: (baseUrl?: string) => {
|
|
|
965
965
|
token: string | null;
|
|
966
966
|
user: {
|
|
967
967
|
id: string;
|
|
968
|
-
email: string;
|
|
969
|
-
name: string;
|
|
970
|
-
image: string | null | undefined;
|
|
971
|
-
emailVerified: boolean;
|
|
972
968
|
createdAt: Date;
|
|
973
969
|
updatedAt: Date;
|
|
974
|
-
|
|
970
|
+
email: string;
|
|
971
|
+
emailVerified: boolean;
|
|
972
|
+
name: string;
|
|
973
|
+
image?: string | null | undefined;
|
|
974
|
+
} & Record<string, any>;
|
|
975
975
|
}, {
|
|
976
976
|
code?: string | undefined;
|
|
977
977
|
message?: string | undefined;
|
|
@@ -1135,13 +1135,13 @@ declare const createClient: (baseUrl?: string) => {
|
|
|
1135
1135
|
query?: Record<string, any> | undefined;
|
|
1136
1136
|
fetchOptions?: FetchOptions | undefined;
|
|
1137
1137
|
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
1138
|
+
scopes: string[];
|
|
1138
1139
|
id: string;
|
|
1139
|
-
providerId: string;
|
|
1140
1140
|
createdAt: Date;
|
|
1141
1141
|
updatedAt: Date;
|
|
1142
|
-
accountId: string;
|
|
1143
1142
|
userId: string;
|
|
1144
|
-
|
|
1143
|
+
providerId: string;
|
|
1144
|
+
accountId: string;
|
|
1145
1145
|
}[], {
|
|
1146
1146
|
code?: string | undefined;
|
|
1147
1147
|
message?: string | undefined;
|
|
@@ -1444,6 +1444,7 @@ declare const createClient: (baseUrl?: string) => {
|
|
|
1444
1444
|
})[];
|
|
1445
1445
|
cache?: RequestCache | undefined;
|
|
1446
1446
|
method: string;
|
|
1447
|
+
window?: null | undefined;
|
|
1447
1448
|
headers?: (HeadersInit & (HeadersInit | {
|
|
1448
1449
|
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1449
1450
|
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
@@ -1458,7 +1459,6 @@ declare const createClient: (baseUrl?: string) => {
|
|
|
1458
1459
|
referrer?: string | undefined;
|
|
1459
1460
|
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1460
1461
|
signal?: (AbortSignal | null) | undefined;
|
|
1461
|
-
window?: null | undefined;
|
|
1462
1462
|
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
|
|
1463
1463
|
hookOptions?: {
|
|
1464
1464
|
cloneResponse?: boolean;
|
|
@@ -1578,6 +1578,24 @@ declare const createClient: (baseUrl?: string) => {
|
|
|
1578
1578
|
readonly FAILED_TO_UNLINK_LAST_ACCOUNT: "You can't unlink your last account";
|
|
1579
1579
|
readonly ACCOUNT_NOT_FOUND: "Account not found";
|
|
1580
1580
|
readonly USER_ALREADY_HAS_PASSWORD: "User already has a password. Provide that to delete the account.";
|
|
1581
|
+
readonly CROSS_SITE_NAVIGATION_LOGIN_BLOCKED: "Cross-site navigation login blocked. This request appears to be a CSRF attack.";
|
|
1582
|
+
readonly VERIFICATION_EMAIL_NOT_ENABLED: "Verification email isn't enabled";
|
|
1583
|
+
readonly EMAIL_ALREADY_VERIFIED: "Email is already verified";
|
|
1584
|
+
readonly EMAIL_MISMATCH: "Email mismatch";
|
|
1585
|
+
readonly SESSION_NOT_FRESH: "Session is not fresh";
|
|
1586
|
+
readonly LINKED_ACCOUNT_ALREADY_EXISTS: "Linked account already exists";
|
|
1587
|
+
readonly INVALID_ORIGIN: "Invalid origin";
|
|
1588
|
+
readonly INVALID_CALLBACK_URL: "Invalid callbackURL";
|
|
1589
|
+
readonly INVALID_REDIRECT_URL: "Invalid redirectURL";
|
|
1590
|
+
readonly INVALID_ERROR_CALLBACK_URL: "Invalid errorCallbackURL";
|
|
1591
|
+
readonly INVALID_NEW_USER_CALLBACK_URL: "Invalid newUserCallbackURL";
|
|
1592
|
+
readonly MISSING_OR_NULL_ORIGIN: "Missing or null Origin";
|
|
1593
|
+
readonly CALLBACK_URL_REQUIRED: "callbackURL is required";
|
|
1594
|
+
readonly FAILED_TO_CREATE_VERIFICATION: "Unable to create verification";
|
|
1595
|
+
readonly FIELD_NOT_ALLOWED: "Field not allowed to be set";
|
|
1596
|
+
readonly ASYNC_VALIDATION_NOT_SUPPORTED: "Async validation is not supported";
|
|
1597
|
+
readonly VALIDATION_ERROR: "Validation Error";
|
|
1598
|
+
readonly MISSING_FIELD: "Field is required";
|
|
1581
1599
|
};
|
|
1582
1600
|
};
|
|
1583
1601
|
declare const authClient: {
|
|
@@ -2542,13 +2560,13 @@ declare const authClient: {
|
|
|
2542
2560
|
token: string | null;
|
|
2543
2561
|
user: {
|
|
2544
2562
|
id: string;
|
|
2545
|
-
email: string;
|
|
2546
|
-
name: string;
|
|
2547
|
-
image: string | null | undefined;
|
|
2548
|
-
emailVerified: boolean;
|
|
2549
2563
|
createdAt: Date;
|
|
2550
2564
|
updatedAt: Date;
|
|
2551
|
-
|
|
2565
|
+
email: string;
|
|
2566
|
+
emailVerified: boolean;
|
|
2567
|
+
name: string;
|
|
2568
|
+
image?: string | null | undefined;
|
|
2569
|
+
} & Record<string, any>;
|
|
2552
2570
|
}, {
|
|
2553
2571
|
code?: string | undefined;
|
|
2554
2572
|
message?: string | undefined;
|
|
@@ -2712,13 +2730,13 @@ declare const authClient: {
|
|
|
2712
2730
|
query?: Record<string, any> | undefined;
|
|
2713
2731
|
fetchOptions?: FetchOptions | undefined;
|
|
2714
2732
|
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
2733
|
+
scopes: string[];
|
|
2715
2734
|
id: string;
|
|
2716
|
-
providerId: string;
|
|
2717
2735
|
createdAt: Date;
|
|
2718
2736
|
updatedAt: Date;
|
|
2719
|
-
accountId: string;
|
|
2720
2737
|
userId: string;
|
|
2721
|
-
|
|
2738
|
+
providerId: string;
|
|
2739
|
+
accountId: string;
|
|
2722
2740
|
}[], {
|
|
2723
2741
|
code?: string | undefined;
|
|
2724
2742
|
message?: string | undefined;
|
|
@@ -3021,6 +3039,7 @@ declare const authClient: {
|
|
|
3021
3039
|
})[];
|
|
3022
3040
|
cache?: RequestCache | undefined;
|
|
3023
3041
|
method: string;
|
|
3042
|
+
window?: null | undefined;
|
|
3024
3043
|
headers?: (HeadersInit & (HeadersInit | {
|
|
3025
3044
|
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
3026
3045
|
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
@@ -3035,7 +3054,6 @@ declare const authClient: {
|
|
|
3035
3054
|
referrer?: string | undefined;
|
|
3036
3055
|
referrerPolicy?: ReferrerPolicy | undefined;
|
|
3037
3056
|
signal?: (AbortSignal | null) | undefined;
|
|
3038
|
-
window?: null | undefined;
|
|
3039
3057
|
onRetry?: ((response: _better_fetch_fetch.ResponseContext) => Promise<void> | void) | undefined;
|
|
3040
3058
|
hookOptions?: {
|
|
3041
3059
|
cloneResponse?: boolean;
|
|
@@ -3155,6 +3173,24 @@ declare const authClient: {
|
|
|
3155
3173
|
readonly FAILED_TO_UNLINK_LAST_ACCOUNT: "You can't unlink your last account";
|
|
3156
3174
|
readonly ACCOUNT_NOT_FOUND: "Account not found";
|
|
3157
3175
|
readonly USER_ALREADY_HAS_PASSWORD: "User already has a password. Provide that to delete the account.";
|
|
3176
|
+
readonly CROSS_SITE_NAVIGATION_LOGIN_BLOCKED: "Cross-site navigation login blocked. This request appears to be a CSRF attack.";
|
|
3177
|
+
readonly VERIFICATION_EMAIL_NOT_ENABLED: "Verification email isn't enabled";
|
|
3178
|
+
readonly EMAIL_ALREADY_VERIFIED: "Email is already verified";
|
|
3179
|
+
readonly EMAIL_MISMATCH: "Email mismatch";
|
|
3180
|
+
readonly SESSION_NOT_FRESH: "Session is not fresh";
|
|
3181
|
+
readonly LINKED_ACCOUNT_ALREADY_EXISTS: "Linked account already exists";
|
|
3182
|
+
readonly INVALID_ORIGIN: "Invalid origin";
|
|
3183
|
+
readonly INVALID_CALLBACK_URL: "Invalid callbackURL";
|
|
3184
|
+
readonly INVALID_REDIRECT_URL: "Invalid redirectURL";
|
|
3185
|
+
readonly INVALID_ERROR_CALLBACK_URL: "Invalid errorCallbackURL";
|
|
3186
|
+
readonly INVALID_NEW_USER_CALLBACK_URL: "Invalid newUserCallbackURL";
|
|
3187
|
+
readonly MISSING_OR_NULL_ORIGIN: "Missing or null Origin";
|
|
3188
|
+
readonly CALLBACK_URL_REQUIRED: "callbackURL is required";
|
|
3189
|
+
readonly FAILED_TO_CREATE_VERIFICATION: "Unable to create verification";
|
|
3190
|
+
readonly FIELD_NOT_ALLOWED: "Field not allowed to be set";
|
|
3191
|
+
readonly ASYNC_VALIDATION_NOT_SUPPORTED: "Async validation is not supported";
|
|
3192
|
+
readonly VALIDATION_ERROR: "Validation Error";
|
|
3193
|
+
readonly MISSING_FIELD: "Field is required";
|
|
3158
3194
|
};
|
|
3159
3195
|
};
|
|
3160
3196
|
|