@hazeljs/prisma 0.2.0-alpha.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.
package/LICENSE ADDED
@@ -0,0 +1,192 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2024 HazelJS Team
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ ---
20
+
21
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
22
+
23
+ 1. Definitions.
24
+
25
+ "License" shall mean the terms and conditions for use, reproduction,
26
+ and distribution as defined by Sections 1 through 9 of this document.
27
+
28
+ "Licensor" shall mean the copyright owner or entity authorized by
29
+ the copyright owner that is granting the License.
30
+
31
+ "Legal Entity" shall mean the union of the acting entity and all
32
+ other entities that control, are controlled by, or are under common
33
+ control with that entity. For the purposes of this definition,
34
+ "control" means (i) the power, direct or indirect, to cause the
35
+ direction or management of such entity, whether by contract or
36
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
37
+ outstanding shares, or (iii) beneficial ownership of such entity.
38
+
39
+ "You" (or "Your") shall mean an individual or Legal Entity
40
+ exercising permissions granted by this License.
41
+
42
+ "Source" form shall mean the preferred form for making modifications,
43
+ including but not limited to software source code, documentation
44
+ source, and configuration files.
45
+
46
+ "Object" form shall mean any form resulting from mechanical
47
+ transformation or translation of a Source form, including but
48
+ not limited to compiled object code, generated documentation,
49
+ and conversions to other media types.
50
+
51
+ "Work" shall mean the work of authorship, whether in Source or
52
+ Object form, made available under the License, as indicated by a
53
+ copyright notice that is included in or attached to the work
54
+ (an example is provided in the Appendix below).
55
+
56
+ "Derivative Works" shall mean any work, whether in Source or Object
57
+ form, that is based on (or derived from) the Work and for which the
58
+ editorial revisions, annotations, elaborations, or other modifications
59
+ represent, as a whole, an original work of authorship. For the purposes
60
+ of this License, Derivative Works shall not include works that remain
61
+ separable from, or merely link (or bind by name) to the interfaces of,
62
+ the Work and Derivative Works thereof.
63
+
64
+ "Contribution" shall mean any work of authorship, including
65
+ the original version of the Work and any modifications or additions
66
+ to that Work or Derivative Works thereof, that is intentionally
67
+ submitted to Licensor for inclusion in the Work by the copyright owner
68
+ or by an individual or Legal Entity authorized to submit on behalf of
69
+ the copyright owner. For the purposes of this definition, "submitted"
70
+ means any form of electronic, verbal, or written communication sent
71
+ to the Licensor or its representatives, including but not limited to
72
+ communication on electronic mailing lists, source code control systems,
73
+ and issue tracking systems that are managed by, or on behalf of, the
74
+ Licensor for the purpose of discussing and improving the Work, but
75
+ excluding communication that is conspicuously marked or otherwise
76
+ designated in writing by the copyright owner as "Not a Contribution."
77
+
78
+ "Contributor" shall mean Licensor and any individual or Legal Entity
79
+ on behalf of whom a Contribution has been received by Licensor and
80
+ subsequently incorporated within the Work.
81
+
82
+ 2. Grant of Copyright License. Subject to the terms and conditions of
83
+ this License, each Contributor hereby grants to You a perpetual,
84
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
85
+ copyright license to reproduce, prepare Derivative Works of,
86
+ publicly display, publicly perform, sublicense, and distribute the
87
+ Work and such Derivative Works in Source or Object form.
88
+
89
+ 3. Grant of Patent License. Subject to the terms and conditions of
90
+ this License, each Contributor hereby grants to You a perpetual,
91
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
92
+ (except as stated in this section) patent license to make, have made,
93
+ use, offer to sell, sell, import, and otherwise transfer the Work,
94
+ where such license applies only to those patent claims licensable
95
+ by such Contributor that are necessarily infringed by their
96
+ Contribution(s) alone or by combination of their Contribution(s)
97
+ with the Work to which such Contribution(s) was submitted. If You
98
+ institute patent litigation against any entity (including a
99
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
100
+ or a Contribution incorporated within the Work constitutes direct
101
+ or contributory patent infringement, then any patent licenses
102
+ granted to You under this License for that Work shall terminate
103
+ as of the date such litigation is filed.
104
+
105
+ 4. Redistribution. You may reproduce and distribute copies of the
106
+ Work or Derivative Works thereof in any medium, with or without
107
+ modifications, and in Source or Object form, provided that You
108
+ meet the following conditions:
109
+
110
+ (a) You must give any other recipients of the Work or
111
+ Derivative Works a copy of this License; and
112
+
113
+ (b) You must cause any modified files to carry prominent notices
114
+ stating that You changed the files; and
115
+
116
+ (c) You must retain, in the Source form of any Derivative Works
117
+ that You distribute, all copyright, patent, trademark, and
118
+ attribution notices from the Source form of the Work,
119
+ excluding those notices that do not pertain to any part of
120
+ the Derivative Works; and
121
+
122
+ (d) If the Work includes a "NOTICE" text file as part of its
123
+ distribution, then any Derivative Works that You distribute must
124
+ include a readable copy of the attribution notices contained
125
+ within such NOTICE file, excluding those notices that do not
126
+ pertain to any part of the Derivative Works, in at least one
127
+ of the following places: within a NOTICE text file distributed
128
+ as part of the Derivative Works; within the Source form or
129
+ documentation, if provided along with the Derivative Works; or,
130
+ within a display generated by the Derivative Works, if and
131
+ wherever such third-party notices normally appear. The contents
132
+ of the NOTICE file are for informational purposes only and
133
+ do not modify the License. You may add Your own attribution
134
+ notices within Derivative Works that You distribute, alongside
135
+ or as an addendum to the NOTICE text from the Work, provided
136
+ that such additional attribution notices cannot be construed
137
+ as modifying the License.
138
+
139
+ You may add Your own copyright statement to Your modifications and
140
+ may provide additional or different license terms and conditions
141
+ for use, reproduction, or distribution of Your modifications, or
142
+ for any such Derivative Works as a whole, provided Your use,
143
+ reproduction, and distribution of the Work otherwise complies with
144
+ the conditions stated in this License.
145
+
146
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
147
+ any Contribution intentionally submitted for inclusion in the Work
148
+ by You to the Licensor shall be under the terms and conditions of
149
+ this License, without any additional terms or conditions.
150
+ Notwithstanding the above, nothing herein shall supersede or modify
151
+ the terms of any separate license agreement you may have executed
152
+ with Licensor regarding such Contributions.
153
+
154
+ 6. Trademarks. This License does not grant permission to use the trade
155
+ names, trademarks, service marks, or product names of the Licensor,
156
+ except as required for reasonable and customary use in describing the
157
+ origin of the Work and reproducing the content of the NOTICE file.
158
+
159
+ 7. Disclaimer of Warranty. Unless required by applicable law or
160
+ agreed to in writing, Licensor provides the Work (and each
161
+ Contributor provides its Contributions) on an "AS IS" BASIS,
162
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
163
+ implied, including, without limitation, any warranties or conditions
164
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
165
+ PARTICULAR PURPOSE. You are solely responsible for determining the
166
+ appropriateness of using or redistributing the Work and assume any
167
+ risks associated with Your exercise of permissions under this License.
168
+
169
+ 8. Limitation of Liability. In no event and under no legal theory,
170
+ whether in tort (including negligence), contract, or otherwise,
171
+ unless required by applicable law (such as deliberate and grossly
172
+ negligent acts) or agreed to in writing, shall any Contributor be
173
+ liable to You for damages, including any direct, indirect, special,
174
+ incidental, or consequential damages of any character arising as a
175
+ result of this License or out of the use or inability to use the
176
+ Work (including but not limited to damages for loss of goodwill,
177
+ work stoppage, computer failure or malfunction, or any and all
178
+ other commercial damages or losses), even if such Contributor
179
+ has been advised of the possibility of such damages.
180
+
181
+ 9. Accepting Warranty or Additional Liability. While redistributing
182
+ the Work or Derivative Works thereof, You may choose to offer,
183
+ and charge a fee for, acceptance of support, warranty, indemnity,
184
+ or other liability obligations and/or rights consistent with this
185
+ License. However, in accepting such obligations, You may act only
186
+ on Your own behalf and on Your sole responsibility, not on behalf
187
+ of any other Contributor, and only if You agree to indemnify,
188
+ defend, and hold each Contributor harmless for any liability
189
+ incurred by, or claims asserted against, such Contributor by reason
190
+ of your accepting any such warranty or additional liability.
191
+
192
+ END OF TERMS AND CONDITIONS
package/README.md ADDED
@@ -0,0 +1,458 @@
1
+ # @hazeljs/prisma
2
+
3
+ **Prisma + HazelJS. Type-safe, no boilerplate.**
4
+
5
+ Repository pattern, `@Repository` decorator, DI integration. Full CRUD from your schema. Transactions, relations, pagination — the way you'd expect it to work.
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@hazeljs/prisma.svg)](https://www.npmjs.com/package/@hazeljs/prisma)
8
+ [![npm downloads](https://img.shields.io/npm/dm/@hazeljs/prisma)](https://www.npmjs.com/package/@hazeljs/prisma)
9
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
10
+
11
+ ## Features
12
+
13
+ - 🎯 **Type-Safe Queries** - Full TypeScript support with Prisma
14
+ - 🏗️ **Repository Pattern** - Clean data access layer
15
+ - 🎨 **Decorator Support** - `@Repository` implies `@Injectable()` — one decorator does the job
16
+ - 🔄 **Transaction Support** - Built-in transaction management
17
+ - 📊 **Query Builder** - Fluent query interface
18
+ - 🔌 **Dependency Injection** - Seamless DI integration
19
+ - 🧪 **Testing Utilities** - Mock Prisma for testing
20
+ - 📈 **Connection Pooling** - Automatic connection management
21
+
22
+ ## Decorator Convention
23
+
24
+ | Class type | Correct decorator |
25
+ |------------|------------------|
26
+ | Repository (`extends BaseRepository`) | `@Repository({ model: '...' })` — implies `@Injectable()` |
27
+ | Service (business logic) | `@Service()` |
28
+ | Controller | `@Controller(...)` |
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ npm install @hazeljs/prisma @prisma/client
34
+ npm install -D prisma
35
+ ```
36
+
37
+ ## Quick Start
38
+
39
+ ### 1. Initialize Prisma
40
+
41
+ ```bash
42
+ npx prisma init
43
+ ```
44
+
45
+ ### 2. Define Schema
46
+
47
+ ```prisma
48
+ // prisma/schema.prisma
49
+ generator client {
50
+ provider = "prisma-client-js"
51
+ }
52
+
53
+ datasource db {
54
+ provider = "postgresql"
55
+ url = env("DATABASE_URL")
56
+ }
57
+
58
+ model User {
59
+ id String @id @default(uuid())
60
+ email String @unique
61
+ name String
62
+ posts Post[]
63
+ createdAt DateTime @default(now())
64
+ updatedAt DateTime @updatedAt
65
+ }
66
+
67
+ model Post {
68
+ id String @id @default(uuid())
69
+ title String
70
+ content String?
71
+ published Boolean @default(false)
72
+ authorId String
73
+ author User @relation(fields: [authorId], references: [id])
74
+ createdAt DateTime @default(now())
75
+ updatedAt DateTime @updatedAt
76
+ }
77
+ ```
78
+
79
+ ### 3. Generate Prisma Client
80
+
81
+ ```bash
82
+ npx prisma generate
83
+ npx prisma migrate dev --name init
84
+ ```
85
+
86
+ ### 4. Configure Module
87
+
88
+ ```typescript
89
+ import { HazelModule } from '@hazeljs/core';
90
+ import { PrismaModule } from '@hazeljs/prisma';
91
+
92
+ @HazelModule({
93
+ imports: [
94
+ PrismaModule.forRoot({
95
+ connectionString: process.env.DATABASE_URL,
96
+ }),
97
+ ],
98
+ })
99
+ export class AppModule {}
100
+ ```
101
+
102
+ ### 5. Create Repository
103
+
104
+ `@Repository` implies `@Injectable()` — no need to add both decorators.
105
+
106
+ ```typescript
107
+ import { PrismaService, BaseRepository } from '@hazeljs/prisma';
108
+ import { Repository } from '@hazeljs/prisma';
109
+
110
+ @Repository({ model: 'user' })
111
+ export class UserRepository extends BaseRepository<User> {
112
+ constructor(prisma: PrismaService) {
113
+ super(prisma, 'user');
114
+ }
115
+
116
+ async findByEmail(email: string) {
117
+ return this.prisma.user.findUnique({ where: { email } });
118
+ }
119
+
120
+ async findWithPosts(id: string) {
121
+ return this.prisma.user.findUnique({
122
+ where: { id },
123
+ include: { posts: true },
124
+ });
125
+ }
126
+ }
127
+ ```
128
+
129
+ ### 6. Use in a Service
130
+
131
+ Use `@Service` for service classes — not `@Injectable`.
132
+
133
+ ```typescript
134
+ import { Service } from '@hazeljs/core';
135
+ import { InjectRepository } from '@hazeljs/prisma';
136
+
137
+ @Service()
138
+ export class UserService {
139
+ constructor(
140
+ @InjectRepository() private readonly userRepository: UserRepository,
141
+ ) {}
142
+
143
+ async create(data: { email: string; name: string }) {
144
+ return this.userRepository.create(data);
145
+ }
146
+
147
+ async findAll() {
148
+ return this.userRepository.findMany();
149
+ }
150
+
151
+ async findOne(id: string) {
152
+ return this.userRepository.findOne({ id });
153
+ }
154
+
155
+ async update(id: string, data: Partial<User>) {
156
+ return this.userRepository.update({ id }, data);
157
+ }
158
+
159
+ async delete(id: string) {
160
+ return this.userRepository.delete({ id });
161
+ }
162
+ }
163
+ ```
164
+
165
+ ## Base Repository
166
+
167
+ The `BaseRepository` provides common CRUD operations:
168
+
169
+ ```typescript
170
+ class BaseRepository<T> {
171
+ // Create
172
+ create(data: Omit<T, 'id'>): Promise<T>;
173
+
174
+ // Read
175
+ findMany(): Promise<T[]>;
176
+ findOne(where: WhereUniqueInput): Promise<T | null>;
177
+ count(args?: unknown): Promise<number>;
178
+
179
+ // Update
180
+ update(where: WhereUniqueInput, data: UpdateInput): Promise<T>;
181
+
182
+ // Delete
183
+ delete(where: WhereUniqueInput): Promise<T>;
184
+ }
185
+ ```
186
+
187
+ ## Transactions
188
+
189
+ ### Using PrismaService directly
190
+
191
+ ```typescript
192
+ import { Service } from '@hazeljs/core';
193
+ import { PrismaService } from '@hazeljs/prisma';
194
+
195
+ @Service()
196
+ export class TransferService {
197
+ constructor(private readonly prisma: PrismaService) {}
198
+
199
+ async transfer(fromId: string, toId: string, amount: number) {
200
+ return this.prisma.$transaction(async (tx) => {
201
+ await tx.account.update({
202
+ where: { id: fromId },
203
+ data: { balance: { decrement: amount } },
204
+ });
205
+
206
+ await tx.account.update({
207
+ where: { id: toId },
208
+ data: { balance: { increment: amount } },
209
+ });
210
+
211
+ return tx.transaction.create({
212
+ data: { fromId, toId, amount },
213
+ });
214
+ });
215
+ }
216
+ }
217
+ ```
218
+
219
+ ### Using Repositories inside a transaction
220
+
221
+ ```typescript
222
+ import { Service } from '@hazeljs/core';
223
+ import { PrismaService } from '@hazeljs/prisma';
224
+
225
+ @Service()
226
+ export class OrderService {
227
+ constructor(
228
+ private readonly orderRepository: OrderRepository,
229
+ private readonly inventoryRepository: InventoryRepository,
230
+ private readonly prisma: PrismaService,
231
+ ) {}
232
+
233
+ async createOrder(userId: string, items: OrderItem[]) {
234
+ return this.prisma.$transaction(async (tx) => {
235
+ const order = await tx.order.create({
236
+ data: { userId, items: { create: items } },
237
+ });
238
+
239
+ for (const item of items) {
240
+ await tx.inventory.update({
241
+ where: { productId: item.productId },
242
+ data: { quantity: { decrement: item.quantity } },
243
+ });
244
+ }
245
+
246
+ return order;
247
+ });
248
+ }
249
+ }
250
+ ```
251
+
252
+ ## Advanced Queries
253
+
254
+ ### Relations
255
+
256
+ ```typescript
257
+ @Repository({ model: 'user' })
258
+ export class UserRepository extends BaseRepository<User> {
259
+ constructor(prisma: PrismaService) {
260
+ super(prisma, 'user');
261
+ }
262
+
263
+ async findWithRelations(id: string) {
264
+ return this.prisma.user.findUnique({
265
+ where: { id },
266
+ include: {
267
+ posts: {
268
+ where: { published: true },
269
+ orderBy: { createdAt: 'desc' },
270
+ },
271
+ profile: true,
272
+ },
273
+ });
274
+ }
275
+ }
276
+ ```
277
+
278
+ ### Pagination
279
+
280
+ ```typescript
281
+ @Repository({ model: 'post' })
282
+ export class PostRepository extends BaseRepository<Post> {
283
+ constructor(prisma: PrismaService) {
284
+ super(prisma, 'post');
285
+ }
286
+
287
+ async findPaginated(page: number, limit: number) {
288
+ const skip = (page - 1) * limit;
289
+ const [posts, total] = await Promise.all([
290
+ this.prisma.post.findMany({ skip, take: limit, orderBy: { createdAt: 'desc' } }),
291
+ this.prisma.post.count(),
292
+ ]);
293
+
294
+ return {
295
+ data: posts,
296
+ meta: { page, limit, total, totalPages: Math.ceil(total / limit) },
297
+ };
298
+ }
299
+ }
300
+ ```
301
+
302
+ ### Filtering
303
+
304
+ ```typescript
305
+ @Repository({ model: 'product' })
306
+ export class ProductRepository extends BaseRepository<Product> {
307
+ constructor(prisma: PrismaService) {
308
+ super(prisma, 'product');
309
+ }
310
+
311
+ async search(query: string, filters: {
312
+ category?: string;
313
+ minPrice?: number;
314
+ maxPrice?: number;
315
+ inStock?: boolean;
316
+ }) {
317
+ return this.prisma.product.findMany({
318
+ where: {
319
+ AND: [
320
+ { OR: [
321
+ { name: { contains: query, mode: 'insensitive' } },
322
+ { description: { contains: query, mode: 'insensitive' } },
323
+ ]},
324
+ filters.category ? { category: filters.category } : {},
325
+ filters.minPrice ? { price: { gte: filters.minPrice } } : {},
326
+ filters.maxPrice ? { price: { lte: filters.maxPrice } } : {},
327
+ filters.inStock ? { stock: { gt: 0 } } : {},
328
+ ],
329
+ },
330
+ });
331
+ }
332
+ }
333
+ ```
334
+
335
+ ### Aggregations
336
+
337
+ ```typescript
338
+ import { Service } from '@hazeljs/core';
339
+ import { PrismaService } from '@hazeljs/prisma';
340
+
341
+ @Service()
342
+ export class AnalyticsService {
343
+ constructor(private readonly prisma: PrismaService) {}
344
+
345
+ async getOrderStats() {
346
+ return this.prisma.order.aggregate({
347
+ _sum: { total: true },
348
+ _avg: { total: true },
349
+ _count: true,
350
+ _max: { total: true },
351
+ _min: { total: true },
352
+ });
353
+ }
354
+
355
+ async getRevenueByMonth() {
356
+ return this.prisma.$queryRaw`
357
+ SELECT
358
+ DATE_TRUNC('month', "createdAt") as month,
359
+ SUM(total) as revenue,
360
+ COUNT(*) as orders
361
+ FROM "Order"
362
+ GROUP BY month
363
+ ORDER BY month DESC
364
+ `;
365
+ }
366
+ }
367
+ ```
368
+
369
+ ## Middleware
370
+
371
+ Add Prisma middleware for logging, soft deletes, etc:
372
+
373
+ ```typescript
374
+ import { Injectable } from '@hazeljs/core';
375
+ import { PrismaClient } from '@prisma/client';
376
+
377
+ @Injectable()
378
+ export class PrismaService extends PrismaClient {
379
+ constructor() {
380
+ super();
381
+
382
+ this.$use(async (params, next) => {
383
+ const before = Date.now();
384
+ const result = await next(params);
385
+ console.log(`Query ${params.model}.${params.action} took ${Date.now() - before}ms`);
386
+ return result;
387
+ });
388
+
389
+ // Soft delete middleware
390
+ this.$use(async (params, next) => {
391
+ if (params.action === 'delete') {
392
+ params.action = 'update';
393
+ params.args['data'] = { deletedAt: new Date() };
394
+ }
395
+ return next(params);
396
+ });
397
+ }
398
+ }
399
+ ```
400
+
401
+ ## Seeding
402
+
403
+ ```typescript
404
+ // prisma/seed.ts
405
+ import { PrismaClient } from '@prisma/client';
406
+
407
+ const prisma = new PrismaClient();
408
+
409
+ async function main() {
410
+ await prisma.user.create({
411
+ data: {
412
+ email: 'alice@example.com',
413
+ name: 'Alice',
414
+ posts: { create: [{ title: 'First Post', content: 'Hello World!', published: true }] },
415
+ },
416
+ });
417
+ }
418
+
419
+ main()
420
+ .catch((e) => { console.error(e); process.exit(1); })
421
+ .finally(() => prisma.$disconnect());
422
+ ```
423
+
424
+ Add to `package.json`:
425
+
426
+ ```json
427
+ {
428
+ "prisma": {
429
+ "seed": "ts-node prisma/seed.ts"
430
+ }
431
+ }
432
+ ```
433
+
434
+ Run seed:
435
+
436
+ ```bash
437
+ npx prisma db seed
438
+ ```
439
+
440
+ ## Migration Commands
441
+
442
+ ```bash
443
+ npx prisma migrate dev --name add_user_role
444
+ npx prisma migrate deploy
445
+ npx prisma migrate reset
446
+ npx prisma generate
447
+ npx prisma studio
448
+ ```
449
+
450
+ ## Links
451
+
452
+ - [TypeORM docs](https://www.prisma.io/docs)
453
+ - [HazelJS](https://hazeljs.com)
454
+ - [GitHub](https://github.com/hazel-js/hazeljs)
455
+
456
+ ## License
457
+
458
+ Apache 2.0 © [HazelJS](https://hazeljs.com)
@@ -0,0 +1,10 @@
1
+ export declare class PrismaClientKnownRequestError extends Error {
2
+ code: string;
3
+ meta?: Record<string, unknown>;
4
+ clientVersion: string;
5
+ constructor(message: string, { code, meta }: {
6
+ code: string;
7
+ meta?: Record<string, unknown>;
8
+ });
9
+ }
10
+ //# sourceMappingURL=library.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../src/__mocks__/@prisma/client/runtime/library.ts"],"names":[],"mappings":"AAAA,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;gBAEV,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE;CAO9F"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PrismaClientKnownRequestError = void 0;
4
+ class PrismaClientKnownRequestError extends Error {
5
+ constructor(message, { code, meta }) {
6
+ super(message);
7
+ this.name = 'PrismaClientKnownRequestError';
8
+ this.code = code;
9
+ this.meta = meta;
10
+ this.clientVersion = '5.0.0';
11
+ }
12
+ }
13
+ exports.PrismaClientKnownRequestError = PrismaClientKnownRequestError;
@@ -0,0 +1,7 @@
1
+ export declare class PrismaClient {
2
+ $on: jest.Mock<any, any, any>;
3
+ $connect: jest.Mock<any, any, any>;
4
+ $disconnect: jest.Mock<any, any, any>;
5
+ constructor(_options?: unknown);
6
+ }
7
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/__mocks__/@prisma/client.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAY;IACvB,GAAG,2BAAa;IAChB,QAAQ,2BAA0C;IAClD,WAAW,2BAA0C;gBAEzC,QAAQ,CAAC,EAAE,OAAO;CAC/B"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PrismaClient = void 0;
4
+ class PrismaClient {
5
+ constructor(_options) {
6
+ this.$on = jest.fn();
7
+ this.$connect = jest.fn().mockResolvedValue(undefined);
8
+ this.$disconnect = jest.fn().mockResolvedValue(undefined);
9
+ }
10
+ }
11
+ exports.PrismaClient = PrismaClient;