@kyro-cms/core 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +10 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22,13 +22,14 @@ export { createDatabase, runMigrations, seedDefaultRoles } from './chunk-7DSDEVB
|
|
|
22
22
|
export { MongoDBAdapter, createMongoDBAdapter } from './chunk-342BJNBI.js';
|
|
23
23
|
import { AbstractBaseAdapter } from './chunk-A4USRVTQ.js';
|
|
24
24
|
export { AbstractBaseAdapter } from './chunk-A4USRVTQ.js';
|
|
25
|
-
import
|
|
25
|
+
import './chunk-Z6ZWNWWR.js';
|
|
26
26
|
import Database from 'better-sqlite3';
|
|
27
27
|
import crypto2, { randomBytes } from 'crypto';
|
|
28
|
+
import { readFileSync } from 'fs';
|
|
29
|
+
import path, { join, resolve } from 'path';
|
|
28
30
|
export { z } from 'zod';
|
|
29
31
|
import { createStorage } from 'unstorage';
|
|
30
32
|
import indexedbDriver from 'unstorage/drivers/indexedb';
|
|
31
|
-
import path from 'path';
|
|
32
33
|
import fsDriver from 'unstorage/drivers/fs';
|
|
33
34
|
|
|
34
35
|
// src/hooks/types.ts
|
|
@@ -978,13 +979,13 @@ var LocalAdapter = class extends AbstractBaseAdapter {
|
|
|
978
979
|
// Transaction Support
|
|
979
980
|
// ========================================================================
|
|
980
981
|
async transaction(fn) {
|
|
981
|
-
return new Promise((
|
|
982
|
+
return new Promise((resolve2, reject) => {
|
|
982
983
|
const tx = this.db.transaction(async () => {
|
|
983
984
|
return fn({ db: this.db });
|
|
984
985
|
});
|
|
985
986
|
try {
|
|
986
987
|
const result = tx();
|
|
987
|
-
|
|
988
|
+
resolve2(result);
|
|
988
989
|
} catch (error) {
|
|
989
990
|
reject(error);
|
|
990
991
|
}
|
|
@@ -1911,8 +1912,6 @@ var InMemoryAccountLockout = class {
|
|
|
1911
1912
|
this.config = { ...this.config, ...config };
|
|
1912
1913
|
}
|
|
1913
1914
|
};
|
|
1914
|
-
|
|
1915
|
-
// src/auth/config.ts
|
|
1916
1915
|
function getEnv(key, fallback = "") {
|
|
1917
1916
|
return process.env[key] || fallback;
|
|
1918
1917
|
}
|
|
@@ -1932,8 +1931,6 @@ function detectDatabaseType() {
|
|
|
1932
1931
|
return envDb;
|
|
1933
1932
|
}
|
|
1934
1933
|
try {
|
|
1935
|
-
const { readFileSync } = __require("fs");
|
|
1936
|
-
const { join } = __require("path");
|
|
1937
1934
|
const configPath = join(process.cwd(), "kyro.config.ts");
|
|
1938
1935
|
const configContent = readFileSync(configPath, "utf8");
|
|
1939
1936
|
if (configContent.includes("createLocalAdapter")) {
|
|
@@ -1952,8 +1949,8 @@ function detectDatabaseType() {
|
|
|
1952
1949
|
}
|
|
1953
1950
|
async function createAuthAdapter(databaseType) {
|
|
1954
1951
|
const cwd = process.cwd();
|
|
1955
|
-
const rootDir = cwd.endsWith("admin") ?
|
|
1956
|
-
const defaultAuthDbPath =
|
|
1952
|
+
const rootDir = cwd.endsWith("admin") ? join(cwd, "..") : cwd;
|
|
1953
|
+
const defaultAuthDbPath = resolve(rootDir, "data", "auth.db");
|
|
1957
1954
|
switch (databaseType) {
|
|
1958
1955
|
case "sqlite":
|
|
1959
1956
|
return new SQLiteAuthAdapter({
|