@vite-hub/auth 0.0.4 → 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/README.md +443 -32
- package/dist/abilities-DfAnFYwG.d.ts +93 -0
- package/dist/abilities.d.ts +2 -0
- package/dist/abilities.js +43 -0
- package/dist/ability-error-CqgBrBfR.js +91 -0
- package/dist/ability-error-DcgChwCN.d.ts +34 -0
- package/dist/admin-claim-code-CDipqeAU.js +22 -0
- package/dist/agent.d.ts +23 -12
- package/dist/agent.js +30 -8
- package/dist/application-path-DuTpfGFj.js +62 -0
- package/dist/auth-instance-CR6b1W80.js +1168 -0
- package/dist/bun-sqlite.d.ts +8 -0
- package/dist/cli-ubYJpAL_.d.ts +163 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.js +108 -0
- package/dist/console-runtime-DTopBP-x.d.ts +71 -0
- package/dist/console-runtime-J9_Vx9pT.js +1166 -0
- package/dist/console-runtime.d.ts +3 -0
- package/dist/console-runtime.js +2 -0
- package/dist/console-types-CmmnKGMx.js +38 -0
- package/dist/console.d.ts +219 -0
- package/dist/console.js +15 -0
- package/dist/database-options-BRNef9oy.js +29 -0
- package/dist/database-schema-options-ENuRMduM.js +12 -0
- package/dist/database.d.ts +12 -0
- package/dist/database.js +45 -0
- package/dist/definition-CqQMcDEK.js +280 -0
- package/dist/error-diagnostics-C8XtVz0i.js +138 -0
- package/dist/events-ByzenEVj.js +314 -0
- package/dist/forward.d.ts +50 -0
- package/dist/forward.js +120 -0
- package/dist/host-declarations.d.ts +6 -1
- package/dist/index.d.ts +26 -5
- package/dist/index.js +3 -95
- package/dist/internal/server.d.ts +5 -0
- package/dist/internal/server.js +858 -0
- package/dist/invariant-D8_xBqmZ.js +22 -0
- package/dist/mcp.d.ts +187 -0
- package/dist/mcp.js +353 -0
- package/dist/members-D9lfaEO_.js +533 -0
- package/dist/nuxt-bridge-Cl988STZ.js +44 -0
- package/dist/nuxt.d.ts +36 -7
- package/dist/nuxt.js +116 -7
- package/dist/object-Da1zyPCR.js +11 -0
- package/dist/page-tools-shared-l4eyj53D.js +19 -0
- package/dist/presets-BGZi6Dfu.d.ts +25 -0
- package/dist/presets.d.ts +2 -0
- package/dist/presets.js +32 -0
- package/dist/request-z6DHHmrb.js +47 -0
- package/dist/runtime/console.d.ts +3 -0
- package/dist/runtime/console.js +4 -0
- package/dist/runtime/empty-abilities.d.ts +5 -0
- package/dist/runtime/empty-abilities.js +4 -0
- package/dist/runtime/empty-client.d.ts +6 -0
- package/dist/runtime/empty-client.js +5 -0
- package/dist/runtime/empty-definition.d.ts +1 -2
- package/dist/runtime/nuxt.d.ts +2 -3
- package/dist/runtime/nuxt.js +3 -2
- package/dist/runtime/server.d.ts +2 -0
- package/dist/runtime/server.js +77 -0
- package/dist/runtime/vue-nuxt.d.ts +4 -0
- package/dist/runtime/vue-nuxt.js +160 -0
- package/dist/runtime-state-ojQCzKOc.js +25 -0
- package/dist/schema.d.ts +137 -0
- package/dist/schema.js +147 -0
- package/dist/server-C0qnKN2W.d.ts +143 -0
- package/dist/server-bQGzVQ--.d.ts +41 -0
- package/dist/server.d.ts +3 -22
- package/dist/server.js +3 -2
- package/dist/session-cookies-BbH3UR2m.js +227 -0
- package/dist/set-cookie-C8NOhdRE.js +90 -0
- package/dist/shared-BwcdRGxD.js +12 -0
- package/dist/table-specs-8gq_FCaq.js +771 -0
- package/dist/table-specs-DbXyaXWs.d.ts +842 -0
- package/dist/test.d.ts +26 -0
- package/dist/test.js +25 -0
- package/dist/types-CNaeH2Fd.d.ts +569 -0
- package/dist/vite-CV400XXY.js +1556 -0
- package/dist/vite.d.ts +145 -18
- package/dist/vite.js +2 -2
- package/dist/vue.d.ts +343 -17
- package/dist/vue.js +640 -15
- package/package.json +156 -27
- package/dist/server-BZn8iQrB.js +0 -370
- package/dist/shared-QSYBHaMG.js +0 -12
- package/dist/types-jaRlW3D1.d.ts +0 -117
- package/dist/vite-Cmey8ODS.js +0 -1018
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { a as AuthTableField, c as authPluginSchemas, i as AuthSchemaPlugin, l as authTableSpecs, n as AuthCoreTableSpecs, o as AuthTableName, r as AuthSchemaOptions, s as AuthTableSpec, t as AuthCoreModel, u as resolveAuthTableSpecs } from "./table-specs-DbXyaXWs.js";
|
|
2
|
+
import { $Type, BuildColumns, HasDefault, IsPrimaryKey, NotNull } from "drizzle-orm";
|
|
3
|
+
import { PgBigInt53Builder, PgBooleanBuilder, PgBuildColumns, PgColumn, PgIntegerBuilder, PgJsonbBuilder, PgTableWithColumns, PgTextBuilder, PgTimestampBuilder } from "drizzle-orm/pg-core";
|
|
4
|
+
import { SQLiteBooleanBuilder, SQLiteColumn, SQLiteIntegerBuilder, SQLiteTableWithColumns, SQLiteTextBuilder, SQLiteTextJsonBuilder, SQLiteTimestampBuilder } from "drizzle-orm/sqlite-core";
|
|
5
|
+
//#region src/existing-tables.d.ts
|
|
6
|
+
interface AuthExistingColumn {
|
|
7
|
+
notNull: boolean;
|
|
8
|
+
/** The SQL text of the column default, such as `'member'` or `(cast(unixepoch('subsecond') * 1000 as integer))`. */
|
|
9
|
+
default?: string;
|
|
10
|
+
}
|
|
11
|
+
interface AuthExistingIndex {
|
|
12
|
+
name: string;
|
|
13
|
+
columns: readonly string[];
|
|
14
|
+
unique: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface AuthExistingForeignKey {
|
|
17
|
+
/** The name, when the schema named the foreign key. Drizzle Kit derives the others from the columns. */
|
|
18
|
+
name?: string;
|
|
19
|
+
columns: readonly string[];
|
|
20
|
+
tableTo: string;
|
|
21
|
+
columnsTo: readonly string[];
|
|
22
|
+
onDelete: string;
|
|
23
|
+
onUpdate: string;
|
|
24
|
+
}
|
|
25
|
+
interface AuthExistingUnique {
|
|
26
|
+
name?: string;
|
|
27
|
+
columns: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
/** One table of the snapshot, by SQL column name. */
|
|
30
|
+
interface AuthExistingTable {
|
|
31
|
+
columns: Readonly<Record<string, AuthExistingColumn>>;
|
|
32
|
+
indexes: readonly AuthExistingIndex[];
|
|
33
|
+
uniques: readonly AuthExistingUnique[];
|
|
34
|
+
foreignKeys: readonly AuthExistingForeignKey[];
|
|
35
|
+
}
|
|
36
|
+
/** The existing tables, by SQL table name. */
|
|
37
|
+
type AuthExistingTables = Readonly<Record<string, AuthExistingTable>>;
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/schema.d.ts
|
|
40
|
+
/** A Better Auth table in a SQLite Database (SQLite, libSQL, or Cloudflare D1), with untyped columns. */
|
|
41
|
+
export type AuthSqliteTable = SQLiteTableWithColumns<{
|
|
42
|
+
name: string;
|
|
43
|
+
schema: undefined;
|
|
44
|
+
columns: Record<string, SQLiteColumn>;
|
|
45
|
+
dialect: "sqlite";
|
|
46
|
+
isAlias: false;
|
|
47
|
+
}>;
|
|
48
|
+
/** A Better Auth table in a Postgres Database, with untyped columns. */
|
|
49
|
+
export type AuthPostgresTable = PgTableWithColumns<{
|
|
50
|
+
name: string;
|
|
51
|
+
schema: undefined;
|
|
52
|
+
columns: Record<string, PgColumn>;
|
|
53
|
+
dialect: "pg";
|
|
54
|
+
isAlias: false;
|
|
55
|
+
}>;
|
|
56
|
+
type FieldData<F> = F extends {
|
|
57
|
+
type: "boolean";
|
|
58
|
+
} ? boolean : F extends {
|
|
59
|
+
type: "date";
|
|
60
|
+
} ? Date : F extends {
|
|
61
|
+
type: "number";
|
|
62
|
+
} ? number : F extends {
|
|
63
|
+
type: "string";
|
|
64
|
+
} ? string : F extends {
|
|
65
|
+
type: "string[]";
|
|
66
|
+
} ? string[] : F extends {
|
|
67
|
+
type: "number[]";
|
|
68
|
+
} ? number[] : unknown;
|
|
69
|
+
type WithConstraints<TBuilder, F> = (F extends {
|
|
70
|
+
defaultValue: unknown;
|
|
71
|
+
} | {
|
|
72
|
+
onUpdate: true;
|
|
73
|
+
} ? HasDefault<TBuilder> : TBuilder) extends (infer TDefault) ? F extends {
|
|
74
|
+
required: true;
|
|
75
|
+
} ? NotNull<TDefault> : TDefault : never;
|
|
76
|
+
type SqliteBuilder<F> = F extends {
|
|
77
|
+
type: "boolean";
|
|
78
|
+
} ? SQLiteBooleanBuilder : F extends {
|
|
79
|
+
type: "date";
|
|
80
|
+
} ? SQLiteTimestampBuilder : F extends {
|
|
81
|
+
type: "number";
|
|
82
|
+
} ? SQLiteIntegerBuilder : F extends {
|
|
83
|
+
type: "string";
|
|
84
|
+
} ? SQLiteTextBuilder<[string, ...string[]]> : $Type<SQLiteTextJsonBuilder, FieldData<F>>;
|
|
85
|
+
type PostgresBuilder<F> = F extends {
|
|
86
|
+
type: "boolean";
|
|
87
|
+
} ? PgBooleanBuilder : F extends {
|
|
88
|
+
type: "date";
|
|
89
|
+
} ? PgTimestampBuilder : F extends {
|
|
90
|
+
type: "number";
|
|
91
|
+
} ? F extends {
|
|
92
|
+
bigint: true;
|
|
93
|
+
} ? PgBigInt53Builder : PgIntegerBuilder : F extends {
|
|
94
|
+
type: "string";
|
|
95
|
+
} ? PgTextBuilder : F extends {
|
|
96
|
+
type: "json";
|
|
97
|
+
} ? PgJsonbBuilder : $Type<PgTextBuilder, FieldData<F>>;
|
|
98
|
+
type SqliteColumns<TFields> = {
|
|
99
|
+
id: IsPrimaryKey<SQLiteTextBuilder<[string, ...string[]]>>;
|
|
100
|
+
} & { -readonly [K in keyof TFields]: WithConstraints<SqliteBuilder<TFields[K]>, TFields[K]>; };
|
|
101
|
+
type PostgresColumns<TFields> = {
|
|
102
|
+
id: IsPrimaryKey<PgTextBuilder>;
|
|
103
|
+
} & { -readonly [K in keyof TFields]: WithConstraints<PostgresBuilder<TFields[K]>, TFields[K]>; };
|
|
104
|
+
/** The Better Auth table `TModel` in a SQLite Database, with a typed column for each field. */
|
|
105
|
+
export type AuthSqliteCoreTable<TModel extends AuthTableName> = SQLiteTableWithColumns<{
|
|
106
|
+
name: string;
|
|
107
|
+
schema: undefined;
|
|
108
|
+
columns: BuildColumns<string, SqliteColumns<AuthCoreTableSpecs[TModel]["fields"]>, "sqlite">;
|
|
109
|
+
dialect: "sqlite";
|
|
110
|
+
isAlias: false;
|
|
111
|
+
}>;
|
|
112
|
+
/** The Better Auth table `TModel` in a Postgres Database, with a typed column for each field. */
|
|
113
|
+
export type AuthPostgresCoreTable<TModel extends AuthTableName> = PgTableWithColumns<{
|
|
114
|
+
name: string;
|
|
115
|
+
schema: undefined;
|
|
116
|
+
columns: PgBuildColumns<string, PostgresColumns<AuthCoreTableSpecs[TModel]["fields"]>>;
|
|
117
|
+
dialect: "pg";
|
|
118
|
+
isAlias: false;
|
|
119
|
+
}>;
|
|
120
|
+
/** The Better Auth tables for SQLite, libSQL, and Cloudflare D1. Auth adds them to the app Database. */
|
|
121
|
+
export type AuthSqliteSchema = { readonly [TModel in AuthTableName]: AuthSqliteCoreTable<TModel>; };
|
|
122
|
+
/** The Better Auth tables for Postgres. Auth adds them to the app Database. */
|
|
123
|
+
export type AuthPostgresSchema = { readonly [TModel in AuthTableName]: AuthPostgresCoreTable<TModel>; };
|
|
124
|
+
export declare const authSqliteSchema: AuthSqliteSchema;
|
|
125
|
+
export declare const authPostgresSchema: AuthPostgresSchema;
|
|
126
|
+
/**
|
|
127
|
+
* The Better Auth tables for SQLite, libSQL, and Cloudflare D1, with the plugins and additional fields of `options`. The
|
|
128
|
+
* Auth Vite plugin writes a module that calls it when the Auth Definition adds fields or imports a plugin of
|
|
129
|
+
* `AuthSchemaPlugin`, or when the Database has some of the tables already. `existing` holds those tables, read from the
|
|
130
|
+
* latest migration: each one keeps the column defaults, unique keys, and foreign keys that only a table rebuild could
|
|
131
|
+
* change, so the migration adds columns and indexes, and does not drop a table that other tables reference.
|
|
132
|
+
*/
|
|
133
|
+
export declare function createAuthSqliteSchema(options: AuthSchemaOptions, existing?: AuthExistingTables): AuthSqliteSchema & Readonly<Record<string, AuthSqliteTable>>;
|
|
134
|
+
/** The Better Auth tables for Postgres, with the plugins and additional fields of `options`. */
|
|
135
|
+
export declare function createAuthPostgresSchema(options: AuthSchemaOptions): AuthPostgresSchema & Readonly<Record<string, AuthPostgresTable>>;
|
|
136
|
+
//#endregion
|
|
137
|
+
export { type AuthCoreModel, type AuthCoreTableSpecs, type AuthSchemaOptions, type AuthSchemaPlugin, type AuthTableField, type AuthTableName, type AuthTableSpec, authPluginSchemas, authTableSpecs, resolveAuthTableSpecs };
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { i as resolveAuthTableSpecs, n as authSqlName, r as authTableSpecs, t as authPluginSchemas } from "./table-specs-8gq_FCaq.js";
|
|
2
|
+
import { sql } from "drizzle-orm";
|
|
3
|
+
import { bigint, boolean, foreignKey, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
|
|
4
|
+
import { foreignKey as foreignKey$1, index as index$1, integer as integer$1, sqliteTable, text as text$1, uniqueIndex as uniqueIndex$1 } from "drizzle-orm/sqlite-core";
|
|
5
|
+
//#region src/schema.ts
|
|
6
|
+
const sameColumns = (left, right) => left.length === right.length && left.every((column, index) => column === right[index]);
|
|
7
|
+
const foreignKeyAction = (action) => action.toLowerCase();
|
|
8
|
+
function buildTables(dialect, specs, existing) {
|
|
9
|
+
const tables = {};
|
|
10
|
+
const tableColumns = (model) => {
|
|
11
|
+
return tables[model];
|
|
12
|
+
};
|
|
13
|
+
const modelBySqlName = new Map(Object.keys(specs).map((model) => [authSqlName(model), model]));
|
|
14
|
+
for (const [model, spec] of Object.entries(specs)) {
|
|
15
|
+
const current = existing && Object.hasOwn(existing, authSqlName(model)) ? existing[authSqlName(model)] : void 0;
|
|
16
|
+
const columns = { id: dialect.id() };
|
|
17
|
+
const indexed = [];
|
|
18
|
+
const foreignKeys = [];
|
|
19
|
+
const indexName = (fields, unique, name) => current?.indexes.find((entry) => entry.unique === unique && sameColumns(entry.columns, fields.map(authSqlName)))?.name ?? name;
|
|
20
|
+
for (const [key, field] of Object.entries(spec.fields)) {
|
|
21
|
+
const name = authSqlName(key);
|
|
22
|
+
const column = current && Object.hasOwn(current.columns, name) ? current.columns[name] : void 0;
|
|
23
|
+
let builder = dialect.column(name, field);
|
|
24
|
+
if (column) {
|
|
25
|
+
if (column.default !== void 0) builder = builder.default(dialect.raw(column.default));
|
|
26
|
+
} else if (field.defaultValue !== void 0) builder = builder.default(field.defaultValue === "now" && field.type !== "string" ? field.type === "number" ? dialect.nowMs : dialect.now : field.defaultValue);
|
|
27
|
+
if (field.onUpdate) builder = builder.$onUpdate(() => /* @__PURE__ */ new Date());
|
|
28
|
+
if (column ? column.notNull : field.required && (!current || field.defaultValue !== void 0)) builder = builder.notNull();
|
|
29
|
+
if (field.unique) {
|
|
30
|
+
const constraint = current?.uniques.find((entry) => sameColumns(entry.columns, [name]));
|
|
31
|
+
if (!current || constraint) builder = builder.unique(constraint?.name);
|
|
32
|
+
else if (!field.index) indexed.push({
|
|
33
|
+
name: indexName([key], true, `${model}_${key}_uidx`),
|
|
34
|
+
unique: true,
|
|
35
|
+
fields: [key]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const reference = field.references;
|
|
39
|
+
if (reference) {
|
|
40
|
+
const foreignKey = current?.foreignKeys.find((entry) => sameColumns(entry.columns, [name]));
|
|
41
|
+
const sameTarget = foreignKey?.tableTo === authSqlName(reference.model) && sameColumns(foreignKey.columnsTo, [authSqlName(reference.field)]);
|
|
42
|
+
if (!current || foreignKey && !sameTarget) builder = builder.references(() => tableColumns(reference.model)[reference.field], { onDelete: reference.onDelete ?? "cascade" });
|
|
43
|
+
else if (foreignKey?.name) foreignKeys.push({
|
|
44
|
+
name: foreignKey.name,
|
|
45
|
+
fields: [key],
|
|
46
|
+
model: reference.model,
|
|
47
|
+
foreignFields: [reference.field],
|
|
48
|
+
onDelete: foreignKeyAction(foreignKey.onDelete),
|
|
49
|
+
onUpdate: foreignKeyAction(foreignKey.onUpdate)
|
|
50
|
+
});
|
|
51
|
+
else if (foreignKey) builder = builder.references(() => tableColumns(reference.model)[reference.field], {
|
|
52
|
+
onDelete: foreignKeyAction(foreignKey.onDelete),
|
|
53
|
+
onUpdate: foreignKeyAction(foreignKey.onUpdate)
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (field.index) indexed.push({
|
|
57
|
+
name: indexName([key], Boolean(field.unique), `${model}_${key}_${field.unique ? "uidx" : "idx"}`),
|
|
58
|
+
unique: Boolean(field.unique),
|
|
59
|
+
fields: [key]
|
|
60
|
+
});
|
|
61
|
+
columns[key] = builder;
|
|
62
|
+
}
|
|
63
|
+
for (const fields of spec.unique ?? []) indexed.unshift({
|
|
64
|
+
name: indexName(fields, true, `${model}_${fields.join("_")}_uidx`),
|
|
65
|
+
unique: true,
|
|
66
|
+
fields
|
|
67
|
+
});
|
|
68
|
+
const fieldOf = (column) => column === "id" ? "id" : Object.keys(spec.fields).find((key) => authSqlName(key) === column);
|
|
69
|
+
for (const index of current?.indexes ?? []) {
|
|
70
|
+
const fields = index.columns.map(fieldOf);
|
|
71
|
+
if (indexed.some((entry) => entry.name === index.name) || fields.some((field) => !field)) continue;
|
|
72
|
+
if (!(index.unique && fields.length === 1 && current?.uniques.some((entry) => sameColumns(entry.columns, index.columns)))) indexed.push({
|
|
73
|
+
name: index.name,
|
|
74
|
+
unique: index.unique,
|
|
75
|
+
fields
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
for (const foreignKey of current?.foreignKeys ?? []) {
|
|
79
|
+
const fields = foreignKey.columns.map(fieldOf);
|
|
80
|
+
const target = modelBySqlName.get(foreignKey.tableTo);
|
|
81
|
+
const targetSpec = target ? specs[target] : void 0;
|
|
82
|
+
const foreignFields = foreignKey.columnsTo.map((column) => column === "id" ? "id" : Object.keys(targetSpec?.fields ?? {}).find((key) => authSqlName(key) === column));
|
|
83
|
+
if (!target || fields.some((field) => !field) || foreignFields.some((field) => !field)) continue;
|
|
84
|
+
if (fields.length === 1 && spec.fields[fields[0]]?.references) continue;
|
|
85
|
+
foreignKeys.push({
|
|
86
|
+
name: foreignKey.name ?? `${authSqlName(model)}_${foreignKey.columns.join("_")}_${foreignKey.tableTo}_${foreignKey.columnsTo.join("_")}_fk`,
|
|
87
|
+
fields,
|
|
88
|
+
model: target,
|
|
89
|
+
foreignFields,
|
|
90
|
+
onDelete: foreignKeyAction(foreignKey.onDelete),
|
|
91
|
+
onUpdate: foreignKeyAction(foreignKey.onUpdate)
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
tables[model] = dialect.table(authSqlName(model), columns, (table) => [...indexed.map((entry) => dialect.index(entry.name, entry.unique, entry.fields.map((field) => table[field]))), ...foreignKeys.map((entry) => dialect.foreignKey(entry.name, entry.fields.map((field) => table[field]), entry.foreignFields.map((field) => tableColumns(entry.model)[field]), entry))]);
|
|
95
|
+
}
|
|
96
|
+
return tables;
|
|
97
|
+
}
|
|
98
|
+
const sqliteDialect = {
|
|
99
|
+
column(name, field) {
|
|
100
|
+
return field.type === "boolean" ? integer$1(name, { mode: "boolean" }) : field.type === "date" ? integer$1(name, { mode: "timestamp_ms" }) : field.type === "number" ? integer$1(name) : field.type === "string" ? text$1(name) : text$1(name, { mode: "json" });
|
|
101
|
+
},
|
|
102
|
+
id: () => text$1("id").primaryKey(),
|
|
103
|
+
index: (name, unique, columns) => (unique ? uniqueIndex$1(name) : index$1(name)).on(...columns),
|
|
104
|
+
foreignKey: (name, columns, foreignColumns, actions) => foreignKey$1({
|
|
105
|
+
name,
|
|
106
|
+
columns,
|
|
107
|
+
foreignColumns
|
|
108
|
+
}).onDelete(actions.onDelete).onUpdate(actions.onUpdate),
|
|
109
|
+
now: sql`(cast(unixepoch('subsecond') * 1000 as integer))`,
|
|
110
|
+
nowMs: sql`(cast(unixepoch('subsecond') * 1000 as integer))`,
|
|
111
|
+
raw: (sqlText) => sql.raw(sqlText),
|
|
112
|
+
table: (name, columns, extras) => sqliteTable(name, columns, (table) => extras(table))
|
|
113
|
+
};
|
|
114
|
+
const postgresDialect = {
|
|
115
|
+
column(name, field) {
|
|
116
|
+
return field.type === "boolean" ? boolean(name) : field.type === "date" ? timestamp(name) : field.type === "number" ? field.bigint ? bigint(name, { mode: "number" }) : integer(name) : field.type === "string" ? text(name) : field.type === "string[]" ? text(name).array() : field.type === "number[]" ? integer(name).array() : jsonb(name);
|
|
117
|
+
},
|
|
118
|
+
id: () => text("id").primaryKey(),
|
|
119
|
+
index: (name, unique, columns) => (unique ? uniqueIndex(name) : index(name)).on(...columns),
|
|
120
|
+
foreignKey: (name, columns, foreignColumns, actions) => foreignKey({
|
|
121
|
+
name,
|
|
122
|
+
columns,
|
|
123
|
+
foreignColumns
|
|
124
|
+
}).onDelete(actions.onDelete).onUpdate(actions.onUpdate),
|
|
125
|
+
now: sql`now()`,
|
|
126
|
+
nowMs: sql`(extract(epoch from now()) * 1000)::bigint`,
|
|
127
|
+
raw: (sqlText) => sql.raw(sqlText),
|
|
128
|
+
table: (name, columns, extras) => pgTable(name, columns, (table) => extras(table))
|
|
129
|
+
};
|
|
130
|
+
const authSqliteSchema = buildTables(sqliteDialect, authTableSpecs);
|
|
131
|
+
const authPostgresSchema = buildTables(postgresDialect, authTableSpecs);
|
|
132
|
+
/**
|
|
133
|
+
* The Better Auth tables for SQLite, libSQL, and Cloudflare D1, with the plugins and additional fields of `options`. The
|
|
134
|
+
* Auth Vite plugin writes a module that calls it when the Auth Definition adds fields or imports a plugin of
|
|
135
|
+
* `AuthSchemaPlugin`, or when the Database has some of the tables already. `existing` holds those tables, read from the
|
|
136
|
+
* latest migration: each one keeps the column defaults, unique keys, and foreign keys that only a table rebuild could
|
|
137
|
+
* change, so the migration adds columns and indexes, and does not drop a table that other tables reference.
|
|
138
|
+
*/
|
|
139
|
+
function createAuthSqliteSchema(options, existing) {
|
|
140
|
+
return buildTables(sqliteDialect, resolveAuthTableSpecs(options), existing);
|
|
141
|
+
}
|
|
142
|
+
/** The Better Auth tables for Postgres, with the plugins and additional fields of `options`. */
|
|
143
|
+
function createAuthPostgresSchema(options) {
|
|
144
|
+
return buildTables(postgresDialect, resolveAuthTableSpecs(options));
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
export { authPluginSchemas, authPostgresSchema, authSqliteSchema, authTableSpecs, createAuthPostgresSchema, createAuthSqliteSchema, resolveAuthTableSpecs };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { B as ResolvedAuthAccessRoute, C as AuthRequest, Ft as AuthEventStore, H as ViteHubAuth, I as AuthSignInConfiguration, Lt as AuthEventWindow, Nt as AuthEventPage, b as AuthFor, d as AuthAnonymousGuardedHandler, g as AuthDefinition, h as AuthBetterAuthRuntimeOptions, j as AuthRuntimeOptions, jt as AuthEventListInput, kt as AuthEventAggregates, nt as AuthConsoleHostOptions, p as AuthAuthorization, u as AuthAnonymousAuthorize, w as AuthRequestInput, x as AuthGuardedHandler, z as RegisteredAuth } from "./types-CNaeH2Fd.js";
|
|
2
|
+
import { i as AbilityName, n as AbilityAuthorization, t as AbilityArgs } from "./abilities-DfAnFYwG.js";
|
|
3
|
+
import { t as AuthConsole } from "./console-runtime-DTopBP-x.js";
|
|
4
|
+
import "./server-bQGzVQ--.js";
|
|
5
|
+
import "./ability-error-DcgChwCN.js";
|
|
6
|
+
import { AccessAuthorizeOption, Result, ViteHubContext } from "@vite-hub/runtime";
|
|
7
|
+
import { APIError } from "better-auth/api";
|
|
8
|
+
import { AuthContext, BetterAuthOptions, BetterAuthPlugin, User } from "better-auth";
|
|
9
|
+
//#region src/members.d.ts
|
|
10
|
+
/** Why `checkAuthMember()` did not let a user in. */
|
|
11
|
+
type AuthMemberErrorCode = "AUTH_NOT_MEMBER" | "AUTH_GITHUB_UNAVAILABLE";
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/auth-instance.d.ts
|
|
14
|
+
declare function createBetterAuthOptions(definition: AuthDefinition): AuthBetterAuthRuntimeOptions;
|
|
15
|
+
declare function getAuthForDefinition<TDefinition extends AuthDefinition>(definition: TDefinition): AuthFor<TDefinition>;
|
|
16
|
+
/**
|
|
17
|
+
* The Better Auth instance of the app's Auth Definition for a request that can differ from the event's own. Apps call
|
|
18
|
+
* `useAuth(event)`. The Console reads it through `@vite-hub/auth/runtime/console`.
|
|
19
|
+
*/
|
|
20
|
+
declare function authForRequest(request: Pick<Request, "headers" | "url">, event?: ViteHubContext, definition?: AuthDefinition): RegisteredAuth;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/internal/server.d.ts
|
|
23
|
+
/** Where Better Auth returns after one sign-in that a guard starts. */
|
|
24
|
+
type AuthSignInURLs = Pick<AuthSignInConfiguration, "callbackURL" | "errorCallbackURL">;
|
|
25
|
+
declare function createAuthRequestRuntimeOptions(definition: AuthDefinition, request: Pick<Request, "headers" | "url">, event?: ViteHubContext): AuthRuntimeOptions;
|
|
26
|
+
declare function createAuth(definition: AuthDefinition): ViteHubAuth;
|
|
27
|
+
declare function createAuthForRequest(definition: AuthDefinition, request: Pick<Request, "headers" | "url">, event?: ViteHubContext): ViteHubAuth;
|
|
28
|
+
declare function handleAuthRequest(definition: AuthDefinition, input: AuthRequestInput, event?: ViteHubContext): Promise<Response>;
|
|
29
|
+
/** Return a Web Request itself, or the request in the Standard Context of a request event. */
|
|
30
|
+
declare function toAuthRequest(input: AuthRequestInput): AuthRequest;
|
|
31
|
+
/** Create a handler whose optional host context supplies the peer address, never a client-sent header. */
|
|
32
|
+
declare function createAuthHandler(definition: AuthDefinition): (request: Request, host?: {
|
|
33
|
+
clientAddress?: string;
|
|
34
|
+
}) => Promise<Response>;
|
|
35
|
+
declare function getAuth(): RegisteredAuth;
|
|
36
|
+
/**
|
|
37
|
+
* Checks `VITEHUB_MEMBERS` for a user, with the rules of sign-in, for code that has a user id but no session, such as
|
|
38
|
+
* an upload ticket or a signed link. Returns `[undefined, undefined]` when the list lets the user in, or when
|
|
39
|
+
* `VITEHUB_MEMBERS` is not set. Returns `AUTH_NOT_MEMBER` for a refused or unknown user, and `AUTH_GITHUB_UNAVAILABLE`
|
|
40
|
+
* when GitHub cannot confirm an organization membership. Pass the request event so that Auth reads the variable from
|
|
41
|
+
* the request's Cloudflare bindings.
|
|
42
|
+
*/
|
|
43
|
+
declare function checkAuthMember(userId: string, event?: AuthRequestInput): Promise<Result<void, AuthMemberErrorCode>>;
|
|
44
|
+
/**
|
|
45
|
+
* Return the Better Auth instance of the app's Auth Definition for a request event or a Web `Request`.
|
|
46
|
+
* The generated types give it the endpoints and fields of the Definition's plugins, so `useAuth(event).api.banUser`
|
|
47
|
+
* type-checks when `server/auth.ts` uses `admin()`.
|
|
48
|
+
*/
|
|
49
|
+
declare function useAuth(event: AuthRequestInput): RegisteredAuth;
|
|
50
|
+
declare function assertAuthOrigin(request: Pick<Request, "headers" | "url">, event?: ViteHubContext): Promise<RegisteredAuth>;
|
|
51
|
+
declare function handleAuth(input: AuthRequestInput): Promise<Response>;
|
|
52
|
+
/** The options of `signOut()`. */
|
|
53
|
+
interface AuthSignOutOptions {
|
|
54
|
+
/** The app path to open after the sign-out, such as `/login`. Without it, `signOut()` answers `204`. */
|
|
55
|
+
redirectTo?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Signs out the session of a request event or a Web `Request` from server code, such as a GET `/logout` route.
|
|
59
|
+
* Better Auth deletes the session, and the response clears its cookies. Returns a `303` redirect to `redirectTo`, or
|
|
60
|
+
* `204` without it. Provider logout uses a `303` to the provider first, with `redirectTo` as its callback.
|
|
61
|
+
* A request without a session gets the same answer. Throws `AUTH_SIGN_OUT_REDIRECT_INVALID` when
|
|
62
|
+
* `redirectTo` is not a path of the app.
|
|
63
|
+
*/
|
|
64
|
+
declare function signOut(input: AuthRequestInput, options?: AuthSignOutOptions): Promise<Response>;
|
|
65
|
+
/**
|
|
66
|
+
* Like `withAuthorization()`, but a signed-out caller also reaches `authorize`, with `session` and `user` set to `null`.
|
|
67
|
+
* Use it for resources that a signed-out caller can open, such as files shared by public link.
|
|
68
|
+
* `false` returns `401` for a signed-out caller and `403` for a signed-in one. It never redirects to sign-in.
|
|
69
|
+
*/
|
|
70
|
+
declare function withAnonymousAuthorization<TInput extends AuthRequestInput, TResult>(authorize: AuthAnonymousAuthorize<TInput & ViteHubContext>, handler: AuthAnonymousGuardedHandler<TInput, TResult>, definition?: AuthDefinition): (input: TInput) => Promise<TResult | Response>;
|
|
71
|
+
/**
|
|
72
|
+
* Wraps a server handler so it runs only with a signed-in Auth Session.
|
|
73
|
+
* The handler receives the checked `authorization`. Otherwise the wrapper returns `401`, or starts `access.signIn` for HTML requests.
|
|
74
|
+
*/
|
|
75
|
+
declare function withAuth<TInput extends AuthRequestInput, TResult>(handler: AuthGuardedHandler<TInput, TResult>, definition?: AuthDefinition): (input: TInput) => Promise<TResult | Response>;
|
|
76
|
+
/**
|
|
77
|
+
* Wraps a resource handler, such as a Blob serve route or a Collection, so it runs only after `authorize` accepts the request.
|
|
78
|
+
* Returns `401` without a session, `403` when `authorize` returns `false`, and a custom `Response` as-is.
|
|
79
|
+
* It never redirects to sign-in, so image and fetch requests receive a status code.
|
|
80
|
+
*/
|
|
81
|
+
declare function withAuthorization<TInput extends AuthRequestInput, TResult>(authorize: AccessAuthorizeOption<TInput & ViteHubContext>, handler: AuthGuardedHandler<TInput, TResult>, definition?: AuthDefinition): (input: TInput) => Promise<TResult | Response>;
|
|
82
|
+
/**
|
|
83
|
+
* Return the checked request, Session, and user of a signed-in caller, or throw an `HTTPError`.
|
|
84
|
+
* It rejects like `withAuth()`: `401`, or the `access.signIn` redirect for an HTML request.
|
|
85
|
+
*
|
|
86
|
+
* ```ts [server/api/profile.get.ts]
|
|
87
|
+
* export default defineHandler(async (event) => {
|
|
88
|
+
* const { user } = await requireAuth(event)
|
|
89
|
+
* return { id: user.id }
|
|
90
|
+
* })
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
declare function requireAuth(event: AuthRequestInput, definition?: AuthDefinition): Promise<AuthAuthorization>;
|
|
94
|
+
/**
|
|
95
|
+
* Return the checked request, Session, and user after `authorize` accepts the request, or throw an `HTTPError`.
|
|
96
|
+
* It rejects like `withAuthorization()`: `401` without a session, `403` when `authorize` returns `false`, or the
|
|
97
|
+
* status and headers of the callback's `Response`. It never redirects to sign-in.
|
|
98
|
+
*/
|
|
99
|
+
declare function requireAuthorization<TInput extends AuthRequestInput>(event: TInput, authorize: AccessAuthorizeOption<TInput & ViteHubContext>, definition?: AuthDefinition): Promise<AuthAuthorization>;
|
|
100
|
+
/**
|
|
101
|
+
* Checks a rule from `shared/abilities.ts` for the caller of a request. Returns the checked request, session, and user.
|
|
102
|
+
* Throws an `AbilityError` when the rule refuses: `401` for a signed-out caller, else `403` or the status of `deny()`.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* const post = await getPost(id)
|
|
106
|
+
* const { user } = await requireAbility(event, "posts.edit", post)
|
|
107
|
+
*/
|
|
108
|
+
declare function requireAbility<const Name extends AbilityName>(event: AuthRequestInput, name: Name, ...args: AbilityArgs<Name>): Promise<AbilityAuthorization<Name>>;
|
|
109
|
+
/**
|
|
110
|
+
* Whether a rule from `shared/abilities.ts` allows the caller of a request.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* const editable = await can(event, "posts.edit", post)
|
|
114
|
+
*/
|
|
115
|
+
declare function can<const Name extends AbilityName>(event: AuthRequestInput, name: Name, ...args: AbilityArgs<Name>): Promise<boolean>;
|
|
116
|
+
/** Bind discovered access routes to a Web Request or host request handler. */
|
|
117
|
+
declare function createAuthAccessHandler(routes: readonly ResolvedAuthAccessRoute[], definition?: AuthDefinition, publicRoutes?: readonly string[]): (input: AuthRequestInput) => Promise<Response | undefined>;
|
|
118
|
+
declare function requireAuthAccessRoutes(input: AuthRequestInput, routeIndexes: number[], definition?: AuthDefinition, requiredAuthorizeRouteIndexes?: number[], options?: {
|
|
119
|
+
redirectToSignIn?: boolean;
|
|
120
|
+
/** Where Better Auth returns after this sign-in, replacing `access.signIn.callbackURL` and `errorCallbackURL`. */
|
|
121
|
+
signIn?: AuthSignInURLs;
|
|
122
|
+
/** Reuse successful checks of these exact rules and Definition on this request, including in app Auth middleware. */
|
|
123
|
+
reuse?: boolean;
|
|
124
|
+
}): Promise<Response | undefined>;
|
|
125
|
+
/**
|
|
126
|
+
* The Auth route that ViteHub mounts at `/api/auth/**`, as a Fetchable. It reads the client address and the
|
|
127
|
+
* Cloudflare bindings from the Standard Context of the Request.
|
|
128
|
+
*/
|
|
129
|
+
declare const authRoute: {
|
|
130
|
+
fetch(request: Request): Promise<Response>;
|
|
131
|
+
};
|
|
132
|
+
declare const auth: RegisteredAuth;
|
|
133
|
+
/** Read the configured log from server code. Apply access checks before returning it to a caller. */
|
|
134
|
+
declare function getAuthEvents(definition?: AuthDefinition, request?: Pick<Request, "headers" | "url">): AuthEventStore | undefined;
|
|
135
|
+
declare function listAuthEvents(input?: AuthEventListInput, definition?: AuthDefinition): Promise<AuthEventPage>;
|
|
136
|
+
declare function aggregateAuthEvents(window: AuthEventWindow, definition?: AuthDefinition): Promise<AuthEventAggregates>;
|
|
137
|
+
/**
|
|
138
|
+
* Resolve the primary Definition once, with the same request context for the provider and Console policy.
|
|
139
|
+
* `host.impersonation` lets the Console start impersonation. It is off by default.
|
|
140
|
+
*/
|
|
141
|
+
declare function getAuthConsoleForRequest(request: Request, event?: ViteHubContext, host?: AuthConsoleHostOptions): AuthConsole;
|
|
142
|
+
//#endregion
|
|
143
|
+
export { createBetterAuthOptions as A, signOut as C, withAuth as D, withAnonymousAuthorization as E, AuthMemberErrorCode as M, withAuthorization as O, requireAuthorization as S, useAuth as T, handleAuthRequest as _, authRoute as a, requireAuth as b, createAuth as c, createAuthHandler as d, createAuthRequestRuntimeOptions as f, handleAuth as g, getAuthEvents as h, auth as i, getAuthForDefinition as j, authForRequest as k, createAuthAccessHandler as l, getAuthConsoleForRequest as m, aggregateAuthEvents as n, can as o, getAuth as p, assertAuthOrigin as r, checkAuthMember as s, AuthSignOutOptions as t, createAuthForRequest as u, listAuthEvents as v, toAuthRequest as w, requireAuthAccessRoutes as x, requireAbility as y };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { B as ResolvedAuthAccessRoute, g as AuthDefinition, p as AuthAuthorization, w as AuthRequestInput } from "./types-CNaeH2Fd.js";
|
|
2
|
+
import { ViteHubContext } from "@vite-hub/runtime";
|
|
3
|
+
//#region src/runtime-state.d.ts
|
|
4
|
+
type AuthRuntimeEnvResolver = (event?: ViteHubContext) => Record<string, unknown>;
|
|
5
|
+
type AuthAccessIdentityResolver = (request: Request, event: AuthRequestInput, hasSession: boolean) => Promise<AuthAuthorization["user"] | Response | undefined>;
|
|
6
|
+
declare function resetAuth(): void;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/runtime/server.d.ts
|
|
9
|
+
declare function setAuthRuntimeEnvResolver(resolver: AuthRuntimeEnvResolver | undefined, definition?: AuthDefinition): void;
|
|
10
|
+
/**
|
|
11
|
+
* Let a trusted server integration authenticate one exact mounted path without a browser session.
|
|
12
|
+
* Resolved users still pass every matching Auth access route's authorize callback, with an empty session.
|
|
13
|
+
*/
|
|
14
|
+
declare function setAuthAccessIdentityResolver(path: string, resolver: AuthAccessIdentityResolver | undefined): void;
|
|
15
|
+
/**
|
|
16
|
+
* The Nitro route `meta` of a handler that checks its own access, such as the ViteHub Console route. The access routes
|
|
17
|
+
* leave a request to the handler that Nitro routed it to when that handler has this meta, whatever its path and method.
|
|
18
|
+
* The exception follows the dispatch, so an app route file on the same path keeps the access routes.
|
|
19
|
+
*/
|
|
20
|
+
declare const authAccessHandlerMeta: Readonly<{
|
|
21
|
+
vitehubAuthAccess: "handler";
|
|
22
|
+
}>;
|
|
23
|
+
interface AuthAccessRouteMatch {
|
|
24
|
+
index: number;
|
|
25
|
+
authorize: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Return a function that lists the access routes that match a request, in Definition order. A request to a path of
|
|
29
|
+
* `publicRoutes` matches no access route.
|
|
30
|
+
*/
|
|
31
|
+
declare function createAuthAccessRouteMatcher(routes: readonly ResolvedAuthAccessRoute[], publicRoutes?: readonly string[]): (input: AuthRequestInput) => AuthAccessRouteMatch[];
|
|
32
|
+
type AuthAccessHandler = (input: AuthRequestInput) => Promise<Response | undefined>;
|
|
33
|
+
/**
|
|
34
|
+
* The access middleware of generated hosts. A request that no access route matches returns without loading `load()`,
|
|
35
|
+
* so the server starts without Better Auth.
|
|
36
|
+
*/
|
|
37
|
+
declare function createLazyAuthAccessHandler(routes: readonly ResolvedAuthAccessRoute[], load: () => Promise<{
|
|
38
|
+
createAuthAccessHandler: (routes: readonly ResolvedAuthAccessRoute[], definition?: undefined, publicRoutes?: readonly string[]) => AuthAccessHandler;
|
|
39
|
+
}>, publicRoutes?: readonly string[]): AuthAccessHandler;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { setAuthAccessIdentityResolver as a, createLazyAuthAccessHandler as i, authAccessHandlerMeta as n, setAuthRuntimeEnvResolver as o, createAuthAccessRouteMatcher as r, resetAuth as s, AuthAccessRouteMatch as t };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
/// <reference path="./host-declarations.d.ts" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type AuthRuntimeEnvResolver = (event?: unknown) => Record<string, unknown>;
|
|
6
|
-
declare function setAuthRuntimeEnvResolver(resolver: AuthRuntimeEnvResolver | undefined): void;
|
|
7
|
-
declare function createAuthRequestRuntimeOptions(definition: AuthDefinition, request: Pick<Request, "headers" | "url">, runtimeOptions?: AuthRuntimeOptions, event?: unknown): AuthRuntimeOptions;
|
|
8
|
-
declare function createBetterAuthOptions(definition: AuthDefinition, runtimeOptions?: AuthRuntimeOptions): AuthBetterAuthRuntimeOptions;
|
|
9
|
-
declare function createAuth(definition: AuthDefinition, runtimeOptions?: AuthRuntimeOptions): ViteHubAuth;
|
|
10
|
-
declare function createAuthForRequest(definition: AuthDefinition, request: Pick<Request, "headers" | "url">, runtimeOptions?: AuthRuntimeOptions, event?: unknown): ViteHubAuth;
|
|
11
|
-
declare function handleAuthRequest(definition: AuthDefinition, request: AuthRequest, runtimeOptions?: AuthRuntimeOptions, event?: unknown): Promise<Response>;
|
|
12
|
-
declare function createAuthHandler(definition: AuthDefinition, runtimeOptions?: AuthRuntimeOptions): ViteHubAuth["handler"];
|
|
13
|
-
declare function resetAuth(): void;
|
|
14
|
-
declare function getAuthForDefinition(definition: AuthDefinition, runtimeOptions?: AuthRuntimeOptions): ViteHubAuth;
|
|
15
|
-
declare function getAuth(runtimeOptions?: AuthRuntimeOptions): ViteHubAuth;
|
|
16
|
-
declare function getAuthForRequest(request: Pick<Request, "headers" | "url">, runtimeOptions?: AuthRuntimeOptions, event?: unknown): ViteHubAuth;
|
|
17
|
-
declare function assertAuthOrigin(request: Pick<Request, "headers" | "url">, event?: unknown): Promise<ViteHubAuth>;
|
|
18
|
-
declare function handleAuth(input: AuthRequestInput, runtimeOptions?: AuthRuntimeOptions): Promise<Response>;
|
|
19
|
-
declare function requireAuth(input: AuthRequestInput, definition?: AuthDefinition): Promise<Response | undefined>;
|
|
20
|
-
declare function requireAuthAccessRoutes(input: AuthRequestInput, routeIndexes: number[], definition?: AuthDefinition, requiredAuthorizeRouteIndexes?: number[]): Promise<Response | undefined>;
|
|
21
|
-
declare const auth: ViteHubAuth;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { assertAuthOrigin, auth, createAuth, createAuthForRequest, createAuthHandler, createAuthRequestRuntimeOptions, createBetterAuthOptions, handleAuth as default, handleAuth, getAuth, getAuthForDefinition, getAuthForRequest, handleAuthRequest, requireAuth, requireAuthAccessRoutes, resetAuth, setAuthRuntimeEnvResolver };
|
|
2
|
+
import { C as signOut, D as withAuth, E as withAnonymousAuthorization, M as AuthMemberErrorCode, O as withAuthorization, S as requireAuthorization, T as useAuth, a as authRoute, b as requireAuth, d as createAuthHandler, g as handleAuth, h as getAuthEvents, i as auth, m as getAuthConsoleForRequest, n as aggregateAuthEvents, o as can, p as getAuth, s as checkAuthMember, v as listAuthEvents, y as requireAbility } from "./server-C0qnKN2W.js";
|
|
3
|
+
import { n as AbilityErrorData, t as AbilityError } from "./ability-error-DcgChwCN.js";
|
|
4
|
+
export { AbilityError, type AbilityErrorData, type AuthMemberErrorCode, aggregateAuthEvents, auth, can, checkAuthMember, createAuthHandler, authRoute as default, getAuth, getAuthConsoleForRequest, getAuthEvents, handleAuth, listAuthEvents, requireAbility, requireAuth, requireAuthorization, signOut, useAuth, withAnonymousAuthorization, withAuth, withAuthorization };
|
package/dist/server.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { t as AbilityError } from "./ability-error-CqgBrBfR.js";
|
|
2
|
+
import authRoute, { aggregateAuthEvents, auth, can, checkAuthMember, createAuthHandler, getAuth, getAuthConsoleForRequest, getAuthEvents, handleAuth, listAuthEvents, requireAbility, requireAuth, requireAuthorization, signOut, useAuth, withAnonymousAuthorization, withAuth, withAuthorization } from "./internal/server.js";
|
|
3
|
+
export { AbilityError, aggregateAuthEvents, auth, can, checkAuthMember, createAuthHandler, authRoute as default, getAuth, getAuthConsoleForRequest, getAuthEvents, handleAuth, listAuthEvents, requireAbility, requireAuth, requireAuthorization, signOut, useAuth, withAnonymousAuthorization, withAuth, withAuthorization };
|