prisma-flare 1.1.2 → 1.1.4

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.
@@ -320,15 +320,186 @@ ${imports}
320
320
  console.log(`\u2705 Generated callbacks index: ${callbacksDir}/index.ts (${callbackFiles.length} callbacks)`);
321
321
  }
322
322
 
323
+ // src/cli/generate-client.ts
324
+ var fs5 = __toESM(require("fs"), 1);
325
+ var path5 = __toESM(require("path"), 1);
326
+
327
+ // src/cli/schema-parser.ts
328
+ var fs4 = __toESM(require("fs"), 1);
329
+ var path4 = __toESM(require("path"), 1);
330
+ function parseGeneratorClient(schemaContent) {
331
+ const generatorRegex = /generator\s+client\s*\{([^}]+)\}/s;
332
+ const match = schemaContent.match(generatorRegex);
333
+ if (!match) return null;
334
+ const blockContent = match[1];
335
+ const config = { provider: "prisma-client-js" };
336
+ const providerMatch = blockContent.match(/provider\s*=\s*["']([^"']+)["']/);
337
+ if (providerMatch) {
338
+ config.provider = providerMatch[1];
339
+ }
340
+ const outputMatch = blockContent.match(/output\s*=\s*["']([^"']+)["']/);
341
+ if (outputMatch) {
342
+ config.output = outputMatch[1];
343
+ }
344
+ return config;
345
+ }
346
+ function resolvePrismaClientPath(rootDir, output) {
347
+ if (!output) {
348
+ return "@prisma/client";
349
+ }
350
+ const schemaDir = path4.join(rootDir, "prisma");
351
+ const absolutePath = path4.resolve(schemaDir, output);
352
+ return absolutePath;
353
+ }
354
+ function getPrismaClientPath(rootDir) {
355
+ const schemaPath = path4.join(rootDir, "prisma", "schema.prisma");
356
+ if (!fs4.existsSync(schemaPath)) {
357
+ return "@prisma/client";
358
+ }
359
+ const schemaContent = fs4.readFileSync(schemaPath, "utf-8");
360
+ const config = parseGeneratorClient(schemaContent);
361
+ return resolvePrismaClientPath(rootDir, config?.output);
362
+ }
363
+ function hasCustomPrismaOutput(rootDir) {
364
+ const schemaPath = path4.join(rootDir, "prisma", "schema.prisma");
365
+ if (!fs4.existsSync(schemaPath)) {
366
+ return false;
367
+ }
368
+ const schemaContent = fs4.readFileSync(schemaPath, "utf-8");
369
+ const config = parseGeneratorClient(schemaContent);
370
+ return config?.output != null;
371
+ }
372
+
373
+ // src/cli/generate-client.ts
374
+ function generateClient() {
375
+ const rootDir = findProjectRoot(process.cwd());
376
+ const config = loadConfig(rootDir);
377
+ let prismaClientImport;
378
+ if (config.prismaClientPath) {
379
+ prismaClientImport = config.prismaClientPath;
380
+ } else {
381
+ prismaClientImport = getPrismaClientPath(rootDir);
382
+ }
383
+ const nodeModulesDir = path5.join(rootDir, "node_modules");
384
+ const prismaFlareDir = path5.join(nodeModulesDir, ".prisma-flare");
385
+ if (!fs5.existsSync(prismaFlareDir)) {
386
+ fs5.mkdirSync(prismaFlareDir, { recursive: true });
387
+ }
388
+ let resolvedImport;
389
+ if (prismaClientImport === "@prisma/client") {
390
+ resolvedImport = "@prisma/client";
391
+ } else {
392
+ resolvedImport = path5.relative(prismaFlareDir, prismaClientImport);
393
+ if (!resolvedImport.startsWith(".")) {
394
+ resolvedImport = "./" + resolvedImport;
395
+ }
396
+ resolvedImport = resolvedImport.replace(/\\/g, "/");
397
+ }
398
+ const isCustomOutput = hasCustomPrismaOutput(rootDir);
399
+ const esmContent = `// Generated by prisma-flare - DO NOT EDIT
400
+ // This file provides FlareClient configured for your Prisma client output path
401
+ // Import path: ${prismaClientImport}
402
+
403
+ import { PrismaClient, Prisma } from '${resolvedImport}';
404
+ import { createFlareClient } from 'prisma-flare';
405
+
406
+ // Create and export FlareClient using the factory
407
+ export const FlareClient = createFlareClient(PrismaClient, Prisma);
408
+
409
+ // Re-export PrismaClient and Prisma for convenience
410
+ export { PrismaClient, Prisma };
411
+ `;
412
+ const cjsContent = `// Generated by prisma-flare - DO NOT EDIT
413
+ // This file provides FlareClient configured for your Prisma client output path
414
+ // Import path: ${prismaClientImport}
415
+
416
+ const { PrismaClient, Prisma } = require('${resolvedImport}');
417
+ const { createFlareClient } = require('prisma-flare');
418
+
419
+ // Create FlareClient using the factory
420
+ const FlareClient = createFlareClient(PrismaClient, Prisma);
421
+
422
+ module.exports = {
423
+ FlareClient,
424
+ PrismaClient,
425
+ Prisma
426
+ };
427
+ `;
428
+ const dtsContent = `// Generated by prisma-flare - DO NOT EDIT
429
+ // This file provides FlareClient configured for your Prisma client output path
430
+
431
+ import { PrismaClient as BasePrismaClient, Prisma as BasePrisma } from '${resolvedImport}';
432
+ import type { FlareClientOptions } from 'prisma-flare';
433
+ import type { ModelName } from 'prisma-flare';
434
+ import type FlareBuilder from 'prisma-flare/flareBuilder';
435
+
436
+ // Re-export PrismaClient and Prisma from the configured path
437
+ export { BasePrismaClient as PrismaClient, BasePrisma as Prisma };
438
+
439
+ // FlareClient type that extends the project's PrismaClient
440
+ export declare class FlareClient extends BasePrismaClient {
441
+ constructor(options?: FlareClientOptions);
442
+
443
+ /**
444
+ * Creates a new FlareBuilder instance for the specified model.
445
+ * @param modelName - The name of the model.
446
+ * @returns FlareBuilder instance
447
+ */
448
+ from<T extends ModelName>(modelName: T): FlareBuilder<T>;
449
+
450
+ /**
451
+ * Executes a transaction with the FlareClient capabilities.
452
+ * @param fn - The transaction function.
453
+ * @param options - Transaction options.
454
+ * @returns The result of the transaction.
455
+ */
456
+ transaction<R>(
457
+ fn: (tx: FlareClient) => Promise<R>,
458
+ options?: { maxWait?: number; timeout?: number; isolationLevel?: any }
459
+ ): Promise<R>;
460
+ }
461
+ `;
462
+ fs5.writeFileSync(path5.join(prismaFlareDir, "index.js"), esmContent);
463
+ fs5.writeFileSync(path5.join(prismaFlareDir, "index.cjs"), cjsContent);
464
+ fs5.writeFileSync(path5.join(prismaFlareDir, "index.d.ts"), dtsContent);
465
+ const packageJson = {
466
+ name: ".prisma-flare",
467
+ version: "0.0.0",
468
+ main: "./index.cjs",
469
+ module: "./index.js",
470
+ types: "./index.d.ts",
471
+ type: "module",
472
+ exports: {
473
+ ".": {
474
+ types: "./index.d.ts",
475
+ import: "./index.js",
476
+ require: "./index.cjs"
477
+ }
478
+ }
479
+ };
480
+ fs5.writeFileSync(
481
+ path5.join(prismaFlareDir, "package.json"),
482
+ JSON.stringify(packageJson, null, 2)
483
+ );
484
+ if (isCustomOutput) {
485
+ console.log(`\u2705 Generated prisma-flare client with custom Prisma output: ${prismaClientImport}`);
486
+ } else {
487
+ console.log(`\u2705 Generated prisma-flare client using @prisma/client`);
488
+ }
489
+ console.log(` Location: ${prismaFlareDir}`);
490
+ console.log(`
491
+ Import: import { FlareClient } from 'prisma-flare/client';`);
492
+ }
493
+
323
494
  // src/cli/index.ts
324
495
  var import_child_process = require("child_process");
325
- var path4 = __toESM(require("path"), 1);
326
- var fs4 = __toESM(require("fs"), 1);
496
+ var path6 = __toESM(require("path"), 1);
497
+ var fs6 = __toESM(require("fs"), 1);
327
498
  var import_url = require("url");
328
499
  var import_meta = {};
329
500
  var getDirname = () => {
330
501
  try {
331
- return path4.dirname((0, import_url.fileURLToPath)(import_meta.url));
502
+ return path6.dirname((0, import_url.fileURLToPath)(import_meta.url));
332
503
  } catch {
333
504
  return __dirname;
334
505
  }
@@ -349,6 +520,7 @@ if (!command) {
349
520
  }
350
521
  switch (command) {
351
522
  case "generate":
523
+ generateClient();
352
524
  generateQueries();
353
525
  generateCallbacksIndex();
354
526
  break;
@@ -376,10 +548,10 @@ function runScript(scriptName) {
376
548
  console.error(`No script found for ${scriptName}`);
377
549
  return;
378
550
  }
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)) {
551
+ let scriptPath = path6.join(__dirname_, file.replace(".ts", ".js"));
552
+ if (!fs6.existsSync(scriptPath)) {
553
+ const cliScriptPath = path6.join(__dirname_, "cli", file.replace(".ts", ".js"));
554
+ if (fs6.existsSync(cliScriptPath)) {
383
555
  scriptPath = cliScriptPath;
384
556
  }
385
557
  }
package/dist/cli/index.js CHANGED
@@ -297,14 +297,185 @@ ${imports}
297
297
  console.log(`\u2705 Generated callbacks index: ${callbacksDir}/index.ts (${callbackFiles.length} callbacks)`);
298
298
  }
299
299
 
300
+ // src/cli/generate-client.ts
301
+ import * as fs5 from "fs";
302
+ import * as path5 from "path";
303
+
304
+ // src/cli/schema-parser.ts
305
+ import * as fs4 from "fs";
306
+ import * as path4 from "path";
307
+ function parseGeneratorClient(schemaContent) {
308
+ const generatorRegex = /generator\s+client\s*\{([^}]+)\}/s;
309
+ const match = schemaContent.match(generatorRegex);
310
+ if (!match) return null;
311
+ const blockContent = match[1];
312
+ const config = { provider: "prisma-client-js" };
313
+ const providerMatch = blockContent.match(/provider\s*=\s*["']([^"']+)["']/);
314
+ if (providerMatch) {
315
+ config.provider = providerMatch[1];
316
+ }
317
+ const outputMatch = blockContent.match(/output\s*=\s*["']([^"']+)["']/);
318
+ if (outputMatch) {
319
+ config.output = outputMatch[1];
320
+ }
321
+ return config;
322
+ }
323
+ function resolvePrismaClientPath(rootDir, output) {
324
+ if (!output) {
325
+ return "@prisma/client";
326
+ }
327
+ const schemaDir = path4.join(rootDir, "prisma");
328
+ const absolutePath = path4.resolve(schemaDir, output);
329
+ return absolutePath;
330
+ }
331
+ function getPrismaClientPath(rootDir) {
332
+ const schemaPath = path4.join(rootDir, "prisma", "schema.prisma");
333
+ if (!fs4.existsSync(schemaPath)) {
334
+ return "@prisma/client";
335
+ }
336
+ const schemaContent = fs4.readFileSync(schemaPath, "utf-8");
337
+ const config = parseGeneratorClient(schemaContent);
338
+ return resolvePrismaClientPath(rootDir, config?.output);
339
+ }
340
+ function hasCustomPrismaOutput(rootDir) {
341
+ const schemaPath = path4.join(rootDir, "prisma", "schema.prisma");
342
+ if (!fs4.existsSync(schemaPath)) {
343
+ return false;
344
+ }
345
+ const schemaContent = fs4.readFileSync(schemaPath, "utf-8");
346
+ const config = parseGeneratorClient(schemaContent);
347
+ return config?.output != null;
348
+ }
349
+
350
+ // src/cli/generate-client.ts
351
+ function generateClient() {
352
+ const rootDir = findProjectRoot(process.cwd());
353
+ const config = loadConfig(rootDir);
354
+ let prismaClientImport;
355
+ if (config.prismaClientPath) {
356
+ prismaClientImport = config.prismaClientPath;
357
+ } else {
358
+ prismaClientImport = getPrismaClientPath(rootDir);
359
+ }
360
+ const nodeModulesDir = path5.join(rootDir, "node_modules");
361
+ const prismaFlareDir = path5.join(nodeModulesDir, ".prisma-flare");
362
+ if (!fs5.existsSync(prismaFlareDir)) {
363
+ fs5.mkdirSync(prismaFlareDir, { recursive: true });
364
+ }
365
+ let resolvedImport;
366
+ if (prismaClientImport === "@prisma/client") {
367
+ resolvedImport = "@prisma/client";
368
+ } else {
369
+ resolvedImport = path5.relative(prismaFlareDir, prismaClientImport);
370
+ if (!resolvedImport.startsWith(".")) {
371
+ resolvedImport = "./" + resolvedImport;
372
+ }
373
+ resolvedImport = resolvedImport.replace(/\\/g, "/");
374
+ }
375
+ const isCustomOutput = hasCustomPrismaOutput(rootDir);
376
+ const esmContent = `// Generated by prisma-flare - DO NOT EDIT
377
+ // This file provides FlareClient configured for your Prisma client output path
378
+ // Import path: ${prismaClientImport}
379
+
380
+ import { PrismaClient, Prisma } from '${resolvedImport}';
381
+ import { createFlareClient } from 'prisma-flare';
382
+
383
+ // Create and export FlareClient using the factory
384
+ export const FlareClient = createFlareClient(PrismaClient, Prisma);
385
+
386
+ // Re-export PrismaClient and Prisma for convenience
387
+ export { PrismaClient, Prisma };
388
+ `;
389
+ const cjsContent = `// Generated by prisma-flare - DO NOT EDIT
390
+ // This file provides FlareClient configured for your Prisma client output path
391
+ // Import path: ${prismaClientImport}
392
+
393
+ const { PrismaClient, Prisma } = require('${resolvedImport}');
394
+ const { createFlareClient } = require('prisma-flare');
395
+
396
+ // Create FlareClient using the factory
397
+ const FlareClient = createFlareClient(PrismaClient, Prisma);
398
+
399
+ module.exports = {
400
+ FlareClient,
401
+ PrismaClient,
402
+ Prisma
403
+ };
404
+ `;
405
+ const dtsContent = `// Generated by prisma-flare - DO NOT EDIT
406
+ // This file provides FlareClient configured for your Prisma client output path
407
+
408
+ import { PrismaClient as BasePrismaClient, Prisma as BasePrisma } from '${resolvedImport}';
409
+ import type { FlareClientOptions } from 'prisma-flare';
410
+ import type { ModelName } from 'prisma-flare';
411
+ import type FlareBuilder from 'prisma-flare/flareBuilder';
412
+
413
+ // Re-export PrismaClient and Prisma from the configured path
414
+ export { BasePrismaClient as PrismaClient, BasePrisma as Prisma };
415
+
416
+ // FlareClient type that extends the project's PrismaClient
417
+ export declare class FlareClient extends BasePrismaClient {
418
+ constructor(options?: FlareClientOptions);
419
+
420
+ /**
421
+ * Creates a new FlareBuilder instance for the specified model.
422
+ * @param modelName - The name of the model.
423
+ * @returns FlareBuilder instance
424
+ */
425
+ from<T extends ModelName>(modelName: T): FlareBuilder<T>;
426
+
427
+ /**
428
+ * Executes a transaction with the FlareClient capabilities.
429
+ * @param fn - The transaction function.
430
+ * @param options - Transaction options.
431
+ * @returns The result of the transaction.
432
+ */
433
+ transaction<R>(
434
+ fn: (tx: FlareClient) => Promise<R>,
435
+ options?: { maxWait?: number; timeout?: number; isolationLevel?: any }
436
+ ): Promise<R>;
437
+ }
438
+ `;
439
+ fs5.writeFileSync(path5.join(prismaFlareDir, "index.js"), esmContent);
440
+ fs5.writeFileSync(path5.join(prismaFlareDir, "index.cjs"), cjsContent);
441
+ fs5.writeFileSync(path5.join(prismaFlareDir, "index.d.ts"), dtsContent);
442
+ const packageJson = {
443
+ name: ".prisma-flare",
444
+ version: "0.0.0",
445
+ main: "./index.cjs",
446
+ module: "./index.js",
447
+ types: "./index.d.ts",
448
+ type: "module",
449
+ exports: {
450
+ ".": {
451
+ types: "./index.d.ts",
452
+ import: "./index.js",
453
+ require: "./index.cjs"
454
+ }
455
+ }
456
+ };
457
+ fs5.writeFileSync(
458
+ path5.join(prismaFlareDir, "package.json"),
459
+ JSON.stringify(packageJson, null, 2)
460
+ );
461
+ if (isCustomOutput) {
462
+ console.log(`\u2705 Generated prisma-flare client with custom Prisma output: ${prismaClientImport}`);
463
+ } else {
464
+ console.log(`\u2705 Generated prisma-flare client using @prisma/client`);
465
+ }
466
+ console.log(` Location: ${prismaFlareDir}`);
467
+ console.log(`
468
+ Import: import { FlareClient } from 'prisma-flare/client';`);
469
+ }
470
+
300
471
  // src/cli/index.ts
301
472
  import { spawn } from "child_process";
302
- import * as path4 from "path";
303
- import * as fs4 from "fs";
473
+ import * as path6 from "path";
474
+ import * as fs6 from "fs";
304
475
  import { fileURLToPath } from "url";
305
476
  var getDirname = () => {
306
477
  try {
307
- return path4.dirname(fileURLToPath(import.meta.url));
478
+ return path6.dirname(fileURLToPath(import.meta.url));
308
479
  } catch {
309
480
  return __dirname;
310
481
  }
@@ -325,6 +496,7 @@ if (!command) {
325
496
  }
326
497
  switch (command) {
327
498
  case "generate":
499
+ generateClient();
328
500
  generateQueries();
329
501
  generateCallbacksIndex();
330
502
  break;
@@ -352,10 +524,10 @@ function runScript(scriptName) {
352
524
  console.error(`No script found for ${scriptName}`);
353
525
  return;
354
526
  }
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)) {
527
+ let scriptPath = path6.join(__dirname_, file.replace(".ts", ".js"));
528
+ if (!fs6.existsSync(scriptPath)) {
529
+ const cliScriptPath = path6.join(__dirname_, "cli", file.replace(".ts", ".js"));
530
+ if (fs6.existsSync(cliScriptPath)) {
359
531
  scriptPath = cliScriptPath;
360
532
  }
361
533
  }
@@ -87,7 +87,12 @@ var ModelRegistry = class {
87
87
  return Array.from(this.models.keys());
88
88
  }
89
89
  };
90
- var modelRegistry = new ModelRegistry();
90
+ var MODEL_REGISTRY_SYMBOL = /* @__PURE__ */ Symbol.for("prisma-flare.modelRegistry");
91
+ var globalObj = globalThis;
92
+ if (!globalObj[MODEL_REGISTRY_SYMBOL]) {
93
+ globalObj[MODEL_REGISTRY_SYMBOL] = new ModelRegistry();
94
+ }
95
+ var modelRegistry = globalObj[MODEL_REGISTRY_SYMBOL];
91
96
 
92
97
  // src/core/flareBuilder.ts
93
98
  function deepClone(obj) {
@@ -61,7 +61,12 @@ var ModelRegistry = class {
61
61
  return Array.from(this.models.keys());
62
62
  }
63
63
  };
64
- var modelRegistry = new ModelRegistry();
64
+ var MODEL_REGISTRY_SYMBOL = /* @__PURE__ */ Symbol.for("prisma-flare.modelRegistry");
65
+ var globalObj = globalThis;
66
+ if (!globalObj[MODEL_REGISTRY_SYMBOL]) {
67
+ globalObj[MODEL_REGISTRY_SYMBOL] = new ModelRegistry();
68
+ }
69
+ var modelRegistry = globalObj[MODEL_REGISTRY_SYMBOL];
65
70
 
66
71
  // src/core/flareBuilder.ts
67
72
  function deepClone(obj) {
@@ -199,7 +199,12 @@ var HookRegistry = class {
199
199
  this.config = { ...DEFAULT_CONFIG };
200
200
  }
201
201
  };
202
- var hookRegistry = new HookRegistry();
202
+ var HOOK_REGISTRY_SYMBOL = /* @__PURE__ */ Symbol.for("prisma-flare.hookRegistry");
203
+ var globalObj = globalThis;
204
+ if (!globalObj[HOOK_REGISTRY_SYMBOL]) {
205
+ globalObj[HOOK_REGISTRY_SYMBOL] = new HookRegistry();
206
+ }
207
+ var hookRegistry = globalObj[HOOK_REGISTRY_SYMBOL];
203
208
  var hookRegistry_default = hookRegistry;
204
209
 
205
210
  // src/core/hooks.ts
@@ -166,7 +166,12 @@ var HookRegistry = class {
166
166
  this.config = { ...DEFAULT_CONFIG };
167
167
  }
168
168
  };
169
- var hookRegistry = new HookRegistry();
169
+ var HOOK_REGISTRY_SYMBOL = /* @__PURE__ */ Symbol.for("prisma-flare.hookRegistry");
170
+ var globalObj = globalThis;
171
+ if (!globalObj[HOOK_REGISTRY_SYMBOL]) {
172
+ globalObj[HOOK_REGISTRY_SYMBOL] = new HookRegistry();
173
+ }
174
+ var hookRegistry = globalObj[HOOK_REGISTRY_SYMBOL];
170
175
  var hookRegistry_default = hookRegistry;
171
176
 
172
177
  // src/core/hooks.ts
package/dist/index.cjs CHANGED
@@ -30,9 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
- ExtendedPrismaClient: () => ExtendedPrismaClient,
34
33
  FlareBuilder: () => FlareBuilder,
35
- FlareClient: () => FlareClient,
34
+ FlareClient: () => import__.FlareClient,
35
+ Prisma: () => import__.Prisma,
36
+ PrismaClient: () => import__.PrismaClient,
36
37
  afterChange: () => afterChange,
37
38
  afterCreate: () => afterCreate,
38
39
  afterDelete: () => afterDelete,
@@ -50,9 +51,7 @@ __export(index_exports, {
50
51
  registerHooksLegacy: () => registerHooksLegacy
51
52
  });
52
53
  module.exports = __toCommonJS(index_exports);
53
-
54
- // src/core/extendedPrismaClient.ts
55
- var import_client2 = require("@prisma/client");
54
+ var import__ = require(".prisma-flare");
56
55
 
57
56
  // src/core/modelRegistry.ts
58
57
  var ModelRegistry = class {
@@ -117,7 +116,12 @@ var ModelRegistry = class {
117
116
  return Array.from(this.models.keys());
118
117
  }
119
118
  };
120
- var modelRegistry = new ModelRegistry();
119
+ var MODEL_REGISTRY_SYMBOL = /* @__PURE__ */ Symbol.for("prisma-flare.modelRegistry");
120
+ var globalObj = globalThis;
121
+ if (!globalObj[MODEL_REGISTRY_SYMBOL]) {
122
+ globalObj[MODEL_REGISTRY_SYMBOL] = new ModelRegistry();
123
+ }
124
+ var modelRegistry = globalObj[MODEL_REGISTRY_SYMBOL];
121
125
 
122
126
  // src/core/flareBuilder.ts
123
127
  function deepClone(obj) {
@@ -878,13 +882,47 @@ var HookRegistry = class {
878
882
  this.config = { ...DEFAULT_CONFIG };
879
883
  }
880
884
  };
881
- var hookRegistry = new HookRegistry();
885
+ var HOOK_REGISTRY_SYMBOL = /* @__PURE__ */ Symbol.for("prisma-flare.hookRegistry");
886
+ var globalObj2 = globalThis;
887
+ if (!globalObj2[HOOK_REGISTRY_SYMBOL]) {
888
+ globalObj2[HOOK_REGISTRY_SYMBOL] = new HookRegistry();
889
+ }
890
+ var hookRegistry = globalObj2[HOOK_REGISTRY_SYMBOL];
882
891
  var hookRegistry_default = hookRegistry;
883
892
 
893
+ // src/core/hooks.ts
894
+ function normalizeModelName(model) {
895
+ return model.toLowerCase();
896
+ }
897
+ function beforeCreate(model, callback) {
898
+ hookRegistry_default.addHook(normalizeModelName(model), "create", "before", callback);
899
+ }
900
+ function beforeDelete(model, callback) {
901
+ hookRegistry_default.addHook(normalizeModelName(model), "delete", "before", callback);
902
+ }
903
+ function afterCreate(model, callback) {
904
+ hookRegistry_default.addHook(normalizeModelName(model), "create", "after", callback);
905
+ }
906
+ function afterDelete(model, callback) {
907
+ hookRegistry_default.addHook(normalizeModelName(model), "delete", "after", callback);
908
+ }
909
+ function beforeUpdate(model, callback) {
910
+ hookRegistry_default.addHook(normalizeModelName(model), "update", "before", callback);
911
+ }
912
+ function afterUpdate(model, callback) {
913
+ hookRegistry_default.addHook(normalizeModelName(model), "update", "after", callback);
914
+ }
915
+ function afterChange(model, column, callback) {
916
+ hookRegistry_default.addColumnHook(normalizeModelName(model), column, callback);
917
+ }
918
+ function afterUpsert(model, callback) {
919
+ hookRegistry_default.addHook(normalizeModelName(model), "upsert", "after", callback);
920
+ }
921
+
884
922
  // src/core/hookMiddleware.ts
885
- var import_client = require("@prisma/client");
886
923
  var import_fs = __toESM(require("fs"), 1);
887
924
  var import_path = __toESM(require("path"), 1);
925
+ var _Prisma = null;
888
926
  function supportsTypeScriptImports() {
889
927
  if (process.env.TS_NODE || /* @__PURE__ */ Symbol.for("ts-node.register.instance") in process) {
890
928
  return true;
@@ -981,7 +1019,12 @@ function supportsPrisma6Middleware(prisma) {
981
1019
  return typeof prisma.$use === "function";
982
1020
  }
983
1021
  function createHooksExtension(basePrisma) {
984
- return import_client.Prisma.defineExtension({
1022
+ if (!_Prisma) {
1023
+ throw new Error(
1024
+ "Prisma namespace not initialized. Make sure to run `npx prisma-flare generate` first."
1025
+ );
1026
+ }
1027
+ return _Prisma.defineExtension({
985
1028
  name: "prisma-flare-hooks",
986
1029
  query: {
987
1030
  $allModels: {
@@ -1014,94 +1057,6 @@ function registerHooks(prisma) {
1014
1057
  }
1015
1058
  }
1016
1059
 
1017
- // src/core/extendedPrismaClient.ts
1018
- function supportsPrisma6Middleware2(prisma) {
1019
- return typeof prisma.$use === "function";
1020
- }
1021
- var FlareClient = class extends import_client2.PrismaClient {
1022
- constructor(options = {}) {
1023
- const { callbacks = true, ...prismaOptions } = options;
1024
- super(prismaOptions);
1025
- if (callbacks) {
1026
- if (supportsPrisma6Middleware2(this)) {
1027
- registerHooksLegacy(this);
1028
- } else {
1029
- const extension = createHooksExtension(this);
1030
- return this.$extends(extension);
1031
- }
1032
- }
1033
- }
1034
- /**
1035
- * Creates a new FlareBuilder instance for the specified model.
1036
- * @param modelName - The name of the model.
1037
- * @returns FlareBuilder instance
1038
- */
1039
- from(modelName) {
1040
- const key = modelName.charAt(0).toLowerCase() + modelName.slice(1);
1041
- const model = this[key];
1042
- if (!model) {
1043
- throw new Error(`Model ${modelName} does not exist on PrismaClient.`);
1044
- }
1045
- return new FlareBuilder(model);
1046
- }
1047
- /**
1048
- * Executes a transaction with the FlareClient capabilities.
1049
- * @param fn - The transaction function.
1050
- * @param options - Transaction options.
1051
- * @returns The result of the transaction.
1052
- */
1053
- async transaction(fn, options) {
1054
- return super.$transaction(async (tx) => {
1055
- const extendedTx = new Proxy(tx, {
1056
- get: (target, prop, receiver) => {
1057
- if (prop === "from") {
1058
- return (modelName) => {
1059
- const key = modelName.charAt(0).toLowerCase() + modelName.slice(1);
1060
- const model = target[key];
1061
- if (!model) {
1062
- throw new Error(`Model ${modelName} does not exist on TransactionClient.`);
1063
- }
1064
- return new FlareBuilder(model);
1065
- };
1066
- }
1067
- return Reflect.get(target, prop, receiver);
1068
- }
1069
- });
1070
- return fn(extendedTx);
1071
- }, options);
1072
- }
1073
- };
1074
- var ExtendedPrismaClient = FlareClient;
1075
-
1076
- // src/core/hooks.ts
1077
- function normalizeModelName(model) {
1078
- return model.toLowerCase();
1079
- }
1080
- function beforeCreate(model, callback) {
1081
- hookRegistry_default.addHook(normalizeModelName(model), "create", "before", callback);
1082
- }
1083
- function beforeDelete(model, callback) {
1084
- hookRegistry_default.addHook(normalizeModelName(model), "delete", "before", callback);
1085
- }
1086
- function afterCreate(model, callback) {
1087
- hookRegistry_default.addHook(normalizeModelName(model), "create", "after", callback);
1088
- }
1089
- function afterDelete(model, callback) {
1090
- hookRegistry_default.addHook(normalizeModelName(model), "delete", "after", callback);
1091
- }
1092
- function beforeUpdate(model, callback) {
1093
- hookRegistry_default.addHook(normalizeModelName(model), "update", "before", callback);
1094
- }
1095
- function afterUpdate(model, callback) {
1096
- hookRegistry_default.addHook(normalizeModelName(model), "update", "after", callback);
1097
- }
1098
- function afterChange(model, column, callback) {
1099
- hookRegistry_default.addColumnHook(normalizeModelName(model), column, callback);
1100
- }
1101
- function afterUpsert(model, callback) {
1102
- hookRegistry_default.addHook(normalizeModelName(model), "upsert", "after", callback);
1103
- }
1104
-
1105
1060
  // src/core/adapters/postgres.ts
1106
1061
  var PostgresAdapter = {
1107
1062
  name: "postgres",
@@ -1260,9 +1215,10 @@ registry.register(PostgresAdapter);
1260
1215
  registry.register(SqliteAdapter);
1261
1216
  // Annotate the CommonJS export names for ESM import in node:
1262
1217
  0 && (module.exports = {
1263
- ExtendedPrismaClient,
1264
1218
  FlareBuilder,
1265
1219
  FlareClient,
1220
+ Prisma,
1221
+ PrismaClient,
1266
1222
  afterChange,
1267
1223
  afterCreate,
1268
1224
  afterDelete,
package/dist/index.d.cts CHANGED
@@ -1,14 +1,19 @@
1
- import * as _prisma_client from '@prisma/client';
2
- import { PrismaClient } from '@prisma/client';
1
+ export { FlareClient, Prisma, PrismaClient } from '.prisma-flare';
3
2
  import * as _prisma_client_runtime_library from '@prisma/client/runtime/library';
4
- import { PrismaClientOptions, DriverAdapter } from '@prisma/client/runtime/library';
3
+ import { DriverAdapter } from '@prisma/client/runtime/library';
5
4
  import FlareBuilder from './core/flareBuilder.cjs';
6
5
  export { RelationModelMap } from './core/flareBuilder.cjs';
7
6
  import { M as ModelName, l as PrismaOperation, m as HookTiming, B as BeforeHookCallback, j as AfterHookCallback, k as ColumnChangeCallback } from './prisma.types-nGNe1CG8.cjs';
8
7
  export { r as AggregateResult, o as CreateArgs, C as CreateData, p as CreateManyArgs, b as CreateManyData, c as DeleteArgs, n as FindFirstArgs, F as FindManyArgs, a as ModelDelegate, R as RecordType, q as UpdateArgs, f as UpsertArgs } from './prisma.types-nGNe1CG8.cjs';
9
8
  export { afterChange, afterCreate, afterDelete, afterUpdate, afterUpsert, beforeCreate, beforeDelete, beforeUpdate } from './core/hooks.cjs';
9
+ import * as _prisma_client from '@prisma/client';
10
+ import { PrismaClient } from '@prisma/client';
10
11
 
11
- interface FlareClientOptions extends PrismaClientOptions {
12
+ /**
13
+ * Options for FlareClient created via the factory.
14
+ * Extends the standard PrismaClient options.
15
+ */
16
+ interface FactoryFlareClientOptions {
12
17
  /**
13
18
  * Enable callbacks/hooks middleware. When true (default), the middleware
14
19
  * that executes your registered callbacks (beforeCreate, afterUpdate, etc.)
@@ -22,31 +27,11 @@ interface FlareClientOptions extends PrismaClientOptions {
22
27
  * Pass an adapter instance (e.g., from @prisma/adapter-pg, @prisma/adapter-d1, etc.)
23
28
  */
24
29
  adapter?: DriverAdapter;
25
- }
26
- declare class FlareClient extends PrismaClient {
27
- constructor(options?: FlareClientOptions);
28
- /**
29
- * Creates a new FlareBuilder instance for the specified model.
30
- * @param modelName - The name of the model.
31
- * @returns FlareBuilder instance
32
- */
33
- from<T extends ModelName>(modelName: T): FlareBuilder<T>;
34
30
  /**
35
- * Executes a transaction with the FlareClient capabilities.
36
- * @param fn - The transaction function.
37
- * @param options - Transaction options.
38
- * @returns The result of the transaction.
31
+ * Any additional PrismaClient options are passed through
39
32
  */
40
- transaction<R>(fn: (tx: FlareClient) => Promise<R>, options?: {
41
- maxWait?: number;
42
- timeout?: number;
43
- isolationLevel?: any;
44
- }): Promise<R>;
33
+ [key: string]: unknown;
45
34
  }
46
- /**
47
- * @deprecated Use `FlareClient` instead. This alias will be removed in a future version.
48
- */
49
- declare const ExtendedPrismaClient: typeof FlareClient;
50
35
 
51
36
  type ModelClass<T extends ModelName = any> = new () => FlareBuilder<T, any>;
52
37
  /**
@@ -248,4 +233,4 @@ declare class AdapterRegistry {
248
233
  }
249
234
  declare const registry: AdapterRegistry;
250
235
 
251
- export { AfterHookCallback, BeforeHookCallback, ColumnChangeCallback, type DatabaseAdapter, ExtendedPrismaClient, FlareBuilder, FlareClient, type FlareClientOptions, type HookConfig, HookTiming, ModelName, PrismaOperation, createHooksExtension, registry as dbAdapterRegistry, hookRegistry, loadCallbacks, modelRegistry, registerHooks, registerHooksLegacy };
236
+ export { AfterHookCallback, BeforeHookCallback, ColumnChangeCallback, type DatabaseAdapter, FlareBuilder, type FactoryFlareClientOptions as FlareClientOptions, type HookConfig, HookTiming, ModelName, PrismaOperation, createHooksExtension, registry as dbAdapterRegistry, hookRegistry, loadCallbacks, modelRegistry, registerHooks, registerHooksLegacy };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,19 @@
1
- import * as _prisma_client from '@prisma/client';
2
- import { PrismaClient } from '@prisma/client';
1
+ export { FlareClient, Prisma, PrismaClient } from '.prisma-flare';
3
2
  import * as _prisma_client_runtime_library from '@prisma/client/runtime/library';
4
- import { PrismaClientOptions, DriverAdapter } from '@prisma/client/runtime/library';
3
+ import { DriverAdapter } from '@prisma/client/runtime/library';
5
4
  import FlareBuilder from './core/flareBuilder.js';
6
5
  export { RelationModelMap } from './core/flareBuilder.js';
7
6
  import { M as ModelName, l as PrismaOperation, m as HookTiming, B as BeforeHookCallback, j as AfterHookCallback, k as ColumnChangeCallback } from './prisma.types-nGNe1CG8.js';
8
7
  export { r as AggregateResult, o as CreateArgs, C as CreateData, p as CreateManyArgs, b as CreateManyData, c as DeleteArgs, n as FindFirstArgs, F as FindManyArgs, a as ModelDelegate, R as RecordType, q as UpdateArgs, f as UpsertArgs } from './prisma.types-nGNe1CG8.js';
9
8
  export { afterChange, afterCreate, afterDelete, afterUpdate, afterUpsert, beforeCreate, beforeDelete, beforeUpdate } from './core/hooks.js';
9
+ import * as _prisma_client from '@prisma/client';
10
+ import { PrismaClient } from '@prisma/client';
10
11
 
11
- interface FlareClientOptions extends PrismaClientOptions {
12
+ /**
13
+ * Options for FlareClient created via the factory.
14
+ * Extends the standard PrismaClient options.
15
+ */
16
+ interface FactoryFlareClientOptions {
12
17
  /**
13
18
  * Enable callbacks/hooks middleware. When true (default), the middleware
14
19
  * that executes your registered callbacks (beforeCreate, afterUpdate, etc.)
@@ -22,31 +27,11 @@ interface FlareClientOptions extends PrismaClientOptions {
22
27
  * Pass an adapter instance (e.g., from @prisma/adapter-pg, @prisma/adapter-d1, etc.)
23
28
  */
24
29
  adapter?: DriverAdapter;
25
- }
26
- declare class FlareClient extends PrismaClient {
27
- constructor(options?: FlareClientOptions);
28
- /**
29
- * Creates a new FlareBuilder instance for the specified model.
30
- * @param modelName - The name of the model.
31
- * @returns FlareBuilder instance
32
- */
33
- from<T extends ModelName>(modelName: T): FlareBuilder<T>;
34
30
  /**
35
- * Executes a transaction with the FlareClient capabilities.
36
- * @param fn - The transaction function.
37
- * @param options - Transaction options.
38
- * @returns The result of the transaction.
31
+ * Any additional PrismaClient options are passed through
39
32
  */
40
- transaction<R>(fn: (tx: FlareClient) => Promise<R>, options?: {
41
- maxWait?: number;
42
- timeout?: number;
43
- isolationLevel?: any;
44
- }): Promise<R>;
33
+ [key: string]: unknown;
45
34
  }
46
- /**
47
- * @deprecated Use `FlareClient` instead. This alias will be removed in a future version.
48
- */
49
- declare const ExtendedPrismaClient: typeof FlareClient;
50
35
 
51
36
  type ModelClass<T extends ModelName = any> = new () => FlareBuilder<T, any>;
52
37
  /**
@@ -248,4 +233,4 @@ declare class AdapterRegistry {
248
233
  }
249
234
  declare const registry: AdapterRegistry;
250
235
 
251
- export { AfterHookCallback, BeforeHookCallback, ColumnChangeCallback, type DatabaseAdapter, ExtendedPrismaClient, FlareBuilder, FlareClient, type FlareClientOptions, type HookConfig, HookTiming, ModelName, PrismaOperation, createHooksExtension, registry as dbAdapterRegistry, hookRegistry, loadCallbacks, modelRegistry, registerHooks, registerHooksLegacy };
236
+ export { AfterHookCallback, BeforeHookCallback, ColumnChangeCallback, type DatabaseAdapter, FlareBuilder, type FactoryFlareClientOptions as FlareClientOptions, type HookConfig, HookTiming, ModelName, PrismaOperation, createHooksExtension, registry as dbAdapterRegistry, hookRegistry, loadCallbacks, modelRegistry, registerHooks, registerHooksLegacy };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- // src/core/extendedPrismaClient.ts
2
- import { PrismaClient as PrismaClient2 } from "@prisma/client";
1
+ // src/index.ts
2
+ import { FlareClient, Prisma, PrismaClient } from ".prisma-flare";
3
3
 
4
4
  // src/core/modelRegistry.ts
5
5
  var ModelRegistry = class {
@@ -64,7 +64,12 @@ var ModelRegistry = class {
64
64
  return Array.from(this.models.keys());
65
65
  }
66
66
  };
67
- var modelRegistry = new ModelRegistry();
67
+ var MODEL_REGISTRY_SYMBOL = /* @__PURE__ */ Symbol.for("prisma-flare.modelRegistry");
68
+ var globalObj = globalThis;
69
+ if (!globalObj[MODEL_REGISTRY_SYMBOL]) {
70
+ globalObj[MODEL_REGISTRY_SYMBOL] = new ModelRegistry();
71
+ }
72
+ var modelRegistry = globalObj[MODEL_REGISTRY_SYMBOL];
68
73
 
69
74
  // src/core/flareBuilder.ts
70
75
  function deepClone(obj) {
@@ -825,13 +830,47 @@ var HookRegistry = class {
825
830
  this.config = { ...DEFAULT_CONFIG };
826
831
  }
827
832
  };
828
- var hookRegistry = new HookRegistry();
833
+ var HOOK_REGISTRY_SYMBOL = /* @__PURE__ */ Symbol.for("prisma-flare.hookRegistry");
834
+ var globalObj2 = globalThis;
835
+ if (!globalObj2[HOOK_REGISTRY_SYMBOL]) {
836
+ globalObj2[HOOK_REGISTRY_SYMBOL] = new HookRegistry();
837
+ }
838
+ var hookRegistry = globalObj2[HOOK_REGISTRY_SYMBOL];
829
839
  var hookRegistry_default = hookRegistry;
830
840
 
841
+ // src/core/hooks.ts
842
+ function normalizeModelName(model) {
843
+ return model.toLowerCase();
844
+ }
845
+ function beforeCreate(model, callback) {
846
+ hookRegistry_default.addHook(normalizeModelName(model), "create", "before", callback);
847
+ }
848
+ function beforeDelete(model, callback) {
849
+ hookRegistry_default.addHook(normalizeModelName(model), "delete", "before", callback);
850
+ }
851
+ function afterCreate(model, callback) {
852
+ hookRegistry_default.addHook(normalizeModelName(model), "create", "after", callback);
853
+ }
854
+ function afterDelete(model, callback) {
855
+ hookRegistry_default.addHook(normalizeModelName(model), "delete", "after", callback);
856
+ }
857
+ function beforeUpdate(model, callback) {
858
+ hookRegistry_default.addHook(normalizeModelName(model), "update", "before", callback);
859
+ }
860
+ function afterUpdate(model, callback) {
861
+ hookRegistry_default.addHook(normalizeModelName(model), "update", "after", callback);
862
+ }
863
+ function afterChange(model, column, callback) {
864
+ hookRegistry_default.addColumnHook(normalizeModelName(model), column, callback);
865
+ }
866
+ function afterUpsert(model, callback) {
867
+ hookRegistry_default.addHook(normalizeModelName(model), "upsert", "after", callback);
868
+ }
869
+
831
870
  // src/core/hookMiddleware.ts
832
- import { Prisma } from "@prisma/client";
833
871
  import fs from "fs";
834
872
  import path from "path";
873
+ var _Prisma = null;
835
874
  function supportsTypeScriptImports() {
836
875
  if (process.env.TS_NODE || /* @__PURE__ */ Symbol.for("ts-node.register.instance") in process) {
837
876
  return true;
@@ -928,7 +967,12 @@ function supportsPrisma6Middleware(prisma) {
928
967
  return typeof prisma.$use === "function";
929
968
  }
930
969
  function createHooksExtension(basePrisma) {
931
- return Prisma.defineExtension({
970
+ if (!_Prisma) {
971
+ throw new Error(
972
+ "Prisma namespace not initialized. Make sure to run `npx prisma-flare generate` first."
973
+ );
974
+ }
975
+ return _Prisma.defineExtension({
932
976
  name: "prisma-flare-hooks",
933
977
  query: {
934
978
  $allModels: {
@@ -961,94 +1005,6 @@ function registerHooks(prisma) {
961
1005
  }
962
1006
  }
963
1007
 
964
- // src/core/extendedPrismaClient.ts
965
- function supportsPrisma6Middleware2(prisma) {
966
- return typeof prisma.$use === "function";
967
- }
968
- var FlareClient = class extends PrismaClient2 {
969
- constructor(options = {}) {
970
- const { callbacks = true, ...prismaOptions } = options;
971
- super(prismaOptions);
972
- if (callbacks) {
973
- if (supportsPrisma6Middleware2(this)) {
974
- registerHooksLegacy(this);
975
- } else {
976
- const extension = createHooksExtension(this);
977
- return this.$extends(extension);
978
- }
979
- }
980
- }
981
- /**
982
- * Creates a new FlareBuilder instance for the specified model.
983
- * @param modelName - The name of the model.
984
- * @returns FlareBuilder instance
985
- */
986
- from(modelName) {
987
- const key = modelName.charAt(0).toLowerCase() + modelName.slice(1);
988
- const model = this[key];
989
- if (!model) {
990
- throw new Error(`Model ${modelName} does not exist on PrismaClient.`);
991
- }
992
- return new FlareBuilder(model);
993
- }
994
- /**
995
- * Executes a transaction with the FlareClient capabilities.
996
- * @param fn - The transaction function.
997
- * @param options - Transaction options.
998
- * @returns The result of the transaction.
999
- */
1000
- async transaction(fn, options) {
1001
- return super.$transaction(async (tx) => {
1002
- const extendedTx = new Proxy(tx, {
1003
- get: (target, prop, receiver) => {
1004
- if (prop === "from") {
1005
- return (modelName) => {
1006
- const key = modelName.charAt(0).toLowerCase() + modelName.slice(1);
1007
- const model = target[key];
1008
- if (!model) {
1009
- throw new Error(`Model ${modelName} does not exist on TransactionClient.`);
1010
- }
1011
- return new FlareBuilder(model);
1012
- };
1013
- }
1014
- return Reflect.get(target, prop, receiver);
1015
- }
1016
- });
1017
- return fn(extendedTx);
1018
- }, options);
1019
- }
1020
- };
1021
- var ExtendedPrismaClient = FlareClient;
1022
-
1023
- // src/core/hooks.ts
1024
- function normalizeModelName(model) {
1025
- return model.toLowerCase();
1026
- }
1027
- function beforeCreate(model, callback) {
1028
- hookRegistry_default.addHook(normalizeModelName(model), "create", "before", callback);
1029
- }
1030
- function beforeDelete(model, callback) {
1031
- hookRegistry_default.addHook(normalizeModelName(model), "delete", "before", callback);
1032
- }
1033
- function afterCreate(model, callback) {
1034
- hookRegistry_default.addHook(normalizeModelName(model), "create", "after", callback);
1035
- }
1036
- function afterDelete(model, callback) {
1037
- hookRegistry_default.addHook(normalizeModelName(model), "delete", "after", callback);
1038
- }
1039
- function beforeUpdate(model, callback) {
1040
- hookRegistry_default.addHook(normalizeModelName(model), "update", "before", callback);
1041
- }
1042
- function afterUpdate(model, callback) {
1043
- hookRegistry_default.addHook(normalizeModelName(model), "update", "after", callback);
1044
- }
1045
- function afterChange(model, column, callback) {
1046
- hookRegistry_default.addColumnHook(normalizeModelName(model), column, callback);
1047
- }
1048
- function afterUpsert(model, callback) {
1049
- hookRegistry_default.addHook(normalizeModelName(model), "upsert", "after", callback);
1050
- }
1051
-
1052
1008
  // src/core/adapters/postgres.ts
1053
1009
  var PostgresAdapter = {
1054
1010
  name: "postgres",
@@ -1206,9 +1162,10 @@ var registry = new AdapterRegistry();
1206
1162
  registry.register(PostgresAdapter);
1207
1163
  registry.register(SqliteAdapter);
1208
1164
  export {
1209
- ExtendedPrismaClient,
1210
1165
  FlareBuilder,
1211
1166
  FlareClient,
1167
+ Prisma,
1168
+ PrismaClient,
1212
1169
  afterChange,
1213
1170
  afterCreate,
1214
1171
  afterDelete,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-flare",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Prisma utilities package with callback system and query builder for chained operations",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
package/readme.md CHANGED
@@ -147,6 +147,28 @@ Example with custom plurals:
147
147
  }
148
148
  ```
149
149
 
150
+ ### Custom Prisma Output Path
151
+
152
+ If you use a custom `output` in your Prisma schema, prisma-flare automatically detects and supports it:
153
+
154
+ ```prisma
155
+ // schema.prisma
156
+ generator client {
157
+ provider = "prisma-client-js"
158
+ output = "./generated/client" // Custom output path
159
+ }
160
+ ```
161
+
162
+ Just run `npx prisma-flare generate` - it parses your `schema.prisma` and configures everything automatically. No extra configuration needed.
163
+
164
+ **Manual override:** If auto-detection doesn't work, add to `prisma-flare.config.json`:
165
+
166
+ ```json
167
+ {
168
+ "prismaClientPath": "./src/generated/prisma"
169
+ }
170
+ ```
171
+
150
172
  ## Usage
151
173
 
152
174
  ### Flare Builder