keryx 0.10.4 → 0.10.6

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.
@@ -111,14 +111,14 @@ export class DB extends Initializer {
111
111
  * Learn more @ https://orm.drizzle.team/kit-docs/overview
112
112
  */
113
113
  async generateMigrations() {
114
- const migrationConfig = {
115
- dialect: "postgresql",
114
+ const migrationConfig: DrizzleMigrateConfig = {
115
+ dialect: "postgresql" as const,
116
116
  schema: path.join("schema", "*"),
117
117
  dbCredentials: {
118
118
  url: config.database.connectionString,
119
119
  },
120
120
  out: path.join("drizzle"),
121
- } satisfies DrizzleMigrateConfig;
121
+ };
122
122
 
123
123
  const fileContent = `export default ${JSON.stringify(migrationConfig, null, 2)}`;
124
124
  const tmpfilePath = path.join(api.rootDir, "drizzle", "config.tmp.ts");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keryx",
3
- "version": "0.10.4",
3
+ "version": "0.10.6",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/util/glob.ts CHANGED
@@ -23,12 +23,34 @@ export async function globLoader<T>(searchDir: string) {
23
23
  if (file.startsWith(".")) continue;
24
24
 
25
25
  const fullPath = path.join(dir, file);
26
- const modules = (await import(fullPath)) as {
27
- [key: string]: new () => T;
28
- };
29
- for (const [name, klass] of Object.entries(modules)) {
26
+ const modules = (await import(fullPath)) as Record<string, unknown>;
27
+
28
+ // Object.entries() can throw ReferenceError if an export is still in
29
+ // TDZ (temporal dead zone) due to circular imports. Fall back to
30
+ // per-key access so one TDZ export doesn't block the entire module.
31
+ let entries: [string, unknown][];
32
+ try {
33
+ entries = Object.entries(modules);
34
+ } catch {
35
+ const keys = Object.getOwnPropertyNames(modules);
36
+ entries = [];
37
+ for (const key of keys) {
38
+ try {
39
+ entries.push([key, modules[key]]);
40
+ } catch {
41
+ // Skip TDZ exports — they'll be loaded by their own initializer
42
+ }
43
+ }
44
+ }
45
+
46
+ for (const [name, klass] of entries) {
47
+ // Skip non-class exports (constants, functions, type remnants)
48
+ if (typeof klass !== "function" || klass.prototype === undefined) {
49
+ continue;
50
+ }
51
+
30
52
  try {
31
- const instance = new klass();
53
+ const instance = new (klass as new () => T)();
32
54
  results.push(instance);
33
55
  } catch (error) {
34
56
  throw new TypedError({