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.
@@ -2,7 +2,6 @@
2
2
 
3
3
  // src/cli/db-migrate.ts
4
4
  import { execSync } from "child_process";
5
- import * as dotenv from "dotenv";
6
5
 
7
6
  // src/cli/generate-queries.ts
8
7
  import * as fs2 from "fs";
@@ -25,7 +24,7 @@ function findProjectRoot(currentDir) {
25
24
  function loadConfig(rootDir) {
26
25
  const projectRoot = rootDir || findProjectRoot(process.cwd());
27
26
  const configPath = path.join(projectRoot, "prisma-flare.config.json");
28
- let config3 = {
27
+ let config = {
29
28
  modelsPath: "prisma/models",
30
29
  dbPath: "prisma/db",
31
30
  callbacksPath: "prisma/callbacks"
@@ -34,13 +33,13 @@ function loadConfig(rootDir) {
34
33
  try {
35
34
  const configFile = fs.readFileSync(configPath, "utf-8");
36
35
  const userConfig = JSON.parse(configFile);
37
- config3 = { ...config3, ...userConfig };
36
+ config = { ...config, ...userConfig };
38
37
  } catch {
39
38
  console.warn("\u26A0\uFE0F Could not read prisma-flare.config.json, using defaults.");
40
39
  }
41
40
  }
42
41
  return {
43
- ...config3
42
+ ...config
44
43
  };
45
44
  }
46
45
 
@@ -64,7 +63,7 @@ function parseRelations(schemaContent, models) {
64
63
  if (fieldMatch) {
65
64
  const fieldName = fieldMatch[1];
66
65
  const fieldType = fieldMatch[2];
67
- const isArray = !!fieldMatch[3];
66
+ const _isArray = !!fieldMatch[3];
68
67
  if (models.includes(fieldType)) {
69
68
  const modelRelations = relations.get(modelName) || [];
70
69
  modelRelations.push({ fieldName, targetModel: fieldType });
@@ -77,7 +76,7 @@ function parseRelations(schemaContent, models) {
77
76
  }
78
77
  function generateQueries() {
79
78
  const rootDir = findProjectRoot(process.cwd());
80
- const config3 = loadConfig(rootDir);
79
+ const config = loadConfig(rootDir);
81
80
  const schemaPath = path2.join(rootDir, "prisma", "schema.prisma");
82
81
  if (!fs2.existsSync(schemaPath)) {
83
82
  console.error(`\u274C Schema not found at ${schemaPath}`);
@@ -90,11 +89,11 @@ function generateQueries() {
90
89
  while ((match = modelRegex.exec(schemaContent)) !== null) {
91
90
  models.push(match[1]);
92
91
  }
93
- const queriesDir = path2.join(rootDir, config3.modelsPath);
92
+ const queriesDir = path2.join(rootDir, config.modelsPath);
94
93
  if (!fs2.existsSync(queriesDir)) {
95
94
  fs2.mkdirSync(queriesDir, { recursive: true });
96
95
  }
97
- const absDbPath = path2.join(rootDir, config3.dbPath);
96
+ const absDbPath = path2.join(rootDir, config.dbPath);
98
97
  let relativePathToDb = path2.relative(queriesDir, absDbPath);
99
98
  if (!relativePathToDb.startsWith(".")) relativePathToDb = "./" + relativePathToDb;
100
99
  relativePathToDb = relativePathToDb.replace(/\\/g, "/");
@@ -152,7 +151,7 @@ export default class ${model} extends FlareBuilder<'${modelCamel}'> {
152
151
  const relations = parseRelations(schemaContent, models);
153
152
  const getters = models.map((model) => {
154
153
  const modelCamel = toCamelCase(model);
155
- const customPlural = config3.plurals?.[model];
154
+ const customPlural = config.plurals?.[model];
156
155
  const modelPlural = customPlural || pluralize(modelCamel);
157
156
  return ` static get ${modelPlural}() {
158
157
  return new ${model}();
@@ -161,12 +160,12 @@ export default class ${model} extends FlareBuilder<'${modelCamel}'> {
161
160
  const registrationLines = [];
162
161
  models.forEach((model) => {
163
162
  const modelCamel = toCamelCase(model);
164
- const customPlural = config3.plurals?.[model];
163
+ const customPlural = config.plurals?.[model];
165
164
  const modelPlural = customPlural || pluralize(modelCamel);
166
165
  registrationLines.push(`modelRegistry.register('${modelCamel}', ${model});`);
167
166
  registrationLines.push(`modelRegistry.register('${modelPlural}', ${model});`);
168
167
  });
169
- relations.forEach((rels, modelName) => {
168
+ relations.forEach((rels, _modelName) => {
170
169
  rels.forEach((rel) => {
171
170
  registrationLines.push(`modelRegistry.register('${rel.fieldName}', ${rel.targetModel});`);
172
171
  });
@@ -221,19 +220,19 @@ exports.DB = DB;
221
220
  }).join("\n");
222
221
  const gettersTypes = models.map((model) => {
223
222
  const modelCamel = toCamelCase(model);
224
- const customPlural = config3.plurals?.[model];
223
+ const customPlural = config.plurals?.[model];
225
224
  const modelPlural = customPlural || pluralize(modelCamel);
226
225
  return ` static get ${modelPlural}(): ${model};`;
227
226
  }).join("\n");
228
227
  const relationMapEntries = [];
229
228
  models.forEach((model) => {
230
229
  const modelCamel = toCamelCase(model);
231
- const customPlural = config3.plurals?.[model];
230
+ const customPlural = config.plurals?.[model];
232
231
  const modelPlural = customPlural || pluralize(modelCamel);
233
232
  relationMapEntries.push(` ${modelCamel}: ${model};`);
234
233
  relationMapEntries.push(` ${modelPlural}: ${model};`);
235
234
  });
236
- relations.forEach((rels, modelName) => {
235
+ relations.forEach((rels, _modelName) => {
237
236
  rels.forEach((rel) => {
238
237
  const entry = ` ${rel.fieldName}: ${rel.targetModel};`;
239
238
  if (!relationMapEntries.includes(entry)) {
@@ -265,8 +264,6 @@ ${gettersTypes}
265
264
  }
266
265
 
267
266
  // src/cli/db-migrate.ts
268
- var config2 = loadConfig();
269
- dotenv.config({ path: config2.envPath });
270
267
  function runMigrations() {
271
268
  const databaseUrl = process.env.DATABASE_URL;
272
269
  if (!databaseUrl) {
@@ -25,47 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
 
26
26
  // src/cli/db-reset.ts
27
27
  var import_child_process = require("child_process");
28
- var dotenv = __toESM(require("dotenv"), 1);
29
28
  var readline = __toESM(require("readline"), 1);
30
-
31
- // src/cli/config.ts
32
- var fs = __toESM(require("fs"), 1);
33
- var path = __toESM(require("path"), 1);
34
- function findProjectRoot(currentDir) {
35
- if (fs.existsSync(path.join(currentDir, "package.json"))) {
36
- return currentDir;
37
- }
38
- const parentDir = path.dirname(currentDir);
39
- if (parentDir === currentDir) {
40
- throw new Error("Could not find package.json");
41
- }
42
- return findProjectRoot(parentDir);
43
- }
44
- function loadConfig(rootDir) {
45
- const projectRoot = rootDir || findProjectRoot(process.cwd());
46
- const configPath = path.join(projectRoot, "prisma-flare.config.json");
47
- let config3 = {
48
- modelsPath: "prisma/models",
49
- dbPath: "prisma/db",
50
- callbacksPath: "prisma/callbacks"
51
- };
52
- if (fs.existsSync(configPath)) {
53
- try {
54
- const configFile = fs.readFileSync(configPath, "utf-8");
55
- const userConfig = JSON.parse(configFile);
56
- config3 = { ...config3, ...userConfig };
57
- } catch {
58
- console.warn("\u26A0\uFE0F Could not read prisma-flare.config.json, using defaults.");
59
- }
60
- }
61
- return {
62
- ...config3
63
- };
64
- }
65
-
66
- // src/cli/db-reset.ts
67
- var config2 = loadConfig();
68
- dotenv.config({ path: config2.envPath });
69
29
  function confirm(question) {
70
30
  const rl = readline.createInterface({
71
31
  input: process.stdin,
@@ -2,47 +2,7 @@
2
2
 
3
3
  // src/cli/db-reset.ts
4
4
  import { execSync } from "child_process";
5
- import * as dotenv from "dotenv";
6
5
  import * as readline from "readline";
7
-
8
- // src/cli/config.ts
9
- import * as fs from "fs";
10
- import * as path from "path";
11
- function findProjectRoot(currentDir) {
12
- if (fs.existsSync(path.join(currentDir, "package.json"))) {
13
- return currentDir;
14
- }
15
- const parentDir = path.dirname(currentDir);
16
- if (parentDir === currentDir) {
17
- throw new Error("Could not find package.json");
18
- }
19
- return findProjectRoot(parentDir);
20
- }
21
- function loadConfig(rootDir) {
22
- const projectRoot = rootDir || findProjectRoot(process.cwd());
23
- const configPath = path.join(projectRoot, "prisma-flare.config.json");
24
- let config3 = {
25
- modelsPath: "prisma/models",
26
- dbPath: "prisma/db",
27
- callbacksPath: "prisma/callbacks"
28
- };
29
- if (fs.existsSync(configPath)) {
30
- try {
31
- const configFile = fs.readFileSync(configPath, "utf-8");
32
- const userConfig = JSON.parse(configFile);
33
- config3 = { ...config3, ...userConfig };
34
- } catch {
35
- console.warn("\u26A0\uFE0F Could not read prisma-flare.config.json, using defaults.");
36
- }
37
- }
38
- return {
39
- ...config3
40
- };
41
- }
42
-
43
- // src/cli/db-reset.ts
44
- var config2 = loadConfig();
45
- dotenv.config({ path: config2.envPath });
46
6
  function confirm(question) {
47
7
  const rl = readline.createInterface({
48
8
  input: process.stdin,
@@ -1,70 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
- // If the importer is in node compatibility mode or this is not an ESM
19
- // file that has been converted to a CommonJS file using a Babel-
20
- // compatible transform (i.e. "__esModule" has not been set), then set
21
- // "default" to the CommonJS "module.exports" for node compatibility.
22
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
- mod
24
- ));
25
3
 
26
4
  // src/cli/db-seed.ts
27
5
  var import_child_process = require("child_process");
28
- var dotenv = __toESM(require("dotenv"), 1);
29
-
30
- // src/cli/config.ts
31
- var fs = __toESM(require("fs"), 1);
32
- var path = __toESM(require("path"), 1);
33
- function findProjectRoot(currentDir) {
34
- if (fs.existsSync(path.join(currentDir, "package.json"))) {
35
- return currentDir;
36
- }
37
- const parentDir = path.dirname(currentDir);
38
- if (parentDir === currentDir) {
39
- throw new Error("Could not find package.json");
40
- }
41
- return findProjectRoot(parentDir);
42
- }
43
- function loadConfig(rootDir) {
44
- const projectRoot = rootDir || findProjectRoot(process.cwd());
45
- const configPath = path.join(projectRoot, "prisma-flare.config.json");
46
- let config3 = {
47
- modelsPath: "prisma/models",
48
- dbPath: "prisma/db",
49
- callbacksPath: "prisma/callbacks"
50
- };
51
- if (fs.existsSync(configPath)) {
52
- try {
53
- const configFile = fs.readFileSync(configPath, "utf-8");
54
- const userConfig = JSON.parse(configFile);
55
- config3 = { ...config3, ...userConfig };
56
- } catch {
57
- console.warn("\u26A0\uFE0F Could not read prisma-flare.config.json, using defaults.");
58
- }
59
- }
60
- return {
61
- ...config3
62
- };
63
- }
64
-
65
- // src/cli/db-seed.ts
66
- var config2 = loadConfig();
67
- dotenv.config({ path: config2.envPath });
68
6
  function seedDatabase() {
69
7
  const databaseUrl = process.env.DATABASE_URL;
70
8
  if (!databaseUrl) {
@@ -2,46 +2,6 @@
2
2
 
3
3
  // src/cli/db-seed.ts
4
4
  import { execSync } from "child_process";
5
- import * as dotenv from "dotenv";
6
-
7
- // src/cli/config.ts
8
- import * as fs from "fs";
9
- import * as path from "path";
10
- function findProjectRoot(currentDir) {
11
- if (fs.existsSync(path.join(currentDir, "package.json"))) {
12
- return currentDir;
13
- }
14
- const parentDir = path.dirname(currentDir);
15
- if (parentDir === currentDir) {
16
- throw new Error("Could not find package.json");
17
- }
18
- return findProjectRoot(parentDir);
19
- }
20
- function loadConfig(rootDir) {
21
- const projectRoot = rootDir || findProjectRoot(process.cwd());
22
- const configPath = path.join(projectRoot, "prisma-flare.config.json");
23
- let config3 = {
24
- modelsPath: "prisma/models",
25
- dbPath: "prisma/db",
26
- callbacksPath: "prisma/callbacks"
27
- };
28
- if (fs.existsSync(configPath)) {
29
- try {
30
- const configFile = fs.readFileSync(configPath, "utf-8");
31
- const userConfig = JSON.parse(configFile);
32
- config3 = { ...config3, ...userConfig };
33
- } catch {
34
- console.warn("\u26A0\uFE0F Could not read prisma-flare.config.json, using defaults.");
35
- }
36
- }
37
- return {
38
- ...config3
39
- };
40
- }
41
-
42
- // src/cli/db-seed.ts
43
- var config2 = loadConfig();
44
- dotenv.config({ path: config2.envPath });
45
5
  function seedDatabase() {
46
6
  const databaseUrl = process.env.DATABASE_URL;
47
7
  if (!databaseUrl) {
@@ -83,7 +83,7 @@ function parseRelations(schemaContent, models) {
83
83
  if (fieldMatch) {
84
84
  const fieldName = fieldMatch[1];
85
85
  const fieldType = fieldMatch[2];
86
- const isArray = !!fieldMatch[3];
86
+ const _isArray = !!fieldMatch[3];
87
87
  if (models.includes(fieldType)) {
88
88
  const modelRelations = relations.get(modelName) || [];
89
89
  modelRelations.push({ fieldName, targetModel: fieldType });
@@ -185,7 +185,7 @@ export default class ${model} extends FlareBuilder<'${modelCamel}'> {
185
185
  registrationLines.push(`modelRegistry.register('${modelCamel}', ${model});`);
186
186
  registrationLines.push(`modelRegistry.register('${modelPlural}', ${model});`);
187
187
  });
188
- relations.forEach((rels, modelName) => {
188
+ relations.forEach((rels, _modelName) => {
189
189
  rels.forEach((rel) => {
190
190
  registrationLines.push(`modelRegistry.register('${rel.fieldName}', ${rel.targetModel});`);
191
191
  });
@@ -252,7 +252,7 @@ exports.DB = DB;
252
252
  relationMapEntries.push(` ${modelCamel}: ${model};`);
253
253
  relationMapEntries.push(` ${modelPlural}: ${model};`);
254
254
  });
255
- relations.forEach((rels, modelName) => {
255
+ relations.forEach((rels, _modelName) => {
256
256
  rels.forEach((rel) => {
257
257
  const entry = ` ${rel.fieldName}: ${rel.targetModel};`;
258
258
  if (!relationMapEntries.includes(entry)) {
@@ -283,15 +283,52 @@ ${gettersTypes}
283
283
  fs2.writeFileSync(generatedDtsPath, generatedDtsContent);
284
284
  }
285
285
 
286
+ // src/cli/generate-callbacks.ts
287
+ var fs3 = __toESM(require("fs"), 1);
288
+ var path3 = __toESM(require("path"), 1);
289
+ function generateCallbacksIndex() {
290
+ const rootDir = findProjectRoot(process.cwd());
291
+ const config = loadConfig(rootDir);
292
+ const callbacksDir = path3.join(rootDir, config.callbacksPath);
293
+ if (!fs3.existsSync(callbacksDir)) {
294
+ console.log(`\u2139\uFE0F Callbacks directory not found: ${callbacksDir}`);
295
+ return;
296
+ }
297
+ const files = fs3.readdirSync(callbacksDir);
298
+ const callbackFiles = files.filter((file) => {
299
+ if (file === "index.ts" || file === "index.js" || file.startsWith(".")) {
300
+ return false;
301
+ }
302
+ return file.endsWith(".ts") || file.endsWith(".js");
303
+ });
304
+ if (callbackFiles.length === 0) {
305
+ console.log(`\u2139\uFE0F No callback files found in: ${callbacksDir}`);
306
+ return;
307
+ }
308
+ const imports = callbackFiles.map((file) => {
309
+ const basename = file.replace(/\.(ts|js)$/, "");
310
+ return `import './${basename}';`;
311
+ }).join("\n");
312
+ const content = `// AUTO-GENERATED by prisma-flare - DO NOT EDIT
313
+ // This file imports all callbacks to ensure they are registered.
314
+ // Re-run 'npx prisma-flare generate' after adding new callback files.
315
+
316
+ ${imports}
317
+ `;
318
+ const indexPath = path3.join(callbacksDir, "index.ts");
319
+ fs3.writeFileSync(indexPath, content);
320
+ console.log(`\u2705 Generated callbacks index: ${callbacksDir}/index.ts (${callbackFiles.length} callbacks)`);
321
+ }
322
+
286
323
  // src/cli/index.ts
287
324
  var import_child_process = require("child_process");
288
- var path3 = __toESM(require("path"), 1);
289
- var fs3 = __toESM(require("fs"), 1);
325
+ var path4 = __toESM(require("path"), 1);
326
+ var fs4 = __toESM(require("fs"), 1);
290
327
  var import_url = require("url");
291
328
  var import_meta = {};
292
329
  var getDirname = () => {
293
330
  try {
294
- return path3.dirname((0, import_url.fileURLToPath)(import_meta.url));
331
+ return path4.dirname((0, import_url.fileURLToPath)(import_meta.url));
295
332
  } catch {
296
333
  return __dirname;
297
334
  }
@@ -313,6 +350,7 @@ if (!command) {
313
350
  switch (command) {
314
351
  case "generate":
315
352
  generateQueries();
353
+ generateCallbacksIndex();
316
354
  break;
317
355
  case "create":
318
356
  case "drop":
@@ -338,10 +376,10 @@ function runScript(scriptName) {
338
376
  console.error(`No script found for ${scriptName}`);
339
377
  return;
340
378
  }
341
- let scriptPath = path3.join(__dirname_, file.replace(".ts", ".js"));
342
- if (!fs3.existsSync(scriptPath)) {
343
- const cliScriptPath = path3.join(__dirname_, "cli", file.replace(".ts", ".js"));
344
- if (fs3.existsSync(cliScriptPath)) {
379
+ let scriptPath = path4.join(__dirname_, file.replace(".ts", ".js"));
380
+ if (!fs4.existsSync(scriptPath)) {
381
+ const cliScriptPath = path4.join(__dirname_, "cli", file.replace(".ts", ".js"));
382
+ if (fs4.existsSync(cliScriptPath)) {
345
383
  scriptPath = cliScriptPath;
346
384
  }
347
385
  }
package/dist/cli/index.js CHANGED
@@ -60,7 +60,7 @@ function parseRelations(schemaContent, models) {
60
60
  if (fieldMatch) {
61
61
  const fieldName = fieldMatch[1];
62
62
  const fieldType = fieldMatch[2];
63
- const isArray = !!fieldMatch[3];
63
+ const _isArray = !!fieldMatch[3];
64
64
  if (models.includes(fieldType)) {
65
65
  const modelRelations = relations.get(modelName) || [];
66
66
  modelRelations.push({ fieldName, targetModel: fieldType });
@@ -162,7 +162,7 @@ export default class ${model} extends FlareBuilder<'${modelCamel}'> {
162
162
  registrationLines.push(`modelRegistry.register('${modelCamel}', ${model});`);
163
163
  registrationLines.push(`modelRegistry.register('${modelPlural}', ${model});`);
164
164
  });
165
- relations.forEach((rels, modelName) => {
165
+ relations.forEach((rels, _modelName) => {
166
166
  rels.forEach((rel) => {
167
167
  registrationLines.push(`modelRegistry.register('${rel.fieldName}', ${rel.targetModel});`);
168
168
  });
@@ -229,7 +229,7 @@ exports.DB = DB;
229
229
  relationMapEntries.push(` ${modelCamel}: ${model};`);
230
230
  relationMapEntries.push(` ${modelPlural}: ${model};`);
231
231
  });
232
- relations.forEach((rels, modelName) => {
232
+ relations.forEach((rels, _modelName) => {
233
233
  rels.forEach((rel) => {
234
234
  const entry = ` ${rel.fieldName}: ${rel.targetModel};`;
235
235
  if (!relationMapEntries.includes(entry)) {
@@ -260,14 +260,51 @@ ${gettersTypes}
260
260
  fs2.writeFileSync(generatedDtsPath, generatedDtsContent);
261
261
  }
262
262
 
263
+ // src/cli/generate-callbacks.ts
264
+ import * as fs3 from "fs";
265
+ import * as path3 from "path";
266
+ function generateCallbacksIndex() {
267
+ const rootDir = findProjectRoot(process.cwd());
268
+ const config = loadConfig(rootDir);
269
+ const callbacksDir = path3.join(rootDir, config.callbacksPath);
270
+ if (!fs3.existsSync(callbacksDir)) {
271
+ console.log(`\u2139\uFE0F Callbacks directory not found: ${callbacksDir}`);
272
+ return;
273
+ }
274
+ const files = fs3.readdirSync(callbacksDir);
275
+ const callbackFiles = files.filter((file) => {
276
+ if (file === "index.ts" || file === "index.js" || file.startsWith(".")) {
277
+ return false;
278
+ }
279
+ return file.endsWith(".ts") || file.endsWith(".js");
280
+ });
281
+ if (callbackFiles.length === 0) {
282
+ console.log(`\u2139\uFE0F No callback files found in: ${callbacksDir}`);
283
+ return;
284
+ }
285
+ const imports = callbackFiles.map((file) => {
286
+ const basename = file.replace(/\.(ts|js)$/, "");
287
+ return `import './${basename}';`;
288
+ }).join("\n");
289
+ const content = `// AUTO-GENERATED by prisma-flare - DO NOT EDIT
290
+ // This file imports all callbacks to ensure they are registered.
291
+ // Re-run 'npx prisma-flare generate' after adding new callback files.
292
+
293
+ ${imports}
294
+ `;
295
+ const indexPath = path3.join(callbacksDir, "index.ts");
296
+ fs3.writeFileSync(indexPath, content);
297
+ console.log(`\u2705 Generated callbacks index: ${callbacksDir}/index.ts (${callbackFiles.length} callbacks)`);
298
+ }
299
+
263
300
  // src/cli/index.ts
264
301
  import { spawn } from "child_process";
265
- import * as path3 from "path";
266
- import * as fs3 from "fs";
302
+ import * as path4 from "path";
303
+ import * as fs4 from "fs";
267
304
  import { fileURLToPath } from "url";
268
305
  var getDirname = () => {
269
306
  try {
270
- return path3.dirname(fileURLToPath(import.meta.url));
307
+ return path4.dirname(fileURLToPath(import.meta.url));
271
308
  } catch {
272
309
  return __dirname;
273
310
  }
@@ -289,6 +326,7 @@ if (!command) {
289
326
  switch (command) {
290
327
  case "generate":
291
328
  generateQueries();
329
+ generateCallbacksIndex();
292
330
  break;
293
331
  case "create":
294
332
  case "drop":
@@ -314,10 +352,10 @@ function runScript(scriptName) {
314
352
  console.error(`No script found for ${scriptName}`);
315
353
  return;
316
354
  }
317
- let scriptPath = path3.join(__dirname_, file.replace(".ts", ".js"));
318
- if (!fs3.existsSync(scriptPath)) {
319
- const cliScriptPath = path3.join(__dirname_, "cli", file.replace(".ts", ".js"));
320
- if (fs3.existsSync(cliScriptPath)) {
355
+ let scriptPath = path4.join(__dirname_, file.replace(".ts", ".js"));
356
+ if (!fs4.existsSync(scriptPath)) {
357
+ const cliScriptPath = path4.join(__dirname_, "cli", file.replace(".ts", ".js"));
358
+ if (fs4.existsSync(cliScriptPath)) {
321
359
  scriptPath = cliScriptPath;
322
360
  }
323
361
  }
@@ -20,12 +20,12 @@ interface RelationModelMap {
20
20
  /**
21
21
  * Helper type to get the model class for a relation name
22
22
  */
23
- type GetRelationModel<K extends string> = K extends keyof RelationModelMap ? RelationModelMap[K] : FlareBuilder<any, {}>;
23
+ type GetRelationModel<K extends string> = K extends keyof RelationModelMap ? RelationModelMap[K] : FlareBuilder<any, Record<string, never>>;
24
24
  /**
25
25
  * FlareBuilder for chainable Prisma queries with full type safety
26
26
  * The type safety is enforced through the ModelDelegate parameter
27
27
  */
28
- declare class FlareBuilder<T extends ModelName, Args extends Record<string, any> = {}> {
28
+ declare class FlareBuilder<T extends ModelName, Args extends Record<string, any> = Record<string, never>> {
29
29
  protected model: ModelDelegate<T>;
30
30
  protected query: QueryArgs;
31
31
  constructor(model: ModelDelegate<T>, query?: QueryArgs);
@@ -122,7 +122,7 @@ declare class FlareBuilder<T extends ModelName, Args extends Record<string, any>
122
122
  * , 'OR')
123
123
  * .findMany()
124
124
  */
125
- whereGroup(callback: (builder: FlareBuilder<T, {}>) => FlareBuilder<T, any>, mode?: 'AND' | 'OR'): FlareBuilder<T, Args & {
125
+ whereGroup(callback: (builder: FlareBuilder<T, Record<string, never>>) => FlareBuilder<T, any>, mode?: 'AND' | 'OR'): FlareBuilder<T, Args & {
126
126
  where: WhereInput<T>;
127
127
  }>;
128
128
  /**
@@ -141,7 +141,7 @@ declare class FlareBuilder<T extends ModelName, Args extends Record<string, any>
141
141
  * )
142
142
  * .findMany()
143
143
  */
144
- orWhereGroup(callback: (builder: FlareBuilder<T, {}>) => FlareBuilder<T, any>): FlareBuilder<T, Args & {
144
+ orWhereGroup(callback: (builder: FlareBuilder<T, Record<string, never>>) => FlareBuilder<T, any>): FlareBuilder<T, Args & {
145
145
  where: WhereInput<T>;
146
146
  }>;
147
147
  /**
@@ -20,12 +20,12 @@ interface RelationModelMap {
20
20
  /**
21
21
  * Helper type to get the model class for a relation name
22
22
  */
23
- type GetRelationModel<K extends string> = K extends keyof RelationModelMap ? RelationModelMap[K] : FlareBuilder<any, {}>;
23
+ type GetRelationModel<K extends string> = K extends keyof RelationModelMap ? RelationModelMap[K] : FlareBuilder<any, Record<string, never>>;
24
24
  /**
25
25
  * FlareBuilder for chainable Prisma queries with full type safety
26
26
  * The type safety is enforced through the ModelDelegate parameter
27
27
  */
28
- declare class FlareBuilder<T extends ModelName, Args extends Record<string, any> = {}> {
28
+ declare class FlareBuilder<T extends ModelName, Args extends Record<string, any> = Record<string, never>> {
29
29
  protected model: ModelDelegate<T>;
30
30
  protected query: QueryArgs;
31
31
  constructor(model: ModelDelegate<T>, query?: QueryArgs);
@@ -122,7 +122,7 @@ declare class FlareBuilder<T extends ModelName, Args extends Record<string, any>
122
122
  * , 'OR')
123
123
  * .findMany()
124
124
  */
125
- whereGroup(callback: (builder: FlareBuilder<T, {}>) => FlareBuilder<T, any>, mode?: 'AND' | 'OR'): FlareBuilder<T, Args & {
125
+ whereGroup(callback: (builder: FlareBuilder<T, Record<string, never>>) => FlareBuilder<T, any>, mode?: 'AND' | 'OR'): FlareBuilder<T, Args & {
126
126
  where: WhereInput<T>;
127
127
  }>;
128
128
  /**
@@ -141,7 +141,7 @@ declare class FlareBuilder<T extends ModelName, Args extends Record<string, any>
141
141
  * )
142
142
  * .findMany()
143
143
  */
144
- orWhereGroup(callback: (builder: FlareBuilder<T, {}>) => FlareBuilder<T, any>): FlareBuilder<T, Args & {
144
+ orWhereGroup(callback: (builder: FlareBuilder<T, Record<string, never>>) => FlareBuilder<T, any>): FlareBuilder<T, Args & {
145
145
  where: WhereInput<T>;
146
146
  }>;
147
147
  /**