faire-auth 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{access-Crt-IJ2P.cjs → access-BZ7-AbTM.cjs} +1 -1
- package/dist/{adapter-factory-DT-_2aHJ.cjs → adapter-factory-D1I7joki.cjs} +2 -2
- package/dist/adapters/drizzle-adapter/index.cjs +5 -5
- package/dist/adapters/drizzle-adapter/index.d.cts +1 -1
- package/dist/adapters/drizzle-adapter/index.d.mts +2 -2
- package/dist/adapters/drizzle-adapter/index.mjs +3 -3
- package/dist/adapters/index.cjs +4 -4
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.mts +2 -2
- package/dist/adapters/index.mjs +3 -3
- package/dist/adapters/kysely-adapter/index.cjs +5 -5
- package/dist/adapters/kysely-adapter/index.d.cts +1 -1
- package/dist/adapters/kysely-adapter/index.d.mts +2 -2
- package/dist/adapters/kysely-adapter/index.mjs +4 -4
- package/dist/adapters/memory-adapter/index.cjs +5 -5
- package/dist/adapters/memory-adapter/index.d.cts +1 -1
- package/dist/adapters/memory-adapter/index.d.mts +2 -2
- package/dist/adapters/memory-adapter/index.mjs +4 -4
- package/dist/adapters/mongodb-adapter/index.cjs +294 -6
- package/dist/adapters/mongodb-adapter/index.d.cts +34 -2
- package/dist/adapters/mongodb-adapter/index.d.mts +35 -3
- package/dist/adapters/mongodb-adapter/index.mjs +291 -4
- package/dist/adapters/prisma-adapter/index.cjs +5 -5
- package/dist/adapters/prisma-adapter/index.d.cts +1 -1
- package/dist/adapters/prisma-adapter/index.d.mts +2 -2
- package/dist/adapters/prisma-adapter/index.mjs +3 -3
- package/dist/adapters/test.cjs +3 -3
- package/dist/adapters/test.d.cts +1 -1
- package/dist/adapters/test.d.mts +2 -2
- package/dist/adapters/test.mjs +2 -2
- package/dist/api/index.cjs +15 -15
- package/dist/api/index.d.cts +1 -1
- package/dist/api/index.d.mts +2 -2
- package/dist/api/index.mjs +8 -8
- package/dist/api/middleware/index.cjs +8 -8
- package/dist/api/middleware/index.d.cts +3 -3
- package/dist/api/middleware/index.d.mts +4 -4
- package/dist/api/middleware/index.mjs +3 -3
- package/dist/{api-_B7qO28y.mjs → api-B4RDwBty.mjs} +7 -7
- package/dist/{api-Bm89BLgN.cjs → api-CaRC1Gio.cjs} +12 -12
- package/dist/{bearer-CHeREcGT.cjs → bearer-DDzrp5M7.cjs} +2 -2
- package/dist/{bearer-0SeEmaS4.mjs → bearer-WZcs7gxL.mjs} +1 -1
- package/dist/{bun-sqlite-dialect-wuaC2-gh.cjs → bun-sqlite-dialect-DPgTzc0w.cjs} +1 -1
- package/dist/{chunk-Ceigfy4P.mjs → chunk-BFnQceUY.mjs} +1 -13
- package/dist/{chunk-oakRccI5.cjs → chunk-fPmz2rbM.cjs} +0 -9
- package/dist/client/index.cjs +26 -7
- package/dist/client/index.d.cts +27 -4
- package/dist/client/index.d.mts +28 -5
- package/dist/client/index.mjs +25 -6
- package/dist/client/lynx/index.cjs +5 -5
- package/dist/client/lynx/index.d.cts +15 -15
- package/dist/client/lynx/index.d.mts +27 -27
- package/dist/client/lynx/index.mjs +3 -3
- package/dist/client/plugins/index.d.cts +1 -1
- package/dist/client/plugins/index.d.mts +2 -2
- package/dist/client/react/index.cjs +5 -5
- package/dist/client/react/index.d.cts +26 -26
- package/dist/client/react/index.d.mts +16 -16
- package/dist/client/react/index.mjs +3 -3
- package/dist/client/solid/index.cjs +5 -5
- package/dist/client/solid/index.d.cts +16 -16
- package/dist/client/solid/index.d.mts +17 -17
- package/dist/client/solid/index.mjs +3 -3
- package/dist/client/svelte/index.cjs +4 -4
- package/dist/client/svelte/index.d.cts +11 -11
- package/dist/client/svelte/index.d.mts +16 -16
- package/dist/client/svelte/index.mjs +3 -3
- package/dist/client/vue/index.cjs +5 -5
- package/dist/client/vue/index.d.cts +27 -27
- package/dist/client/vue/index.d.mts +28 -28
- package/dist/client/vue/index.mjs +3 -3
- package/dist/{cookies-B5xeA6i8.cjs → cookies-BTl72THv.cjs} +3 -3
- package/dist/{cookies-Ch1JfQIz.mjs → cookies-BTs1o992.mjs} +2 -2
- package/dist/crypto/index.cjs +1 -1
- package/dist/crypto/index.d.cts +2 -2
- package/dist/crypto/index.d.mts +3 -3
- package/dist/crypto/index.mjs +1 -1
- package/dist/{crypto-CyQRFtkq.mjs → crypto-DH2Aa7jN.mjs} +1 -1
- package/dist/{crypto-CcTxYH82.cjs → crypto-DpSCnrTp.cjs} +1 -1
- package/dist/db/index.cjs +10 -10
- package/dist/db/index.d.cts +1 -1
- package/dist/db/index.d.mts +2 -2
- package/dist/db/index.mjs +6 -6
- package/dist/{db-xiJtoDgz.mjs → db-4tUsQJXd.mjs} +3 -3
- package/dist/{db-BTKyYu-_.cjs → db-ChMbb_U-.cjs} +8 -8
- package/dist/{email-verification-CWhj2qfb.mjs → email-verification-C_lBu_JY.mjs} +3 -3
- package/dist/{email-verification-C-AsfJsb.cjs → email-verification-DI_0H4JC.cjs} +5 -5
- package/dist/{hono-Cdukwu5K.cjs → hono-C14rpOEa.cjs} +1 -1
- package/dist/{hono-Covz10jU.mjs → hono-CO-zsqI-.mjs} +2 -2
- package/dist/{hono-BEq1NYVX.cjs → hono-DnW5crl1.cjs} +4 -4
- package/dist/{index-BVHscLQl.d.cts → index-4PEF72Mq.d.cts} +20 -20
- package/dist/{index-B-WeOMzg.d.cts → index-BCzB3uDD.d.cts} +833 -833
- package/dist/{index-B09P9p5_.d.cts → index-Bw8dyZTc.d.cts} +6 -6
- package/dist/{index-Qu-iJGNr.d.mts → index-C0b8eC8h.d.mts} +16 -16
- package/dist/{index-jlessPI0.d.mts → index-CrmLTEj8.d.mts} +382 -382
- package/dist/index-Dfgobqa-.d.mts +33 -0
- package/dist/index.cjs +721 -27
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +711 -16
- package/dist/integrations/next-js.cjs +3 -3
- package/dist/integrations/next-js.d.cts +5 -5
- package/dist/integrations/next-js.d.mts +6 -6
- package/dist/integrations/next-js.mjs +2 -2
- package/dist/integrations/node.d.cts +1 -1
- package/dist/integrations/node.d.mts +2 -2
- package/dist/integrations/react-start.cjs +3 -3
- package/dist/integrations/react-start.d.cts +5 -5
- package/dist/integrations/react-start.d.mts +5 -5
- package/dist/integrations/react-start.mjs +2 -2
- package/dist/integrations/svelte-kit.cjs +3 -3
- package/dist/integrations/svelte-kit.d.cts +5 -5
- package/dist/integrations/svelte-kit.d.mts +6 -6
- package/dist/integrations/svelte-kit.mjs +2 -2
- package/dist/{ip-B5SwXaMB.cjs → ip-C17Qdq-G.cjs} +2 -2
- package/dist/{json-CcJ2HjGo.cjs → json--tl7Grvs.cjs} +1 -1
- package/dist/{kysely-adapter-DRuoT_X8.mjs → kysely-adapter-CtIdoHa8.mjs} +3 -3
- package/dist/{kysely-adapter-Bxi7sPdG.cjs → kysely-adapter-QZTx077T.cjs} +4 -4
- package/dist/{logged-DQK3C64b.cjs → logged-Dv3st5qc.cjs} +1 -1
- package/dist/{memory-adapter-BlnDIAAX.cjs → memory-adapter-17RZd5df.cjs} +2 -2
- package/dist/{memory-adapter-Db3tsJTn.mjs → memory-adapter-Dp4XdCZK.mjs} +1 -1
- package/dist/{node-sqlite-dialect-mJWC8LWQ.cjs → node-sqlite-dialect-DP11CB0y.cjs} +1 -1
- package/dist/oauth2/index.cjs +11 -11
- package/dist/oauth2/index.d.cts +1 -1
- package/dist/oauth2/index.d.mts +2 -2
- package/dist/oauth2/index.mjs +6 -6
- package/dist/{oauth2-BLeOEi7Y.cjs → oauth2-5RL4cVNS.cjs} +3 -3
- package/dist/{oauth2-B8M0lW9l.mjs → oauth2-C56wz-n9.mjs} +2 -2
- package/dist/{origin-check-id9lTnqZ.cjs → origin-check-DjLTuZQ8.cjs} +2 -2
- package/dist/{passkey-B6N20LSS.cjs → passkey-BTT-v5c-.cjs} +4 -4
- package/dist/{passkey-DJsR_GX3.mjs → passkey-CzY_W2us.mjs} +2 -2
- package/dist/plugins/access/index.cjs +1 -1
- package/dist/plugins/access/index.d.cts +1 -1
- package/dist/plugins/access/index.d.mts +1 -1
- package/dist/plugins/access/index.mjs +1 -1
- package/dist/plugins/bearer/index.cjs +4 -4
- package/dist/plugins/bearer/index.d.cts +2 -2
- package/dist/plugins/bearer/index.d.mts +3 -3
- package/dist/plugins/bearer/index.mjs +3 -3
- package/dist/plugins/index.cjs +5215 -31
- package/dist/plugins/index.d.cts +351 -351
- package/dist/plugins/index.d.mts +268 -268
- package/dist/plugins/index.mjs +5202 -19
- package/dist/plugins/passkey/index.cjs +10 -10
- package/dist/plugins/passkey/index.d.cts +2 -2
- package/dist/plugins/passkey/index.d.mts +3 -3
- package/dist/plugins/passkey/index.mjs +5 -5
- package/dist/{schema-D-qjygfE.cjs → schema-CirKflVs.cjs} +2 -2
- package/dist/{session-rH8ougDl.mjs → session-CM3rmOYF.mjs} +1 -1
- package/dist/{session-De9POJTW.cjs → session-Cwrj4GfV.cjs} +5 -5
- package/dist/social-providers/index.cjs +1 -1
- package/dist/social-providers/index.d.cts +1 -1
- package/dist/social-providers/index.d.mts +1 -1
- package/dist/social-providers/index.mjs +1 -1
- package/dist/{social-providers-DoYJhBe3.mjs → social-providers-B8RK5yqI.mjs} +1 -1
- package/dist/{social-providers-DcFNUT0S.cjs → social-providers-BmFOIIPk.cjs} +1 -1
- package/dist/{state-CqJfCIl9.mjs → state-CQghgH9I.mjs} +1 -1
- package/dist/{state--f7fwIGh.cjs → state-CvSihlVT.cjs} +2 -2
- package/dist/test-utils/bun-sqlite-dialect-BSWhhKNs.mjs +155 -0
- package/dist/test-utils/bun-sqlite-dialect-BZBvHchL.cjs +156 -0
- package/dist/test-utils/index.cjs +8927 -482
- package/dist/test-utils/index.d.cts +8395 -337
- package/dist/test-utils/index.d.mts +8394 -334
- package/dist/test-utils/index.mjs +8712 -265
- package/dist/test-utils/node-sqlite-dialect-BgJqjBOu.cjs +156 -0
- package/dist/test-utils/node-sqlite-dialect-DAQXiobH.mjs +155 -0
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.mts +2 -2
- package/dist/{url-D2yvKaM7.cjs → url-Ce7CVaQD.cjs} +1 -1
- package/dist/utils/cookies.cjs +4 -4
- package/dist/utils/cookies.d.cts +1 -1
- package/dist/utils/cookies.d.mts +2 -2
- package/dist/utils/cookies.mjs +2 -2
- package/package.json +2 -2
- package/dist/auth-Bo9PDt5j.cjs +0 -739
- package/dist/auth-Ds4AG4h4.mjs +0 -709
- package/dist/index-C2-2QDyS.d.cts +0 -35
- package/dist/index-CWAqWfoZ.d.cts +0 -27
- package/dist/index-CYSShrFx.d.mts +0 -27
- package/dist/index-ppgcFe12.d.mts +0 -33
- package/dist/index-to0RO38U.d.mts +0 -35
- package/dist/mongodb-adapter-C_qGQED5.mjs +0 -291
- package/dist/mongodb-adapter-C_qfK87x.cjs +0 -297
- package/dist/plugins-C1lm2Wj3.cjs +0 -5254
- package/dist/plugins-Dai1QkRU.mjs +0 -5199
- package/dist/vanilla-Bu2PmFzE.cjs +0 -30
- package/dist/vanilla-TfHqeiC7.mjs +0 -25
- /package/dist/{access-B5bBI4uT.mjs → access-D0DRqUKC.mjs} +0 -0
- /package/dist/{adapter-factory-BXei1QRX.mjs → adapter-factory-lKIOf2OR.mjs} +0 -0
- /package/dist/{bun-sqlite-dialect-CfkBo2v5.mjs → bun-sqlite-dialect-6NqeV3px.mjs} +0 -0
- /package/dist/{defu-B0Svx_x4.cjs → defu-BmOYq4PU.cjs} +0 -0
- /package/dist/{defu-SZkpHhbR.mjs → defu-D9ZTXqlo.mjs} +0 -0
- /package/dist/{hono-DuE14mmj.d.mts → hono-D0VqxVy1.d.mts} +0 -0
- /package/dist/{index-B5_0QTLg.d.mts → index-BDhhaE6Y.d.cts} +0 -0
- /package/dist/{index-B7SKyR_a.d.cts → index-CF9iq55a.d.mts} +0 -0
- /package/dist/{index-CTwrVluH.d.mts → index-CRt_fppq.d.mts} +0 -0
- /package/dist/{index-cs4Sh0En.d.cts → index-CdLyn7qP.d.cts} +0 -0
- /package/dist/{node-sqlite-dialect-BfBzyOAg.mjs → node-sqlite-dialect-w4DAg0PH.mjs} +0 -0
- /package/dist/{parser-CeAer-RM.mjs → parser-B25ylT5u.mjs} +0 -0
- /package/dist/{parser-CdncAl9i.cjs → parser-B_wxvaAr.cjs} +0 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
const require_index = require('./index.cjs');
|
|
2
|
+
let kysely = require("kysely");
|
|
3
|
+
|
|
4
|
+
//#region src/adapters/kysely-adapter/node-sqlite-dialect.ts
|
|
5
|
+
var NodeSqliteAdapter = class {
|
|
6
|
+
get supportsCreateIfNotExists() {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
get supportsTransactionalDdl() {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
get supportsReturning() {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
async acquireMigrationLock() {}
|
|
16
|
+
async releaseMigrationLock() {}
|
|
17
|
+
get supportsOutput() {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var NodeSqliteDriver = class {
|
|
22
|
+
#config;
|
|
23
|
+
#connectionMutex = new ConnectionMutex();
|
|
24
|
+
#db;
|
|
25
|
+
#connection;
|
|
26
|
+
constructor(config) {
|
|
27
|
+
this.#config = { ...config };
|
|
28
|
+
}
|
|
29
|
+
async init() {
|
|
30
|
+
this.#db = this.#config.database;
|
|
31
|
+
this.#connection = new NodeSqliteConnection(this.#db);
|
|
32
|
+
if (this.#config.onCreateConnection) await this.#config.onCreateConnection(this.#connection);
|
|
33
|
+
}
|
|
34
|
+
async acquireConnection() {
|
|
35
|
+
await this.#connectionMutex.lock();
|
|
36
|
+
return this.#connection;
|
|
37
|
+
}
|
|
38
|
+
async beginTransaction(connection) {
|
|
39
|
+
await connection.executeQuery(kysely.CompiledQuery.raw("begin"));
|
|
40
|
+
}
|
|
41
|
+
async commitTransaction(connection) {
|
|
42
|
+
await connection.executeQuery(kysely.CompiledQuery.raw("commit"));
|
|
43
|
+
}
|
|
44
|
+
async rollbackTransaction(connection) {
|
|
45
|
+
await connection.executeQuery(kysely.CompiledQuery.raw("rollback"));
|
|
46
|
+
}
|
|
47
|
+
async releaseConnection() {
|
|
48
|
+
this.#connectionMutex.unlock();
|
|
49
|
+
}
|
|
50
|
+
async destroy() {
|
|
51
|
+
this.#db?.close();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var NodeSqliteConnection = class {
|
|
55
|
+
#db;
|
|
56
|
+
constructor(db) {
|
|
57
|
+
this.#db = db;
|
|
58
|
+
}
|
|
59
|
+
executeQuery(compiledQuery) {
|
|
60
|
+
const { sql: sql$1, parameters } = compiledQuery;
|
|
61
|
+
const rows = this.#db.prepare(sql$1).all(...parameters);
|
|
62
|
+
return Promise.resolve({ rows });
|
|
63
|
+
}
|
|
64
|
+
async *streamQuery() {
|
|
65
|
+
throw new Error("Streaming query is not supported by SQLite driver.");
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var ConnectionMutex = class {
|
|
69
|
+
#promise;
|
|
70
|
+
#resolve;
|
|
71
|
+
async lock() {
|
|
72
|
+
while (this.#promise) await this.#promise;
|
|
73
|
+
this.#promise = new Promise((resolve) => {
|
|
74
|
+
this.#resolve = resolve;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
unlock() {
|
|
78
|
+
const resolve = this.#resolve;
|
|
79
|
+
this.#promise = void 0;
|
|
80
|
+
this.#resolve = void 0;
|
|
81
|
+
resolve?.();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var NodeSqliteIntrospector = class {
|
|
85
|
+
#db;
|
|
86
|
+
constructor(db) {
|
|
87
|
+
this.#db = db;
|
|
88
|
+
}
|
|
89
|
+
async getSchemas() {
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
async getTables(options = { withInternalKyselyTables: false }) {
|
|
93
|
+
let query = this.#db.selectFrom("sqlite_schema").where("type", "=", "table").where("name", "not like", "sqlite_%").select("name").$castTo();
|
|
94
|
+
if (!options.withInternalKyselyTables) query = query.where("name", "!=", kysely.DEFAULT_MIGRATION_TABLE).where("name", "!=", kysely.DEFAULT_MIGRATION_LOCK_TABLE);
|
|
95
|
+
const tables = await query.execute();
|
|
96
|
+
return Promise.all(tables.map(({ name }) => this.#getTableMetadata(name)));
|
|
97
|
+
}
|
|
98
|
+
async getMetadata(options) {
|
|
99
|
+
return { tables: await this.getTables(options) };
|
|
100
|
+
}
|
|
101
|
+
async #getTableMetadata(table) {
|
|
102
|
+
const db = this.#db;
|
|
103
|
+
const autoIncrementCol = (await db.selectFrom("sqlite_master").where("name", "=", table).select("sql").$castTo().execute())[0]?.sql?.split(/[\(\),]/)?.find((it) => it.toLowerCase().includes("autoincrement"))?.split(/\s+/)?.[0]?.replace(/["`]/g, "");
|
|
104
|
+
return {
|
|
105
|
+
name: table,
|
|
106
|
+
columns: (await db.selectFrom(kysely.sql`pragma_table_info(${table})`.as("table_info")).select([
|
|
107
|
+
"name",
|
|
108
|
+
"type",
|
|
109
|
+
"notnull",
|
|
110
|
+
"dflt_value"
|
|
111
|
+
]).execute()).map((col) => ({
|
|
112
|
+
name: col.name,
|
|
113
|
+
dataType: col.type,
|
|
114
|
+
isNullable: !col.notnull,
|
|
115
|
+
isAutoIncrementing: col.name === autoIncrementCol,
|
|
116
|
+
hasDefaultValue: col.dflt_value != null
|
|
117
|
+
})),
|
|
118
|
+
isView: true
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
var NodeSqliteQueryCompiler = class extends kysely.DefaultQueryCompiler {
|
|
123
|
+
getCurrentParameterPlaceholder() {
|
|
124
|
+
return "?";
|
|
125
|
+
}
|
|
126
|
+
getLeftIdentifierWrapper() {
|
|
127
|
+
return "\"";
|
|
128
|
+
}
|
|
129
|
+
getRightIdentifierWrapper() {
|
|
130
|
+
return "\"";
|
|
131
|
+
}
|
|
132
|
+
getAutoIncrement() {
|
|
133
|
+
return "autoincrement";
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var NodeSqliteDialect = class {
|
|
137
|
+
#config;
|
|
138
|
+
constructor(config) {
|
|
139
|
+
this.#config = { ...config };
|
|
140
|
+
}
|
|
141
|
+
createDriver() {
|
|
142
|
+
return new NodeSqliteDriver(this.#config);
|
|
143
|
+
}
|
|
144
|
+
createQueryCompiler() {
|
|
145
|
+
return new NodeSqliteQueryCompiler();
|
|
146
|
+
}
|
|
147
|
+
createAdapter() {
|
|
148
|
+
return new NodeSqliteAdapter();
|
|
149
|
+
}
|
|
150
|
+
createIntrospector(db) {
|
|
151
|
+
return new NodeSqliteIntrospector(db);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
//#endregion
|
|
156
|
+
exports.NodeSqliteDialect = NodeSqliteDialect;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { CompiledQuery, DEFAULT_MIGRATION_LOCK_TABLE, DEFAULT_MIGRATION_TABLE, DefaultQueryCompiler, Kysely, sql } from "kysely";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/kysely-adapter/node-sqlite-dialect.ts
|
|
4
|
+
var NodeSqliteAdapter = class {
|
|
5
|
+
get supportsCreateIfNotExists() {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
get supportsTransactionalDdl() {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
get supportsReturning() {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
async acquireMigrationLock() {}
|
|
15
|
+
async releaseMigrationLock() {}
|
|
16
|
+
get supportsOutput() {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var NodeSqliteDriver = class {
|
|
21
|
+
#config;
|
|
22
|
+
#connectionMutex = new ConnectionMutex();
|
|
23
|
+
#db;
|
|
24
|
+
#connection;
|
|
25
|
+
constructor(config) {
|
|
26
|
+
this.#config = { ...config };
|
|
27
|
+
}
|
|
28
|
+
async init() {
|
|
29
|
+
this.#db = this.#config.database;
|
|
30
|
+
this.#connection = new NodeSqliteConnection(this.#db);
|
|
31
|
+
if (this.#config.onCreateConnection) await this.#config.onCreateConnection(this.#connection);
|
|
32
|
+
}
|
|
33
|
+
async acquireConnection() {
|
|
34
|
+
await this.#connectionMutex.lock();
|
|
35
|
+
return this.#connection;
|
|
36
|
+
}
|
|
37
|
+
async beginTransaction(connection) {
|
|
38
|
+
await connection.executeQuery(CompiledQuery.raw("begin"));
|
|
39
|
+
}
|
|
40
|
+
async commitTransaction(connection) {
|
|
41
|
+
await connection.executeQuery(CompiledQuery.raw("commit"));
|
|
42
|
+
}
|
|
43
|
+
async rollbackTransaction(connection) {
|
|
44
|
+
await connection.executeQuery(CompiledQuery.raw("rollback"));
|
|
45
|
+
}
|
|
46
|
+
async releaseConnection() {
|
|
47
|
+
this.#connectionMutex.unlock();
|
|
48
|
+
}
|
|
49
|
+
async destroy() {
|
|
50
|
+
this.#db?.close();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var NodeSqliteConnection = class {
|
|
54
|
+
#db;
|
|
55
|
+
constructor(db) {
|
|
56
|
+
this.#db = db;
|
|
57
|
+
}
|
|
58
|
+
executeQuery(compiledQuery) {
|
|
59
|
+
const { sql: sql$1, parameters } = compiledQuery;
|
|
60
|
+
const rows = this.#db.prepare(sql$1).all(...parameters);
|
|
61
|
+
return Promise.resolve({ rows });
|
|
62
|
+
}
|
|
63
|
+
async *streamQuery() {
|
|
64
|
+
throw new Error("Streaming query is not supported by SQLite driver.");
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var ConnectionMutex = class {
|
|
68
|
+
#promise;
|
|
69
|
+
#resolve;
|
|
70
|
+
async lock() {
|
|
71
|
+
while (this.#promise) await this.#promise;
|
|
72
|
+
this.#promise = new Promise((resolve) => {
|
|
73
|
+
this.#resolve = resolve;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
unlock() {
|
|
77
|
+
const resolve = this.#resolve;
|
|
78
|
+
this.#promise = void 0;
|
|
79
|
+
this.#resolve = void 0;
|
|
80
|
+
resolve?.();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var NodeSqliteIntrospector = class {
|
|
84
|
+
#db;
|
|
85
|
+
constructor(db) {
|
|
86
|
+
this.#db = db;
|
|
87
|
+
}
|
|
88
|
+
async getSchemas() {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
async getTables(options = { withInternalKyselyTables: false }) {
|
|
92
|
+
let query = this.#db.selectFrom("sqlite_schema").where("type", "=", "table").where("name", "not like", "sqlite_%").select("name").$castTo();
|
|
93
|
+
if (!options.withInternalKyselyTables) query = query.where("name", "!=", DEFAULT_MIGRATION_TABLE).where("name", "!=", DEFAULT_MIGRATION_LOCK_TABLE);
|
|
94
|
+
const tables = await query.execute();
|
|
95
|
+
return Promise.all(tables.map(({ name }) => this.#getTableMetadata(name)));
|
|
96
|
+
}
|
|
97
|
+
async getMetadata(options) {
|
|
98
|
+
return { tables: await this.getTables(options) };
|
|
99
|
+
}
|
|
100
|
+
async #getTableMetadata(table) {
|
|
101
|
+
const db = this.#db;
|
|
102
|
+
const autoIncrementCol = (await db.selectFrom("sqlite_master").where("name", "=", table).select("sql").$castTo().execute())[0]?.sql?.split(/[\(\),]/)?.find((it) => it.toLowerCase().includes("autoincrement"))?.split(/\s+/)?.[0]?.replace(/["`]/g, "");
|
|
103
|
+
return {
|
|
104
|
+
name: table,
|
|
105
|
+
columns: (await db.selectFrom(sql`pragma_table_info(${table})`.as("table_info")).select([
|
|
106
|
+
"name",
|
|
107
|
+
"type",
|
|
108
|
+
"notnull",
|
|
109
|
+
"dflt_value"
|
|
110
|
+
]).execute()).map((col) => ({
|
|
111
|
+
name: col.name,
|
|
112
|
+
dataType: col.type,
|
|
113
|
+
isNullable: !col.notnull,
|
|
114
|
+
isAutoIncrementing: col.name === autoIncrementCol,
|
|
115
|
+
hasDefaultValue: col.dflt_value != null
|
|
116
|
+
})),
|
|
117
|
+
isView: true
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
var NodeSqliteQueryCompiler = class extends DefaultQueryCompiler {
|
|
122
|
+
getCurrentParameterPlaceholder() {
|
|
123
|
+
return "?";
|
|
124
|
+
}
|
|
125
|
+
getLeftIdentifierWrapper() {
|
|
126
|
+
return "\"";
|
|
127
|
+
}
|
|
128
|
+
getRightIdentifierWrapper() {
|
|
129
|
+
return "\"";
|
|
130
|
+
}
|
|
131
|
+
getAutoIncrement() {
|
|
132
|
+
return "autoincrement";
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
var NodeSqliteDialect = class {
|
|
136
|
+
#config;
|
|
137
|
+
constructor(config) {
|
|
138
|
+
this.#config = { ...config };
|
|
139
|
+
}
|
|
140
|
+
createDriver() {
|
|
141
|
+
return new NodeSqliteDriver(this.#config);
|
|
142
|
+
}
|
|
143
|
+
createQueryCompiler() {
|
|
144
|
+
return new NodeSqliteQueryCompiler();
|
|
145
|
+
}
|
|
146
|
+
createAdapter() {
|
|
147
|
+
return new NodeSqliteAdapter();
|
|
148
|
+
}
|
|
149
|
+
createIntrospector(db) {
|
|
150
|
+
return new NodeSqliteIntrospector(db);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
//#endregion
|
|
155
|
+
export { NodeSqliteAdapter, NodeSqliteDialect, NodeSqliteDriver, NodeSqliteIntrospector, NodeSqliteQueryCompiler };
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as Client, Ct as InferPluginRateLimit, F as DTO, I as FaireAuthOptions, L as FaireAuthRateLimitOptions, P as CustomRules, Q as CamelCase, R as Hooks, St as InferPluginMiddleware, Z as AtomListener, _t as FaireAuthPlugin, a as InferPluginTypes, an as AuthContext, at as InferAdditionalAsClient, bt as InferPluginErrorCodes, c as Models, cn as Adapter, ct as InferPluginsFromClient, dn as DBAdapter, dt as IsSignal, et as ClientOptions, fn as DBAdapterInstance, ft as RevalidateOptions, gn as Where, gt as AuthPluginSchema, hn as TransactionAdapter, i as AdditionalUserFieldsOutput, it as InferActions, l as RateLimit, ln as AdapterInstance, lt as InferSessionFromClient, mn as DBTransactionAdapter, mt as Store, n as AdditionalSessionFieldsOutput, nn as AuthFactory, nt as FaireAuthClientPlugin, o as InferSession, on as init, ot as InferAdditionalFromClient, pn as DBAdapterSchemaCreation, pt as SessionQueryParams, r as AdditionalUserFieldsInput, rn as AuthProperties, rt as Inc, s as InferUser, st as InferErrorCodes, t as AdditionalSessionFieldsInput, tn as AuthEndpoint, tt as CreateSchemaType, un as AdapterSchemaCreation, ut as InferUserFromClient, vt as InferOptionSchema, xt as InferPluginHooks, yt as InferPluginDTO, z as Middleware } from "../index-
|
|
1
|
+
import { $ as Client, Ct as InferPluginRateLimit, F as DTO, I as FaireAuthOptions, L as FaireAuthRateLimitOptions, P as CustomRules, Q as CamelCase, R as Hooks, St as InferPluginMiddleware, Z as AtomListener, _t as FaireAuthPlugin, a as InferPluginTypes, an as AuthContext, at as InferAdditionalAsClient, bt as InferPluginErrorCodes, c as Models, cn as Adapter, ct as InferPluginsFromClient, dn as DBAdapter, dt as IsSignal, et as ClientOptions, fn as DBAdapterInstance, ft as RevalidateOptions, gn as Where, gt as AuthPluginSchema, hn as TransactionAdapter, i as AdditionalUserFieldsOutput, it as InferActions, l as RateLimit, ln as AdapterInstance, lt as InferSessionFromClient, mn as DBTransactionAdapter, mt as Store, n as AdditionalSessionFieldsOutput, nn as AuthFactory, nt as FaireAuthClientPlugin, o as InferSession, on as init, ot as InferAdditionalFromClient, pn as DBAdapterSchemaCreation, pt as SessionQueryParams, r as AdditionalUserFieldsInput, rn as AuthProperties, rt as Inc, s as InferUser, st as InferErrorCodes, t as AdditionalSessionFieldsInput, tn as AuthEndpoint, tt as CreateSchemaType, un as AdapterSchemaCreation, ut as InferUserFromClient, vt as InferOptionSchema, xt as InferPluginHooks, yt as InferPluginDTO, z as Middleware } from "../index-BCzB3uDD.cjs";
|
|
2
2
|
import { n as Execute, r as ToExecFull, t as ContextVars } from "../hono-DOM31WQz.cjs";
|
|
3
3
|
export { Adapter, AdapterInstance, AdapterSchemaCreation, AdditionalSessionFieldsInput, AdditionalSessionFieldsOutput, AdditionalUserFieldsInput, AdditionalUserFieldsOutput, AtomListener, AuthContext, AuthEndpoint, AuthFactory, AuthPluginSchema, AuthProperties, CamelCase, Client, ClientOptions, ContextVars, CreateSchemaType, CustomRules, DBAdapter, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, DTO, Execute, FaireAuthClientPlugin, FaireAuthOptions, FaireAuthPlugin, FaireAuthRateLimitOptions, Hooks, Inc, InferActions, InferAdditionalAsClient, InferAdditionalFromClient, InferErrorCodes, InferOptionSchema, InferPluginDTO, InferPluginErrorCodes, InferPluginHooks, InferPluginMiddleware, InferPluginRateLimit, InferPluginTypes, InferPluginsFromClient, InferSession, InferSessionFromClient, InferUser, InferUserFromClient, IsSignal, Middleware, Models, RateLimit, RevalidateOptions, SessionQueryParams, Store, ToExecFull, TransactionAdapter, Where, init };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as Client, Ct as InferPluginRateLimit, F as DTO, I as FaireAuthOptions, L as FaireAuthRateLimitOptions, P as CustomRules, Q as CamelCase, R as Hooks, St as InferPluginMiddleware, Z as AtomListener, _t as FaireAuthPlugin, a as InferPluginTypes, an as AuthContext, at as InferAdditionalAsClient, bt as InferPluginErrorCodes, c as Models, cn as Adapter, ct as InferPluginsFromClient, dn as DBAdapter, dt as IsSignal, et as ClientOptions, fn as DBAdapterInstance, ft as RevalidateOptions, gn as Where, gt as AuthPluginSchema, hn as TransactionAdapter, i as AdditionalUserFieldsOutput, it as InferActions, l as RateLimit, ln as AdapterInstance, lt as InferSessionFromClient, mn as DBTransactionAdapter, mt as Store, n as AdditionalSessionFieldsOutput, nn as AuthFactory, nt as FaireAuthClientPlugin, o as InferSession, on as init, ot as InferAdditionalFromClient, pn as DBAdapterSchemaCreation, pt as SessionQueryParams, r as AdditionalUserFieldsInput, rn as AuthProperties, rt as Inc, s as InferUser, st as InferErrorCodes, t as AdditionalSessionFieldsInput, tn as AuthEndpoint, tt as CreateSchemaType, un as AdapterSchemaCreation, ut as InferUserFromClient, vt as InferOptionSchema, xt as InferPluginHooks, yt as InferPluginDTO, z as Middleware } from "../index-
|
|
2
|
-
import { n as Execute, r as ToExecFull, t as ContextVars } from "../hono-
|
|
1
|
+
import { $ as Client, Ct as InferPluginRateLimit, F as DTO, I as FaireAuthOptions, L as FaireAuthRateLimitOptions, P as CustomRules, Q as CamelCase, R as Hooks, St as InferPluginMiddleware, Z as AtomListener, _t as FaireAuthPlugin, a as InferPluginTypes, an as AuthContext, at as InferAdditionalAsClient, bt as InferPluginErrorCodes, c as Models, cn as Adapter, ct as InferPluginsFromClient, dn as DBAdapter, dt as IsSignal, et as ClientOptions, fn as DBAdapterInstance, ft as RevalidateOptions, gn as Where, gt as AuthPluginSchema, hn as TransactionAdapter, i as AdditionalUserFieldsOutput, it as InferActions, l as RateLimit, ln as AdapterInstance, lt as InferSessionFromClient, mn as DBTransactionAdapter, mt as Store, n as AdditionalSessionFieldsOutput, nn as AuthFactory, nt as FaireAuthClientPlugin, o as InferSession, on as init, ot as InferAdditionalFromClient, pn as DBAdapterSchemaCreation, pt as SessionQueryParams, r as AdditionalUserFieldsInput, rn as AuthProperties, rt as Inc, s as InferUser, st as InferErrorCodes, t as AdditionalSessionFieldsInput, tn as AuthEndpoint, tt as CreateSchemaType, un as AdapterSchemaCreation, ut as InferUserFromClient, vt as InferOptionSchema, xt as InferPluginHooks, yt as InferPluginDTO, z as Middleware } from "../index-CrmLTEj8.mjs";
|
|
2
|
+
import { n as Execute, r as ToExecFull, t as ContextVars } from "../hono-D0VqxVy1.mjs";
|
|
3
3
|
export { Adapter, AdapterInstance, AdapterSchemaCreation, AdditionalSessionFieldsInput, AdditionalSessionFieldsOutput, AdditionalUserFieldsInput, AdditionalUserFieldsOutput, AtomListener, AuthContext, AuthEndpoint, AuthFactory, AuthPluginSchema, AuthProperties, CamelCase, Client, ClientOptions, ContextVars, CreateSchemaType, CustomRules, DBAdapter, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, DTO, Execute, FaireAuthClientPlugin, FaireAuthOptions, FaireAuthPlugin, FaireAuthRateLimitOptions, Hooks, Inc, InferActions, InferAdditionalAsClient, InferAdditionalFromClient, InferErrorCodes, InferOptionSchema, InferPluginDTO, InferPluginErrorCodes, InferPluginHooks, InferPluginMiddleware, InferPluginRateLimit, InferPluginTypes, InferPluginsFromClient, InferSession, InferSessionFromClient, InferUser, InferUserFromClient, IsSignal, Middleware, Models, RateLimit, RevalidateOptions, SessionQueryParams, Store, ToExecFull, TransactionAdapter, Where, init };
|
package/dist/utils/cookies.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_chunk = require('../chunk-
|
|
2
|
-
require('../crypto-
|
|
3
|
-
require('../json
|
|
4
|
-
const require_cookies = require('../cookies-
|
|
1
|
+
const require_chunk = require('../chunk-fPmz2rbM.cjs');
|
|
2
|
+
require('../crypto-DpSCnrTp.cjs');
|
|
3
|
+
require('../json--tl7Grvs.cjs');
|
|
4
|
+
const require_cookies = require('../cookies-BTl72THv.cjs');
|
|
5
5
|
let hono_utils_cookie = require("hono/utils/cookie");
|
|
6
6
|
|
|
7
7
|
exports.checkAuthCookie = require_cookies.checkAuthCookie;
|
package/dist/utils/cookies.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as FaireAuthOptions$1, an as AuthContext$1 } from "../index-
|
|
1
|
+
import { I as FaireAuthOptions$1, an as AuthContext$1 } from "../index-BCzB3uDD.cjs";
|
|
2
2
|
import { t as ContextVars } from "../hono-DOM31WQz.cjs";
|
|
3
3
|
import { LiteralStringUnion } from "@faire-auth/core/types";
|
|
4
4
|
import { Context } from "hono";
|
package/dist/utils/cookies.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as FaireAuthOptions$1, an as AuthContext$1 } from "../index-
|
|
2
|
-
import { t as ContextVars } from "../hono-
|
|
1
|
+
import { I as FaireAuthOptions$1, an as AuthContext$1 } from "../index-CrmLTEj8.mjs";
|
|
2
|
+
import { t as ContextVars } from "../hono-D0VqxVy1.mjs";
|
|
3
3
|
import { Context } from "hono";
|
|
4
4
|
import { parse, parseSigned, serialize, serializeSigned } from "hono/utils/cookie";
|
|
5
5
|
import { Session, User } from "@faire-auth/core/db";
|
package/dist/utils/cookies.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../crypto-
|
|
1
|
+
import "../crypto-DH2Aa7jN.mjs";
|
|
2
2
|
import "../json-B1v2qRTQ.mjs";
|
|
3
|
-
import { _ as serializeSignedCookie, a as createCookieSetter, c as getCookieKey, d as parse, f as parseCookies, g as serializeSigned, h as serialize, i as createCookieCreator, l as getCookies, m as parseSigned, o as deleteSessionCookie, p as parseSetCookieHeader, r as createCookieCapture, s as getCookieCache, t as checkAuthCookie, u as getSessionCookie, v as setCookieCache, y as setSessionCookie } from "../cookies-
|
|
3
|
+
import { _ as serializeSignedCookie, a as createCookieSetter, c as getCookieKey, d as parse, f as parseCookies, g as serializeSigned, h as serialize, i as createCookieCreator, l as getCookies, m as parseSigned, o as deleteSessionCookie, p as parseSetCookieHeader, r as createCookieCapture, s as getCookieCache, t as checkAuthCookie, u as getSessionCookie, v as setCookieCache, y as setSessionCookie } from "../cookies-BTs1o992.mjs";
|
|
4
4
|
|
|
5
5
|
export * from "hono/cookie"
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "faire-auth",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"description": "The most comprehensive authentication library for TypeScript.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
"nanostores": "^1.0.1",
|
|
368
368
|
"type-fest": "^4.41.0",
|
|
369
369
|
"zod": "4.1.4",
|
|
370
|
-
"@faire-auth/core": "1.0.
|
|
370
|
+
"@faire-auth/core": "1.0.2"
|
|
371
371
|
},
|
|
372
372
|
"peerDependencies": {
|
|
373
373
|
"hono": ">=4.3.6"
|