prisma-flare 1.0.0 → 1.1.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.
@@ -23,9 +23,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  mod
24
24
  ));
25
25
 
26
- // src/cli/db-create.ts
27
- var dotenv = __toESM(require("dotenv"), 1);
28
-
29
26
  // src/core/adapters/postgres.ts
30
27
  var PostgresAdapter = {
31
28
  name: "postgres",
@@ -33,26 +30,26 @@ var PostgresAdapter = {
33
30
  return url.startsWith("postgresql://") || url.startsWith("postgres://");
34
31
  },
35
32
  async create(url) {
36
- const config3 = parseDatabaseUrl(url);
33
+ const config = parseDatabaseUrl(url);
37
34
  const { Client } = await import("pg");
38
35
  const client = new Client({
39
- user: config3.user,
40
- password: config3.password,
41
- host: config3.host,
42
- port: config3.port,
36
+ user: config.user,
37
+ password: config.password,
38
+ host: config.host,
39
+ port: config.port,
43
40
  database: "postgres"
44
41
  });
45
42
  try {
46
43
  await client.connect();
47
44
  const checkRes = await client.query(
48
45
  `SELECT 1 FROM pg_database WHERE datname = $1`,
49
- [config3.database]
46
+ [config.database]
50
47
  );
51
48
  if (checkRes.rowCount === 0) {
52
- await client.query(`CREATE DATABASE "${config3.database}"`);
53
- console.log(`\u2705 Database "${config3.database}" created successfully.`);
49
+ await client.query(`CREATE DATABASE "${config.database}"`);
50
+ console.log(`\u2705 Database "${config.database}" created successfully.`);
54
51
  } else {
55
- console.log(`\u26A0\uFE0F Database "${config3.database}" already exists.`);
52
+ console.log(`\u26A0\uFE0F Database "${config.database}" already exists.`);
56
53
  }
57
54
  } catch (error) {
58
55
  console.error("\u274C Error creating database:", error);
@@ -62,13 +59,13 @@ var PostgresAdapter = {
62
59
  }
63
60
  },
64
61
  async drop(url) {
65
- const config3 = parseDatabaseUrl(url);
62
+ const config = parseDatabaseUrl(url);
66
63
  const { Client } = await import("pg");
67
64
  const client = new Client({
68
- user: config3.user,
69
- password: config3.password,
70
- host: config3.host,
71
- port: config3.port,
65
+ user: config.user,
66
+ password: config.password,
67
+ host: config.host,
68
+ port: config.port,
72
69
  database: "postgres"
73
70
  });
74
71
  try {
@@ -78,10 +75,10 @@ var PostgresAdapter = {
78
75
  FROM pg_stat_activity
79
76
  WHERE pg_stat_activity.datname = $1
80
77
  AND pid <> pg_backend_pid()`,
81
- [config3.database]
78
+ [config.database]
82
79
  );
83
- await client.query(`DROP DATABASE IF EXISTS "${config3.database}"`);
84
- console.log(`\u2705 Database "${config3.database}" dropped successfully.`);
80
+ await client.query(`DROP DATABASE IF EXISTS "${config.database}"`);
81
+ console.log(`\u2705 Database "${config.database}" dropped successfully.`);
85
82
  } catch (error) {
86
83
  console.error("\u274C Error dropping database:", error);
87
84
  throw error;
@@ -183,44 +180,7 @@ var registry = new AdapterRegistry();
183
180
  registry.register(PostgresAdapter);
184
181
  registry.register(SqliteAdapter);
185
182
 
186
- // src/cli/config.ts
187
- var fs2 = __toESM(require("fs"), 1);
188
- var path2 = __toESM(require("path"), 1);
189
- function findProjectRoot(currentDir) {
190
- if (fs2.existsSync(path2.join(currentDir, "package.json"))) {
191
- return currentDir;
192
- }
193
- const parentDir = path2.dirname(currentDir);
194
- if (parentDir === currentDir) {
195
- throw new Error("Could not find package.json");
196
- }
197
- return findProjectRoot(parentDir);
198
- }
199
- function loadConfig(rootDir) {
200
- const projectRoot = rootDir || findProjectRoot(process.cwd());
201
- const configPath = path2.join(projectRoot, "prisma-flare.config.json");
202
- let config3 = {
203
- modelsPath: "prisma/models",
204
- dbPath: "prisma/db",
205
- callbacksPath: "prisma/callbacks"
206
- };
207
- if (fs2.existsSync(configPath)) {
208
- try {
209
- const configFile = fs2.readFileSync(configPath, "utf-8");
210
- const userConfig = JSON.parse(configFile);
211
- config3 = { ...config3, ...userConfig };
212
- } catch {
213
- console.warn("\u26A0\uFE0F Could not read prisma-flare.config.json, using defaults.");
214
- }
215
- }
216
- return {
217
- ...config3
218
- };
219
- }
220
-
221
183
  // src/cli/db-create.ts
222
- var config2 = loadConfig();
223
- dotenv.config({ path: config2.envPath });
224
184
  async function createDatabase() {
225
185
  const databaseUrl = process.env.DATABASE_URL;
226
186
  if (!databaseUrl) {
@@ -1,8 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // src/cli/db-create.ts
4
- import * as dotenv from "dotenv";
5
-
6
3
  // src/core/adapters/postgres.ts
7
4
  var PostgresAdapter = {
8
5
  name: "postgres",
@@ -10,26 +7,26 @@ var PostgresAdapter = {
10
7
  return url.startsWith("postgresql://") || url.startsWith("postgres://");
11
8
  },
12
9
  async create(url) {
13
- const config3 = parseDatabaseUrl(url);
10
+ const config = parseDatabaseUrl(url);
14
11
  const { Client } = await import("pg");
15
12
  const client = new Client({
16
- user: config3.user,
17
- password: config3.password,
18
- host: config3.host,
19
- port: config3.port,
13
+ user: config.user,
14
+ password: config.password,
15
+ host: config.host,
16
+ port: config.port,
20
17
  database: "postgres"
21
18
  });
22
19
  try {
23
20
  await client.connect();
24
21
  const checkRes = await client.query(
25
22
  `SELECT 1 FROM pg_database WHERE datname = $1`,
26
- [config3.database]
23
+ [config.database]
27
24
  );
28
25
  if (checkRes.rowCount === 0) {
29
- await client.query(`CREATE DATABASE "${config3.database}"`);
30
- console.log(`\u2705 Database "${config3.database}" created successfully.`);
26
+ await client.query(`CREATE DATABASE "${config.database}"`);
27
+ console.log(`\u2705 Database "${config.database}" created successfully.`);
31
28
  } else {
32
- console.log(`\u26A0\uFE0F Database "${config3.database}" already exists.`);
29
+ console.log(`\u26A0\uFE0F Database "${config.database}" already exists.`);
33
30
  }
34
31
  } catch (error) {
35
32
  console.error("\u274C Error creating database:", error);
@@ -39,13 +36,13 @@ var PostgresAdapter = {
39
36
  }
40
37
  },
41
38
  async drop(url) {
42
- const config3 = parseDatabaseUrl(url);
39
+ const config = parseDatabaseUrl(url);
43
40
  const { Client } = await import("pg");
44
41
  const client = new Client({
45
- user: config3.user,
46
- password: config3.password,
47
- host: config3.host,
48
- port: config3.port,
42
+ user: config.user,
43
+ password: config.password,
44
+ host: config.host,
45
+ port: config.port,
49
46
  database: "postgres"
50
47
  });
51
48
  try {
@@ -55,10 +52,10 @@ var PostgresAdapter = {
55
52
  FROM pg_stat_activity
56
53
  WHERE pg_stat_activity.datname = $1
57
54
  AND pid <> pg_backend_pid()`,
58
- [config3.database]
55
+ [config.database]
59
56
  );
60
- await client.query(`DROP DATABASE IF EXISTS "${config3.database}"`);
61
- console.log(`\u2705 Database "${config3.database}" dropped successfully.`);
57
+ await client.query(`DROP DATABASE IF EXISTS "${config.database}"`);
58
+ console.log(`\u2705 Database "${config.database}" dropped successfully.`);
62
59
  } catch (error) {
63
60
  console.error("\u274C Error dropping database:", error);
64
61
  throw error;
@@ -160,44 +157,7 @@ var registry = new AdapterRegistry();
160
157
  registry.register(PostgresAdapter);
161
158
  registry.register(SqliteAdapter);
162
159
 
163
- // src/cli/config.ts
164
- import * as fs2 from "fs";
165
- import * as path2 from "path";
166
- function findProjectRoot(currentDir) {
167
- if (fs2.existsSync(path2.join(currentDir, "package.json"))) {
168
- return currentDir;
169
- }
170
- const parentDir = path2.dirname(currentDir);
171
- if (parentDir === currentDir) {
172
- throw new Error("Could not find package.json");
173
- }
174
- return findProjectRoot(parentDir);
175
- }
176
- function loadConfig(rootDir) {
177
- const projectRoot = rootDir || findProjectRoot(process.cwd());
178
- const configPath = path2.join(projectRoot, "prisma-flare.config.json");
179
- let config3 = {
180
- modelsPath: "prisma/models",
181
- dbPath: "prisma/db",
182
- callbacksPath: "prisma/callbacks"
183
- };
184
- if (fs2.existsSync(configPath)) {
185
- try {
186
- const configFile = fs2.readFileSync(configPath, "utf-8");
187
- const userConfig = JSON.parse(configFile);
188
- config3 = { ...config3, ...userConfig };
189
- } catch {
190
- console.warn("\u26A0\uFE0F Could not read prisma-flare.config.json, using defaults.");
191
- }
192
- }
193
- return {
194
- ...config3
195
- };
196
- }
197
-
198
160
  // src/cli/db-create.ts
199
- var config2 = loadConfig();
200
- dotenv.config({ path: config2.envPath });
201
161
  async function createDatabase() {
202
162
  const databaseUrl = process.env.DATABASE_URL;
203
163
  if (!databaseUrl) {
@@ -24,7 +24,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  ));
25
25
 
26
26
  // src/cli/db-drop.ts
27
- var dotenv = __toESM(require("dotenv"), 1);
28
27
  var readline = __toESM(require("readline"), 1);
29
28
 
30
29
  // src/core/adapters/postgres.ts
@@ -34,26 +33,26 @@ var PostgresAdapter = {
34
33
  return url.startsWith("postgresql://") || url.startsWith("postgres://");
35
34
  },
36
35
  async create(url) {
37
- const config3 = parseDatabaseUrl(url);
36
+ const config = parseDatabaseUrl(url);
38
37
  const { Client } = await import("pg");
39
38
  const client = new Client({
40
- user: config3.user,
41
- password: config3.password,
42
- host: config3.host,
43
- port: config3.port,
39
+ user: config.user,
40
+ password: config.password,
41
+ host: config.host,
42
+ port: config.port,
44
43
  database: "postgres"
45
44
  });
46
45
  try {
47
46
  await client.connect();
48
47
  const checkRes = await client.query(
49
48
  `SELECT 1 FROM pg_database WHERE datname = $1`,
50
- [config3.database]
49
+ [config.database]
51
50
  );
52
51
  if (checkRes.rowCount === 0) {
53
- await client.query(`CREATE DATABASE "${config3.database}"`);
54
- console.log(`\u2705 Database "${config3.database}" created successfully.`);
52
+ await client.query(`CREATE DATABASE "${config.database}"`);
53
+ console.log(`\u2705 Database "${config.database}" created successfully.`);
55
54
  } else {
56
- console.log(`\u26A0\uFE0F Database "${config3.database}" already exists.`);
55
+ console.log(`\u26A0\uFE0F Database "${config.database}" already exists.`);
57
56
  }
58
57
  } catch (error) {
59
58
  console.error("\u274C Error creating database:", error);
@@ -63,13 +62,13 @@ var PostgresAdapter = {
63
62
  }
64
63
  },
65
64
  async drop(url) {
66
- const config3 = parseDatabaseUrl(url);
65
+ const config = parseDatabaseUrl(url);
67
66
  const { Client } = await import("pg");
68
67
  const client = new Client({
69
- user: config3.user,
70
- password: config3.password,
71
- host: config3.host,
72
- port: config3.port,
68
+ user: config.user,
69
+ password: config.password,
70
+ host: config.host,
71
+ port: config.port,
73
72
  database: "postgres"
74
73
  });
75
74
  try {
@@ -79,10 +78,10 @@ var PostgresAdapter = {
79
78
  FROM pg_stat_activity
80
79
  WHERE pg_stat_activity.datname = $1
81
80
  AND pid <> pg_backend_pid()`,
82
- [config3.database]
81
+ [config.database]
83
82
  );
84
- await client.query(`DROP DATABASE IF EXISTS "${config3.database}"`);
85
- console.log(`\u2705 Database "${config3.database}" dropped successfully.`);
83
+ await client.query(`DROP DATABASE IF EXISTS "${config.database}"`);
84
+ console.log(`\u2705 Database "${config.database}" dropped successfully.`);
86
85
  } catch (error) {
87
86
  console.error("\u274C Error dropping database:", error);
88
87
  throw error;
@@ -184,44 +183,7 @@ var registry = new AdapterRegistry();
184
183
  registry.register(PostgresAdapter);
185
184
  registry.register(SqliteAdapter);
186
185
 
187
- // src/cli/config.ts
188
- var fs2 = __toESM(require("fs"), 1);
189
- var path2 = __toESM(require("path"), 1);
190
- function findProjectRoot(currentDir) {
191
- if (fs2.existsSync(path2.join(currentDir, "package.json"))) {
192
- return currentDir;
193
- }
194
- const parentDir = path2.dirname(currentDir);
195
- if (parentDir === currentDir) {
196
- throw new Error("Could not find package.json");
197
- }
198
- return findProjectRoot(parentDir);
199
- }
200
- function loadConfig(rootDir) {
201
- const projectRoot = rootDir || findProjectRoot(process.cwd());
202
- const configPath = path2.join(projectRoot, "prisma-flare.config.json");
203
- let config3 = {
204
- modelsPath: "prisma/models",
205
- dbPath: "prisma/db",
206
- callbacksPath: "prisma/callbacks"
207
- };
208
- if (fs2.existsSync(configPath)) {
209
- try {
210
- const configFile = fs2.readFileSync(configPath, "utf-8");
211
- const userConfig = JSON.parse(configFile);
212
- config3 = { ...config3, ...userConfig };
213
- } catch {
214
- console.warn("\u26A0\uFE0F Could not read prisma-flare.config.json, using defaults.");
215
- }
216
- }
217
- return {
218
- ...config3
219
- };
220
- }
221
-
222
186
  // src/cli/db-drop.ts
223
- var config2 = loadConfig();
224
- dotenv.config({ path: config2.envPath });
225
187
  function confirm(question) {
226
188
  const rl = readline.createInterface({
227
189
  input: process.stdin,
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli/db-drop.ts
4
- import * as dotenv from "dotenv";
5
4
  import * as readline from "readline";
6
5
 
7
6
  // src/core/adapters/postgres.ts
@@ -11,26 +10,26 @@ var PostgresAdapter = {
11
10
  return url.startsWith("postgresql://") || url.startsWith("postgres://");
12
11
  },
13
12
  async create(url) {
14
- const config3 = parseDatabaseUrl(url);
13
+ const config = parseDatabaseUrl(url);
15
14
  const { Client } = await import("pg");
16
15
  const client = new Client({
17
- user: config3.user,
18
- password: config3.password,
19
- host: config3.host,
20
- port: config3.port,
16
+ user: config.user,
17
+ password: config.password,
18
+ host: config.host,
19
+ port: config.port,
21
20
  database: "postgres"
22
21
  });
23
22
  try {
24
23
  await client.connect();
25
24
  const checkRes = await client.query(
26
25
  `SELECT 1 FROM pg_database WHERE datname = $1`,
27
- [config3.database]
26
+ [config.database]
28
27
  );
29
28
  if (checkRes.rowCount === 0) {
30
- await client.query(`CREATE DATABASE "${config3.database}"`);
31
- console.log(`\u2705 Database "${config3.database}" created successfully.`);
29
+ await client.query(`CREATE DATABASE "${config.database}"`);
30
+ console.log(`\u2705 Database "${config.database}" created successfully.`);
32
31
  } else {
33
- console.log(`\u26A0\uFE0F Database "${config3.database}" already exists.`);
32
+ console.log(`\u26A0\uFE0F Database "${config.database}" already exists.`);
34
33
  }
35
34
  } catch (error) {
36
35
  console.error("\u274C Error creating database:", error);
@@ -40,13 +39,13 @@ var PostgresAdapter = {
40
39
  }
41
40
  },
42
41
  async drop(url) {
43
- const config3 = parseDatabaseUrl(url);
42
+ const config = parseDatabaseUrl(url);
44
43
  const { Client } = await import("pg");
45
44
  const client = new Client({
46
- user: config3.user,
47
- password: config3.password,
48
- host: config3.host,
49
- port: config3.port,
45
+ user: config.user,
46
+ password: config.password,
47
+ host: config.host,
48
+ port: config.port,
50
49
  database: "postgres"
51
50
  });
52
51
  try {
@@ -56,10 +55,10 @@ var PostgresAdapter = {
56
55
  FROM pg_stat_activity
57
56
  WHERE pg_stat_activity.datname = $1
58
57
  AND pid <> pg_backend_pid()`,
59
- [config3.database]
58
+ [config.database]
60
59
  );
61
- await client.query(`DROP DATABASE IF EXISTS "${config3.database}"`);
62
- console.log(`\u2705 Database "${config3.database}" dropped successfully.`);
60
+ await client.query(`DROP DATABASE IF EXISTS "${config.database}"`);
61
+ console.log(`\u2705 Database "${config.database}" dropped successfully.`);
63
62
  } catch (error) {
64
63
  console.error("\u274C Error dropping database:", error);
65
64
  throw error;
@@ -161,44 +160,7 @@ var registry = new AdapterRegistry();
161
160
  registry.register(PostgresAdapter);
162
161
  registry.register(SqliteAdapter);
163
162
 
164
- // src/cli/config.ts
165
- import * as fs2 from "fs";
166
- import * as path2 from "path";
167
- function findProjectRoot(currentDir) {
168
- if (fs2.existsSync(path2.join(currentDir, "package.json"))) {
169
- return currentDir;
170
- }
171
- const parentDir = path2.dirname(currentDir);
172
- if (parentDir === currentDir) {
173
- throw new Error("Could not find package.json");
174
- }
175
- return findProjectRoot(parentDir);
176
- }
177
- function loadConfig(rootDir) {
178
- const projectRoot = rootDir || findProjectRoot(process.cwd());
179
- const configPath = path2.join(projectRoot, "prisma-flare.config.json");
180
- let config3 = {
181
- modelsPath: "prisma/models",
182
- dbPath: "prisma/db",
183
- callbacksPath: "prisma/callbacks"
184
- };
185
- if (fs2.existsSync(configPath)) {
186
- try {
187
- const configFile = fs2.readFileSync(configPath, "utf-8");
188
- const userConfig = JSON.parse(configFile);
189
- config3 = { ...config3, ...userConfig };
190
- } catch {
191
- console.warn("\u26A0\uFE0F Could not read prisma-flare.config.json, using defaults.");
192
- }
193
- }
194
- return {
195
- ...config3
196
- };
197
- }
198
-
199
163
  // src/cli/db-drop.ts
200
- var config2 = loadConfig();
201
- dotenv.config({ path: config2.envPath });
202
164
  function confirm(question) {
203
165
  const rl = readline.createInterface({
204
166
  input: process.stdin,
@@ -25,7 +25,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
 
26
26
  // src/cli/db-migrate.ts
27
27
  var import_child_process = require("child_process");
28
- var dotenv = __toESM(require("dotenv"), 1);
29
28
 
30
29
  // src/cli/generate-queries.ts
31
30
  var fs2 = __toESM(require("fs"), 1);
@@ -48,7 +47,7 @@ function findProjectRoot(currentDir) {
48
47
  function loadConfig(rootDir) {
49
48
  const projectRoot = rootDir || findProjectRoot(process.cwd());
50
49
  const configPath = path.join(projectRoot, "prisma-flare.config.json");
51
- let config3 = {
50
+ let config = {
52
51
  modelsPath: "prisma/models",
53
52
  dbPath: "prisma/db",
54
53
  callbacksPath: "prisma/callbacks"
@@ -57,13 +56,13 @@ function loadConfig(rootDir) {
57
56
  try {
58
57
  const configFile = fs.readFileSync(configPath, "utf-8");
59
58
  const userConfig = JSON.parse(configFile);
60
- config3 = { ...config3, ...userConfig };
59
+ config = { ...config, ...userConfig };
61
60
  } catch {
62
61
  console.warn("\u26A0\uFE0F Could not read prisma-flare.config.json, using defaults.");
63
62
  }
64
63
  }
65
64
  return {
66
- ...config3
65
+ ...config
67
66
  };
68
67
  }
69
68
 
@@ -87,7 +86,7 @@ function parseRelations(schemaContent, models) {
87
86
  if (fieldMatch) {
88
87
  const fieldName = fieldMatch[1];
89
88
  const fieldType = fieldMatch[2];
90
- const isArray = !!fieldMatch[3];
89
+ const _isArray = !!fieldMatch[3];
91
90
  if (models.includes(fieldType)) {
92
91
  const modelRelations = relations.get(modelName) || [];
93
92
  modelRelations.push({ fieldName, targetModel: fieldType });
@@ -100,7 +99,7 @@ function parseRelations(schemaContent, models) {
100
99
  }
101
100
  function generateQueries() {
102
101
  const rootDir = findProjectRoot(process.cwd());
103
- const config3 = loadConfig(rootDir);
102
+ const config = loadConfig(rootDir);
104
103
  const schemaPath = path2.join(rootDir, "prisma", "schema.prisma");
105
104
  if (!fs2.existsSync(schemaPath)) {
106
105
  console.error(`\u274C Schema not found at ${schemaPath}`);
@@ -113,11 +112,11 @@ function generateQueries() {
113
112
  while ((match = modelRegex.exec(schemaContent)) !== null) {
114
113
  models.push(match[1]);
115
114
  }
116
- const queriesDir = path2.join(rootDir, config3.modelsPath);
115
+ const queriesDir = path2.join(rootDir, config.modelsPath);
117
116
  if (!fs2.existsSync(queriesDir)) {
118
117
  fs2.mkdirSync(queriesDir, { recursive: true });
119
118
  }
120
- const absDbPath = path2.join(rootDir, config3.dbPath);
119
+ const absDbPath = path2.join(rootDir, config.dbPath);
121
120
  let relativePathToDb = path2.relative(queriesDir, absDbPath);
122
121
  if (!relativePathToDb.startsWith(".")) relativePathToDb = "./" + relativePathToDb;
123
122
  relativePathToDb = relativePathToDb.replace(/\\/g, "/");
@@ -175,7 +174,7 @@ export default class ${model} extends FlareBuilder<'${modelCamel}'> {
175
174
  const relations = parseRelations(schemaContent, models);
176
175
  const getters = models.map((model) => {
177
176
  const modelCamel = toCamelCase(model);
178
- const customPlural = config3.plurals?.[model];
177
+ const customPlural = config.plurals?.[model];
179
178
  const modelPlural = customPlural || (0, import_pluralize.default)(modelCamel);
180
179
  return ` static get ${modelPlural}() {
181
180
  return new ${model}();
@@ -184,12 +183,12 @@ export default class ${model} extends FlareBuilder<'${modelCamel}'> {
184
183
  const registrationLines = [];
185
184
  models.forEach((model) => {
186
185
  const modelCamel = toCamelCase(model);
187
- const customPlural = config3.plurals?.[model];
186
+ const customPlural = config.plurals?.[model];
188
187
  const modelPlural = customPlural || (0, import_pluralize.default)(modelCamel);
189
188
  registrationLines.push(`modelRegistry.register('${modelCamel}', ${model});`);
190
189
  registrationLines.push(`modelRegistry.register('${modelPlural}', ${model});`);
191
190
  });
192
- relations.forEach((rels, modelName) => {
191
+ relations.forEach((rels, _modelName) => {
193
192
  rels.forEach((rel) => {
194
193
  registrationLines.push(`modelRegistry.register('${rel.fieldName}', ${rel.targetModel});`);
195
194
  });
@@ -244,19 +243,19 @@ exports.DB = DB;
244
243
  }).join("\n");
245
244
  const gettersTypes = models.map((model) => {
246
245
  const modelCamel = toCamelCase(model);
247
- const customPlural = config3.plurals?.[model];
246
+ const customPlural = config.plurals?.[model];
248
247
  const modelPlural = customPlural || (0, import_pluralize.default)(modelCamel);
249
248
  return ` static get ${modelPlural}(): ${model};`;
250
249
  }).join("\n");
251
250
  const relationMapEntries = [];
252
251
  models.forEach((model) => {
253
252
  const modelCamel = toCamelCase(model);
254
- const customPlural = config3.plurals?.[model];
253
+ const customPlural = config.plurals?.[model];
255
254
  const modelPlural = customPlural || (0, import_pluralize.default)(modelCamel);
256
255
  relationMapEntries.push(` ${modelCamel}: ${model};`);
257
256
  relationMapEntries.push(` ${modelPlural}: ${model};`);
258
257
  });
259
- relations.forEach((rels, modelName) => {
258
+ relations.forEach((rels, _modelName) => {
260
259
  rels.forEach((rel) => {
261
260
  const entry = ` ${rel.fieldName}: ${rel.targetModel};`;
262
261
  if (!relationMapEntries.includes(entry)) {
@@ -288,8 +287,6 @@ ${gettersTypes}
288
287
  }
289
288
 
290
289
  // src/cli/db-migrate.ts
291
- var config2 = loadConfig();
292
- dotenv.config({ path: config2.envPath });
293
290
  function runMigrations() {
294
291
  const databaseUrl = process.env.DATABASE_URL;
295
292
  if (!databaseUrl) {