prisma-flare 1.1.3 → 1.1.5

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.
@@ -1,2 +1 @@
1
1
  #!/usr/bin/env node
2
- import '.prisma-flare';
@@ -1,2 +1 @@
1
1
  #!/usr/bin/env node
2
- import '.prisma-flare';
@@ -488,7 +488,7 @@ export declare class FlareClient extends BasePrismaClient {
488
488
  }
489
489
  console.log(` Location: ${prismaFlareDir}`);
490
490
  console.log(`
491
- Import: import { FlareClient } from 'prisma-flare/client';`);
491
+ Import: import { FlareClient } from 'prisma-flare';`);
492
492
  }
493
493
 
494
494
  // src/cli/index.ts
package/dist/cli/index.js CHANGED
@@ -465,7 +465,7 @@ export declare class FlareClient extends BasePrismaClient {
465
465
  }
466
466
  console.log(` Location: ${prismaFlareDir}`);
467
467
  console.log(`
468
- Import: import { FlareClient } from 'prisma-flare/client';`);
468
+ Import: import { FlareClient } from 'prisma-flare';`);
469
469
  }
470
470
 
471
471
  // src/cli/index.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,
@@ -51,9 +52,7 @@ __export(index_exports, {
51
52
  registerHooksLegacy: () => registerHooksLegacy
52
53
  });
53
54
  module.exports = __toCommonJS(index_exports);
54
-
55
- // src/core/extendedPrismaClient.ts
56
- var import_client2 = require("@prisma/client");
55
+ var import__ = require(".prisma-flare");
57
56
 
58
57
  // src/core/modelRegistry.ts
59
58
  var ModelRegistry = class {
@@ -893,9 +892,12 @@ var hookRegistry = globalObj2[HOOK_REGISTRY_SYMBOL];
893
892
  var hookRegistry_default = hookRegistry;
894
893
 
895
894
  // src/core/hookMiddleware.ts
896
- var import_client = require("@prisma/client");
897
895
  var import_fs = __toESM(require("fs"), 1);
898
896
  var import_path = __toESM(require("path"), 1);
897
+ var _Prisma = null;
898
+ function setPrismaNamespace(prisma) {
899
+ _Prisma = prisma;
900
+ }
899
901
  function supportsTypeScriptImports() {
900
902
  if (process.env.TS_NODE || /* @__PURE__ */ Symbol.for("ts-node.register.instance") in process) {
901
903
  return true;
@@ -992,7 +994,12 @@ function supportsPrisma6Middleware(prisma) {
992
994
  return typeof prisma.$use === "function";
993
995
  }
994
996
  function createHooksExtension(basePrisma) {
995
- return import_client.Prisma.defineExtension({
997
+ if (!_Prisma) {
998
+ throw new Error(
999
+ "Prisma namespace not initialized. Make sure to run `npx prisma-flare generate` first."
1000
+ );
1001
+ }
1002
+ return _Prisma.defineExtension({
996
1003
  name: "prisma-flare-hooks",
997
1004
  query: {
998
1005
  $allModels: {
@@ -1025,76 +1032,20 @@ function registerHooks(prisma) {
1025
1032
  }
1026
1033
  }
1027
1034
 
1028
- // src/core/extendedPrismaClient.ts
1035
+ // src/core/createFlareClient.ts
1029
1036
  function supportsPrisma6Middleware2(prisma) {
1030
1037
  return typeof prisma.$use === "function";
1031
1038
  }
1032
- var FlareClient = class extends import_client2.PrismaClient {
1033
- constructor(options = {}) {
1034
- const { callbacks = true, ...prismaOptions } = options;
1035
- super(prismaOptions);
1036
- if (callbacks) {
1037
- if (supportsPrisma6Middleware2(this)) {
1038
- registerHooksLegacy(this);
1039
- } else {
1040
- const extension = createHooksExtension(this);
1041
- return this.$extends(extension);
1042
- }
1043
- }
1044
- }
1045
- /**
1046
- * Creates a new FlareBuilder instance for the specified model.
1047
- * @param modelName - The name of the model.
1048
- * @returns FlareBuilder instance
1049
- */
1050
- from(modelName) {
1051
- const key = modelName.charAt(0).toLowerCase() + modelName.slice(1);
1052
- const model = this[key];
1053
- if (!model) {
1054
- throw new Error(`Model ${modelName} does not exist on PrismaClient.`);
1055
- }
1056
- return new FlareBuilder(model);
1039
+ function createFlareClient(BasePrismaClient, PrismaNamespaceArg) {
1040
+ if (PrismaNamespaceArg) {
1041
+ setPrismaNamespace(PrismaNamespaceArg);
1057
1042
  }
1058
- /**
1059
- * Executes a transaction with the FlareClient capabilities.
1060
- * @param fn - The transaction function.
1061
- * @param options - Transaction options.
1062
- * @returns The result of the transaction.
1063
- */
1064
- async transaction(fn, options) {
1065
- return super.$transaction(async (tx) => {
1066
- const extendedTx = new Proxy(tx, {
1067
- get: (target, prop, receiver) => {
1068
- if (prop === "from") {
1069
- return (modelName) => {
1070
- const key = modelName.charAt(0).toLowerCase() + modelName.slice(1);
1071
- const model = target[key];
1072
- if (!model) {
1073
- throw new Error(`Model ${modelName} does not exist on TransactionClient.`);
1074
- }
1075
- return new FlareBuilder(model);
1076
- };
1077
- }
1078
- return Reflect.get(target, prop, receiver);
1079
- }
1080
- });
1081
- return fn(extendedTx);
1082
- }, options);
1083
- }
1084
- };
1085
- var ExtendedPrismaClient = FlareClient;
1086
-
1087
- // src/core/createFlareClient.ts
1088
- function supportsPrisma6Middleware3(prisma) {
1089
- return typeof prisma.$use === "function";
1090
- }
1091
- function createFlareClient(BasePrismaClient, _PrismaNamespace) {
1092
1043
  const FlareClientImpl = class extends BasePrismaClient {
1093
1044
  constructor(options = {}) {
1094
1045
  const { callbacks = true, ...prismaOptions } = options;
1095
1046
  super(prismaOptions);
1096
1047
  if (callbacks) {
1097
- if (supportsPrisma6Middleware3(this)) {
1048
+ if (supportsPrisma6Middleware2(this)) {
1098
1049
  registerHooksLegacy(this);
1099
1050
  } else {
1100
1051
  const extension = createHooksExtension(this);
@@ -1332,9 +1283,10 @@ registry.register(PostgresAdapter);
1332
1283
  registry.register(SqliteAdapter);
1333
1284
  // Annotate the CommonJS export names for ESM import in node:
1334
1285
  0 && (module.exports = {
1335
- ExtendedPrismaClient,
1336
1286
  FlareBuilder,
1337
1287
  FlareClient,
1288
+ Prisma,
1289
+ PrismaClient,
1338
1290
  afterChange,
1339
1291
  afterCreate,
1340
1292
  afterDelete,
package/dist/index.d.cts CHANGED
@@ -1,53 +1,14 @@
1
+ export { FlareClient, Prisma, PrismaClient } from '.prisma-flare';
1
2
  import * as _prisma_client from '@prisma/client';
2
3
  import { PrismaClient } from '@prisma/client';
3
4
  import * as _prisma_client_runtime_library from '@prisma/client/runtime/library';
4
- import { PrismaClientOptions, DriverAdapter } from '@prisma/client/runtime/library';
5
+ import { DriverAdapter } from '@prisma/client/runtime/library';
5
6
  import FlareBuilder from './core/flareBuilder.cjs';
6
7
  export { RelationModelMap } from './core/flareBuilder.cjs';
7
8
  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
9
  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
10
  export { afterChange, afterCreate, afterDelete, afterUpdate, afterUpsert, beforeCreate, beforeDelete, beforeUpdate } from './core/hooks.cjs';
10
11
 
11
- interface FlareClientOptions extends PrismaClientOptions {
12
- /**
13
- * Enable callbacks/hooks middleware. When true (default), the middleware
14
- * that executes your registered callbacks (beforeCreate, afterUpdate, etc.)
15
- * is automatically attached.
16
- *
17
- * @default true
18
- */
19
- callbacks?: boolean;
20
- /**
21
- * Driver adapter for serverless/edge environments.
22
- * Pass an adapter instance (e.g., from @prisma/adapter-pg, @prisma/adapter-d1, etc.)
23
- */
24
- 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
- /**
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.
39
- */
40
- transaction<R>(fn: (tx: FlareClient) => Promise<R>, options?: {
41
- maxWait?: number;
42
- timeout?: number;
43
- isolationLevel?: any;
44
- }): Promise<R>;
45
- }
46
- /**
47
- * @deprecated Use `FlareClient` instead. This alias will be removed in a future version.
48
- */
49
- declare const ExtendedPrismaClient: typeof FlareClient;
50
-
51
12
  /**
52
13
  * Options for FlareClient created via the factory.
53
14
  * Extends the standard PrismaClient options.
@@ -117,7 +78,7 @@ interface FlareClientInstance extends PrismaClient {
117
78
  * const FlareClient = createFlareClient(PrismaClient, Prisma);
118
79
  * export const db = new FlareClient();
119
80
  */
120
- declare function createFlareClient(BasePrismaClient: PrismaClientLike, _PrismaNamespace?: PrismaNamespace): FlareClientClass;
81
+ declare function createFlareClient(BasePrismaClient: PrismaClientLike, PrismaNamespaceArg?: PrismaNamespace): FlareClientClass;
121
82
 
122
83
  type ModelClass<T extends ModelName = any> = new () => FlareBuilder<T, any>;
123
84
  /**
@@ -319,4 +280,4 @@ declare class AdapterRegistry {
319
280
  }
320
281
  declare const registry: AdapterRegistry;
321
282
 
322
- export { AfterHookCallback, BeforeHookCallback, ColumnChangeCallback, type DatabaseAdapter, ExtendedPrismaClient, type FactoryFlareClientOptions, FlareBuilder, FlareClient, type FlareClientClass, type FlareClientInstance, type FlareClientOptions, type HookConfig, HookTiming, ModelName, type PrismaClientLike, type PrismaNamespace, PrismaOperation, createFlareClient, createHooksExtension, registry as dbAdapterRegistry, hookRegistry, loadCallbacks, modelRegistry, registerHooks, registerHooksLegacy };
283
+ export { AfterHookCallback, BeforeHookCallback, ColumnChangeCallback, type DatabaseAdapter, FlareBuilder, type FactoryFlareClientOptions as FlareClientOptions, type HookConfig, HookTiming, ModelName, PrismaOperation, createFlareClient, createHooksExtension, registry as dbAdapterRegistry, hookRegistry, loadCallbacks, modelRegistry, registerHooks, registerHooksLegacy };
package/dist/index.d.ts CHANGED
@@ -1,53 +1,14 @@
1
+ export { FlareClient, Prisma, PrismaClient } from '.prisma-flare';
1
2
  import * as _prisma_client from '@prisma/client';
2
3
  import { PrismaClient } from '@prisma/client';
3
4
  import * as _prisma_client_runtime_library from '@prisma/client/runtime/library';
4
- import { PrismaClientOptions, DriverAdapter } from '@prisma/client/runtime/library';
5
+ import { DriverAdapter } from '@prisma/client/runtime/library';
5
6
  import FlareBuilder from './core/flareBuilder.js';
6
7
  export { RelationModelMap } from './core/flareBuilder.js';
7
8
  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
9
  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
10
  export { afterChange, afterCreate, afterDelete, afterUpdate, afterUpsert, beforeCreate, beforeDelete, beforeUpdate } from './core/hooks.js';
10
11
 
11
- interface FlareClientOptions extends PrismaClientOptions {
12
- /**
13
- * Enable callbacks/hooks middleware. When true (default), the middleware
14
- * that executes your registered callbacks (beforeCreate, afterUpdate, etc.)
15
- * is automatically attached.
16
- *
17
- * @default true
18
- */
19
- callbacks?: boolean;
20
- /**
21
- * Driver adapter for serverless/edge environments.
22
- * Pass an adapter instance (e.g., from @prisma/adapter-pg, @prisma/adapter-d1, etc.)
23
- */
24
- 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
- /**
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.
39
- */
40
- transaction<R>(fn: (tx: FlareClient) => Promise<R>, options?: {
41
- maxWait?: number;
42
- timeout?: number;
43
- isolationLevel?: any;
44
- }): Promise<R>;
45
- }
46
- /**
47
- * @deprecated Use `FlareClient` instead. This alias will be removed in a future version.
48
- */
49
- declare const ExtendedPrismaClient: typeof FlareClient;
50
-
51
12
  /**
52
13
  * Options for FlareClient created via the factory.
53
14
  * Extends the standard PrismaClient options.
@@ -117,7 +78,7 @@ interface FlareClientInstance extends PrismaClient {
117
78
  * const FlareClient = createFlareClient(PrismaClient, Prisma);
118
79
  * export const db = new FlareClient();
119
80
  */
120
- declare function createFlareClient(BasePrismaClient: PrismaClientLike, _PrismaNamespace?: PrismaNamespace): FlareClientClass;
81
+ declare function createFlareClient(BasePrismaClient: PrismaClientLike, PrismaNamespaceArg?: PrismaNamespace): FlareClientClass;
121
82
 
122
83
  type ModelClass<T extends ModelName = any> = new () => FlareBuilder<T, any>;
123
84
  /**
@@ -319,4 +280,4 @@ declare class AdapterRegistry {
319
280
  }
320
281
  declare const registry: AdapterRegistry;
321
282
 
322
- export { AfterHookCallback, BeforeHookCallback, ColumnChangeCallback, type DatabaseAdapter, ExtendedPrismaClient, type FactoryFlareClientOptions, FlareBuilder, FlareClient, type FlareClientClass, type FlareClientInstance, type FlareClientOptions, type HookConfig, HookTiming, ModelName, type PrismaClientLike, type PrismaNamespace, PrismaOperation, createFlareClient, createHooksExtension, registry as dbAdapterRegistry, hookRegistry, loadCallbacks, modelRegistry, registerHooks, registerHooksLegacy };
283
+ export { AfterHookCallback, BeforeHookCallback, ColumnChangeCallback, type DatabaseAdapter, FlareBuilder, type FactoryFlareClientOptions as FlareClientOptions, type HookConfig, HookTiming, ModelName, PrismaOperation, createFlareClient, 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 {
@@ -839,9 +839,12 @@ var hookRegistry = globalObj2[HOOK_REGISTRY_SYMBOL];
839
839
  var hookRegistry_default = hookRegistry;
840
840
 
841
841
  // src/core/hookMiddleware.ts
842
- import { Prisma } from "@prisma/client";
843
842
  import fs from "fs";
844
843
  import path from "path";
844
+ var _Prisma = null;
845
+ function setPrismaNamespace(prisma) {
846
+ _Prisma = prisma;
847
+ }
845
848
  function supportsTypeScriptImports() {
846
849
  if (process.env.TS_NODE || /* @__PURE__ */ Symbol.for("ts-node.register.instance") in process) {
847
850
  return true;
@@ -938,7 +941,12 @@ function supportsPrisma6Middleware(prisma) {
938
941
  return typeof prisma.$use === "function";
939
942
  }
940
943
  function createHooksExtension(basePrisma) {
941
- return Prisma.defineExtension({
944
+ if (!_Prisma) {
945
+ throw new Error(
946
+ "Prisma namespace not initialized. Make sure to run `npx prisma-flare generate` first."
947
+ );
948
+ }
949
+ return _Prisma.defineExtension({
942
950
  name: "prisma-flare-hooks",
943
951
  query: {
944
952
  $allModels: {
@@ -971,76 +979,20 @@ function registerHooks(prisma) {
971
979
  }
972
980
  }
973
981
 
974
- // src/core/extendedPrismaClient.ts
982
+ // src/core/createFlareClient.ts
975
983
  function supportsPrisma6Middleware2(prisma) {
976
984
  return typeof prisma.$use === "function";
977
985
  }
978
- var FlareClient = class extends PrismaClient2 {
979
- constructor(options = {}) {
980
- const { callbacks = true, ...prismaOptions } = options;
981
- super(prismaOptions);
982
- if (callbacks) {
983
- if (supportsPrisma6Middleware2(this)) {
984
- registerHooksLegacy(this);
985
- } else {
986
- const extension = createHooksExtension(this);
987
- return this.$extends(extension);
988
- }
989
- }
990
- }
991
- /**
992
- * Creates a new FlareBuilder instance for the specified model.
993
- * @param modelName - The name of the model.
994
- * @returns FlareBuilder instance
995
- */
996
- from(modelName) {
997
- const key = modelName.charAt(0).toLowerCase() + modelName.slice(1);
998
- const model = this[key];
999
- if (!model) {
1000
- throw new Error(`Model ${modelName} does not exist on PrismaClient.`);
1001
- }
1002
- return new FlareBuilder(model);
986
+ function createFlareClient(BasePrismaClient, PrismaNamespaceArg) {
987
+ if (PrismaNamespaceArg) {
988
+ setPrismaNamespace(PrismaNamespaceArg);
1003
989
  }
1004
- /**
1005
- * Executes a transaction with the FlareClient capabilities.
1006
- * @param fn - The transaction function.
1007
- * @param options - Transaction options.
1008
- * @returns The result of the transaction.
1009
- */
1010
- async transaction(fn, options) {
1011
- return super.$transaction(async (tx) => {
1012
- const extendedTx = new Proxy(tx, {
1013
- get: (target, prop, receiver) => {
1014
- if (prop === "from") {
1015
- return (modelName) => {
1016
- const key = modelName.charAt(0).toLowerCase() + modelName.slice(1);
1017
- const model = target[key];
1018
- if (!model) {
1019
- throw new Error(`Model ${modelName} does not exist on TransactionClient.`);
1020
- }
1021
- return new FlareBuilder(model);
1022
- };
1023
- }
1024
- return Reflect.get(target, prop, receiver);
1025
- }
1026
- });
1027
- return fn(extendedTx);
1028
- }, options);
1029
- }
1030
- };
1031
- var ExtendedPrismaClient = FlareClient;
1032
-
1033
- // src/core/createFlareClient.ts
1034
- function supportsPrisma6Middleware3(prisma) {
1035
- return typeof prisma.$use === "function";
1036
- }
1037
- function createFlareClient(BasePrismaClient, _PrismaNamespace) {
1038
990
  const FlareClientImpl = class extends BasePrismaClient {
1039
991
  constructor(options = {}) {
1040
992
  const { callbacks = true, ...prismaOptions } = options;
1041
993
  super(prismaOptions);
1042
994
  if (callbacks) {
1043
- if (supportsPrisma6Middleware3(this)) {
995
+ if (supportsPrisma6Middleware2(this)) {
1044
996
  registerHooksLegacy(this);
1045
997
  } else {
1046
998
  const extension = createHooksExtension(this);
@@ -1277,9 +1229,10 @@ var registry = new AdapterRegistry();
1277
1229
  registry.register(PostgresAdapter);
1278
1230
  registry.register(SqliteAdapter);
1279
1231
  export {
1280
- ExtendedPrismaClient,
1281
1232
  FlareBuilder,
1282
1233
  FlareClient,
1234
+ Prisma,
1235
+ PrismaClient,
1283
1236
  afterChange,
1284
1237
  afterCreate,
1285
1238
  afterDelete,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-flare",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
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",
@@ -78,11 +78,6 @@
78
78
  "import": "./dist/index.js",
79
79
  "require": "./dist/index.cjs"
80
80
  },
81
- "./client": {
82
- "types": "./dist/client/index.d.ts",
83
- "import": "./dist/client/index.js",
84
- "require": "./dist/client/index.cjs"
85
- },
86
81
  "./generated": {
87
82
  "types": "./dist/generated.d.ts",
88
83
  "import": "./dist/generated.js",
@@ -101,9 +96,6 @@
101
96
  },
102
97
  "typesVersions": {
103
98
  "*": {
104
- "client": [
105
- "./dist/client/index.d.ts"
106
- ],
107
99
  "generated": [
108
100
  "./dist/generated.d.ts"
109
101
  ],
package/readme.md CHANGED
@@ -75,13 +75,11 @@ Replace your standard `PrismaClient` with `FlareClient` in your database setup f
75
75
  ```typescript
76
76
  // prisma/db.ts
77
77
  import './callbacks'; // Import generated index to register all hooks
78
- import { FlareClient } from 'prisma-flare/client';
78
+ import { FlareClient } from 'prisma-flare';
79
79
 
80
80
  export const db = new FlareClient();
81
81
  ```
82
82
 
83
- **Note:** Always import `FlareClient` from `prisma-flare/client` - this ensures compatibility with custom Prisma output paths (see [Custom Prisma Output Path](#custom-prisma-output-path) below).
84
-
85
83
  `FlareClient` automatically attaches the callbacks middleware (using the appropriate API for your Prisma version). The callbacks import loads a generated barrel file that registers all your hooks - this pattern works in all environments (bundlers, Node.js, serverless, etc.).
86
84
 
87
85
  **With Prisma adapters:**
@@ -89,7 +87,7 @@ export const db = new FlareClient();
89
87
  ```typescript
90
88
  import './callbacks';
91
89
  import { PrismaPg } from '@prisma/adapter-pg';
92
- import { FlareClient } from 'prisma-flare/client';
90
+ import { FlareClient } from 'prisma-flare';
93
91
 
94
92
  const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
95
93
 
@@ -99,7 +97,7 @@ export const db = new FlareClient({ adapter });
99
97
  **Disable callbacks middleware:**
100
98
 
101
99
  ```typescript
102
- import { FlareClient } from 'prisma-flare/client';
100
+ import { FlareClient } from 'prisma-flare';
103
101
 
104
102
  // If you don't use callbacks, disable the middleware for slightly less overhead
105
103
  export const db = new FlareClient({ callbacks: false });
@@ -161,21 +159,9 @@ generator client {
161
159
  }
162
160
  ```
163
161
 
164
- The `prisma-flare generate` command:
165
- 1. Parses your `schema.prisma` to detect custom output paths
166
- 2. Generates `node_modules/.prisma-flare/` with the correct import path
167
- 3. `prisma-flare/client` automatically uses this generated client
168
-
169
- **That's it!** Just import from `prisma-flare/client` and it works:
170
-
171
- ```typescript
172
- import { FlareClient } from 'prisma-flare/client'; // Works with any Prisma output path
173
- import { hookRegistry } from 'prisma-flare'; // Hooks/utilities from main package
174
-
175
- export const db = new FlareClient();
176
- ```
162
+ Just run `npx prisma-flare generate` - it parses your `schema.prisma` and configures everything automatically. No extra configuration needed.
177
163
 
178
- **Manual override:** If auto-detection doesn't work for your setup, you can explicitly configure the path:
164
+ **Manual override:** If auto-detection doesn't work, add to `prisma-flare.config.json`:
179
165
 
180
166
  ```json
181
167
  {
@@ -183,18 +169,6 @@ export const db = new FlareClient();
183
169
  }
184
170
  ```
185
171
 
186
- **Advanced: Factory function**
187
-
188
- For full control, use `createFlareClient` to create a FlareClient from any PrismaClient:
189
-
190
- ```typescript
191
- import { createFlareClient } from 'prisma-flare';
192
- import { PrismaClient, Prisma } from './my/custom/prisma/path';
193
-
194
- const FlareClient = createFlareClient(PrismaClient, Prisma);
195
- export const db = new FlareClient();
196
- ```
197
-
198
172
  ## Usage
199
173
 
200
174
  ### Flare Builder
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/client/index.ts
21
- var client_exports = {};
22
- __export(client_exports, {
23
- FlareClient: () => import__.FlareClient,
24
- Prisma: () => import__.Prisma,
25
- PrismaClient: () => import__.PrismaClient
26
- });
27
- module.exports = __toCommonJS(client_exports);
28
- var import__ = require(".prisma-flare");
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- FlareClient,
32
- Prisma,
33
- PrismaClient
34
- });
@@ -1 +0,0 @@
1
- export { FlareClient, Prisma, PrismaClient } from '.prisma-flare';
@@ -1 +0,0 @@
1
- export { FlareClient, Prisma, PrismaClient } from '.prisma-flare';
@@ -1,7 +0,0 @@
1
- // src/client/index.ts
2
- import { FlareClient, Prisma, PrismaClient } from ".prisma-flare";
3
- export {
4
- FlareClient,
5
- Prisma,
6
- PrismaClient
7
- };