@infineit-nestjs/services 1.0.41 → 1.0.43

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.
@@ -0,0 +1,4 @@
1
+ import * as Prisma from './internal/prismaNamespaceBrowser';
2
+ export { Prisma };
3
+ export * as $Enums from './enums';
4
+ export * from './enums';
@@ -0,0 +1,8 @@
1
+ import * as runtime from '@prisma/client/runtime/client';
2
+ import * as $Class from './internal/class';
3
+ import * as Prisma from './internal/prismaNamespace';
4
+ export * as $Enums from './enums';
5
+ export * from './enums';
6
+ export declare const PrismaClient: $Class.PrismaClientConstructor;
7
+ export type PrismaClient<LogOpts extends Prisma.LogLevel = never, OmitOpts extends Prisma.PrismaClientOptions['omit'] = Prisma.PrismaClientOptions['omit'], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = $Class.PrismaClient<LogOpts, OmitOpts, ExtArgs>;
8
+ export { Prisma };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ import * as runtime from '@prisma/client/runtime/client';
2
+ import type * as Prisma from './prismaNamespace';
3
+ export type LogOptions<ClientOptions extends Prisma.PrismaClientOptions> = 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never;
4
+ export interface PrismaClientConstructor {
5
+ new <Options extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions, LogOpts extends LogOptions<Options> = LogOptions<Options>, OmitOpts extends Prisma.PrismaClientOptions['omit'] = Options extends {
6
+ omit: infer U;
7
+ } ? U : Prisma.PrismaClientOptions['omit'], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs>(options: Prisma.Subset<Options, Prisma.PrismaClientOptions>): PrismaClient<LogOpts, OmitOpts, ExtArgs>;
8
+ }
9
+ export interface PrismaClient<in LogOpts extends Prisma.LogLevel = never, in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = undefined, in out ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> {
10
+ [K: symbol]: {
11
+ types: Prisma.TypeMap<ExtArgs>['other'];
12
+ };
13
+ $on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;
14
+ $connect(): runtime.Types.Utils.JsPromise<void>;
15
+ $disconnect(): runtime.Types.Utils.JsPromise<void>;
16
+ $executeRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<number>;
17
+ $executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;
18
+ $queryRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<T>;
19
+ $queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;
20
+ $transaction<P extends Prisma.PrismaPromise<any>[]>(arg: [...P], options?: {
21
+ isolationLevel?: Prisma.TransactionIsolationLevel;
22
+ }): runtime.Types.Utils.JsPromise<runtime.Types.Utils.UnwrapTuple<P>>;
23
+ $transaction<R>(fn: (prisma: Omit<PrismaClient, runtime.ITXClientDenyList>) => runtime.Types.Utils.JsPromise<R>, options?: {
24
+ maxWait?: number;
25
+ timeout?: number;
26
+ isolationLevel?: Prisma.TransactionIsolationLevel;
27
+ }): runtime.Types.Utils.JsPromise<R>;
28
+ $extends: runtime.Types.Extensions.ExtendsHook<'extends', Prisma.TypeMapCb<OmitOpts>, ExtArgs, runtime.Types.Utils.Call<Prisma.TypeMapCb<OmitOpts>, {
29
+ extArgs: ExtArgs;
30
+ }>>;
31
+ }
32
+ export declare function getPrismaClientClass(): PrismaClientConstructor;
@@ -0,0 +1,248 @@
1
+ import * as runtime from '@prisma/client/runtime/client';
2
+ import { type PrismaClient } from './class';
3
+ export type * from '../models';
4
+ export type DMMF = typeof runtime.DMMF;
5
+ export type PrismaPromise<T> = runtime.Types.Public.PrismaPromise<T>;
6
+ export declare const PrismaClientKnownRequestError: typeof runtime.PrismaClientKnownRequestError;
7
+ export type PrismaClientKnownRequestError = runtime.PrismaClientKnownRequestError;
8
+ export declare const PrismaClientUnknownRequestError: typeof runtime.PrismaClientUnknownRequestError;
9
+ export type PrismaClientUnknownRequestError = runtime.PrismaClientUnknownRequestError;
10
+ export declare const PrismaClientRustPanicError: typeof runtime.PrismaClientRustPanicError;
11
+ export type PrismaClientRustPanicError = runtime.PrismaClientRustPanicError;
12
+ export declare const PrismaClientInitializationError: typeof runtime.PrismaClientInitializationError;
13
+ export type PrismaClientInitializationError = runtime.PrismaClientInitializationError;
14
+ export declare const PrismaClientValidationError: typeof runtime.PrismaClientValidationError;
15
+ export type PrismaClientValidationError = runtime.PrismaClientValidationError;
16
+ export declare const sql: typeof runtime.sqltag;
17
+ export declare const empty: runtime.Sql;
18
+ export declare const join: typeof runtime.join;
19
+ export declare const raw: typeof runtime.raw;
20
+ export declare const Sql: typeof runtime.Sql;
21
+ export type Sql = runtime.Sql;
22
+ export declare const Decimal: typeof runtime.Decimal;
23
+ export type Decimal = runtime.Decimal;
24
+ export type DecimalJsLike = runtime.DecimalJsLike;
25
+ export type Extension = runtime.Types.Extensions.UserArgs;
26
+ export declare const getExtensionContext: typeof runtime.Extensions.getExtensionContext;
27
+ export type Args<T, F extends runtime.Operation> = runtime.Types.Public.Args<T, F>;
28
+ export type Payload<T, F extends runtime.Operation = never> = runtime.Types.Public.Payload<T, F>;
29
+ export type Result<T, A, F extends runtime.Operation> = runtime.Types.Public.Result<T, A, F>;
30
+ export type Exact<A, W> = runtime.Types.Public.Exact<A, W>;
31
+ export type PrismaVersion = {
32
+ client: string;
33
+ engine: string;
34
+ };
35
+ export declare const prismaVersion: PrismaVersion;
36
+ export type Bytes = runtime.Bytes;
37
+ export type JsonObject = runtime.JsonObject;
38
+ export type JsonArray = runtime.JsonArray;
39
+ export type JsonValue = runtime.JsonValue;
40
+ export type InputJsonObject = runtime.InputJsonObject;
41
+ export type InputJsonArray = runtime.InputJsonArray;
42
+ export type InputJsonValue = runtime.InputJsonValue;
43
+ export declare const NullTypes: {
44
+ DbNull: new (secret: never) => typeof runtime.DbNull;
45
+ JsonNull: new (secret: never) => typeof runtime.JsonNull;
46
+ AnyNull: new (secret: never) => typeof runtime.AnyNull;
47
+ };
48
+ export declare const DbNull: runtime.DbNullClass;
49
+ export declare const JsonNull: runtime.JsonNullClass;
50
+ export declare const AnyNull: runtime.AnyNullClass;
51
+ type SelectAndInclude = {
52
+ select: any;
53
+ include: any;
54
+ };
55
+ type SelectAndOmit = {
56
+ select: any;
57
+ omit: any;
58
+ };
59
+ type Prisma__Pick<T, K extends keyof T> = {
60
+ [P in K]: T[P];
61
+ };
62
+ export type Enumerable<T> = T | Array<T>;
63
+ export type Subset<T, U> = {
64
+ [key in keyof T]: key extends keyof U ? T[key] : never;
65
+ };
66
+ export type SelectSubset<T, U> = {
67
+ [key in keyof T]: key extends keyof U ? T[key] : never;
68
+ } & (T extends SelectAndInclude ? 'Please either choose `select` or `include`.' : T extends SelectAndOmit ? 'Please either choose `select` or `omit`.' : {});
69
+ export type SubsetIntersection<T, U, K> = {
70
+ [key in keyof T]: key extends keyof U ? T[key] : never;
71
+ } & K;
72
+ type Without<T, U> = {
73
+ [P in Exclude<keyof T, keyof U>]?: never;
74
+ };
75
+ export type XOR<T, U> = T extends object ? U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : U : T;
76
+ type IsObject<T extends any> = T extends Array<any> ? False : T extends Date ? False : T extends Uint8Array ? False : T extends BigInt ? False : T extends object ? True : False;
77
+ export type UnEnumerate<T extends unknown> = T extends Array<infer U> ? U : T;
78
+ type __Either<O extends object, K extends Key> = Omit<O, K> & {
79
+ [P in K]: Prisma__Pick<O, P & keyof O>;
80
+ }[K];
81
+ type EitherStrict<O extends object, K extends Key> = Strict<__Either<O, K>>;
82
+ type EitherLoose<O extends object, K extends Key> = ComputeRaw<__Either<O, K>>;
83
+ type _Either<O extends object, K extends Key, strict extends Boolean> = {
84
+ 1: EitherStrict<O, K>;
85
+ 0: EitherLoose<O, K>;
86
+ }[strict];
87
+ export type Either<O extends object, K extends Key, strict extends Boolean = 1> = O extends unknown ? _Either<O, K, strict> : never;
88
+ export type Union = any;
89
+ export type PatchUndefined<O extends object, O1 extends object> = {
90
+ [K in keyof O]: O[K] extends undefined ? At<O1, K> : O[K];
91
+ } & {};
92
+ export type IntersectOf<U extends Union> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
93
+ export type Overwrite<O extends object, O1 extends object> = {
94
+ [K in keyof O]: K extends keyof O1 ? O1[K] : O[K];
95
+ } & {};
96
+ type _Merge<U extends object> = IntersectOf<Overwrite<U, {
97
+ [K in keyof U]-?: At<U, K>;
98
+ }>>;
99
+ type Key = string | number | symbol;
100
+ type AtStrict<O extends object, K extends Key> = O[K & keyof O];
101
+ type AtLoose<O extends object, K extends Key> = O extends unknown ? AtStrict<O, K> : never;
102
+ export type At<O extends object, K extends Key, strict extends Boolean = 1> = {
103
+ 1: AtStrict<O, K>;
104
+ 0: AtLoose<O, K>;
105
+ }[strict];
106
+ export type ComputeRaw<A extends any> = A extends Function ? A : {
107
+ [K in keyof A]: A[K];
108
+ } & {};
109
+ export type OptionalFlat<O> = {
110
+ [K in keyof O]?: O[K];
111
+ } & {};
112
+ type _Record<K extends keyof any, T> = {
113
+ [P in K]: T;
114
+ };
115
+ type NoExpand<T> = T extends unknown ? T : never;
116
+ export type AtLeast<O extends object, K extends string> = NoExpand<O extends unknown ? (K extends keyof O ? {
117
+ [P in K]: O[P];
118
+ } & O : O) | ({
119
+ [P in keyof O as P extends K ? P : never]-?: O[P];
120
+ } & O) : never>;
121
+ type _Strict<U, _U = U> = U extends unknown ? U & OptionalFlat<_Record<Exclude<Keys<_U>, keyof U>, never>> : never;
122
+ export type Strict<U extends object> = ComputeRaw<_Strict<U>>;
123
+ export type Merge<U extends object> = ComputeRaw<_Merge<Strict<U>>>;
124
+ export type Boolean = True | False;
125
+ export type True = 1;
126
+ export type False = 0;
127
+ export type Not<B extends Boolean> = {
128
+ 0: 1;
129
+ 1: 0;
130
+ }[B];
131
+ export type Extends<A1 extends any, A2 extends any> = [A1] extends [never] ? 0 : A1 extends A2 ? 1 : 0;
132
+ export type Has<U extends Union, U1 extends Union> = Not<Extends<Exclude<U1, U>, U1>>;
133
+ export type Or<B1 extends Boolean, B2 extends Boolean> = {
134
+ 0: {
135
+ 0: 0;
136
+ 1: 1;
137
+ };
138
+ 1: {
139
+ 0: 1;
140
+ 1: 1;
141
+ };
142
+ }[B1][B2];
143
+ export type Keys<U extends Union> = U extends unknown ? keyof U : never;
144
+ export type GetScalarType<T, O> = O extends object ? {
145
+ [P in keyof T]: P extends keyof O ? O[P] : never;
146
+ } : never;
147
+ type FieldPaths<T, U = Omit<T, '_avg' | '_sum' | '_count' | '_min' | '_max'>> = IsObject<T> extends True ? U : T;
148
+ export type GetHavingFields<T> = {
149
+ [K in keyof T]: Or<Or<Extends<'OR', K>, Extends<'AND', K>>, Extends<'NOT', K>> extends True ? T[K] extends infer TK ? GetHavingFields<UnEnumerate<TK> extends object ? Merge<UnEnumerate<TK>> : never> : never : {} extends FieldPaths<T[K]> ? never : K;
150
+ }[keyof T];
151
+ type _TupleToUnion<T> = T extends (infer E)[] ? E : never;
152
+ type TupleToUnion<K extends readonly any[]> = _TupleToUnion<K>;
153
+ export type MaybeTupleToUnion<T> = T extends any[] ? TupleToUnion<T> : T;
154
+ export type PickEnumerable<T, K extends Enumerable<keyof T> | keyof T> = Prisma__Pick<T, MaybeTupleToUnion<K>>;
155
+ export type ExcludeUnderscoreKeys<T extends string> = T extends `_${string}` ? never : T;
156
+ export type FieldRef<Model, FieldType> = runtime.FieldRef<Model, FieldType>;
157
+ export declare const ModelName: {};
158
+ export type ModelName = (typeof ModelName)[keyof typeof ModelName];
159
+ export interface TypeMapCb<GlobalOmitOptions = {}> extends runtime.Types.Utils.Fn<{
160
+ extArgs: runtime.Types.Extensions.InternalArgs;
161
+ }, runtime.Types.Utils.Record<string, any>> {
162
+ returns: TypeMap<this['params']['extArgs'], GlobalOmitOptions>;
163
+ }
164
+ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> = {
165
+ globalOmitOptions: {
166
+ omit: GlobalOmitOptions;
167
+ };
168
+ meta: {
169
+ modelProps: never;
170
+ txIsolationLevel: TransactionIsolationLevel;
171
+ };
172
+ model: {};
173
+ } & {
174
+ other: {
175
+ payload: any;
176
+ operations: {
177
+ $executeRaw: {
178
+ args: [query: TemplateStringsArray | Sql, ...values: any[]];
179
+ result: any;
180
+ };
181
+ $executeRawUnsafe: {
182
+ args: [query: string, ...values: any[]];
183
+ result: any;
184
+ };
185
+ $queryRaw: {
186
+ args: [query: TemplateStringsArray | Sql, ...values: any[]];
187
+ result: any;
188
+ };
189
+ $queryRawUnsafe: {
190
+ args: [query: string, ...values: any[]];
191
+ result: any;
192
+ };
193
+ };
194
+ };
195
+ };
196
+ export declare const TransactionIsolationLevel: {
197
+ readonly ReadUncommitted: "ReadUncommitted";
198
+ readonly ReadCommitted: "ReadCommitted";
199
+ readonly RepeatableRead: "RepeatableRead";
200
+ readonly Serializable: "Serializable";
201
+ };
202
+ export type TransactionIsolationLevel = (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel];
203
+ export type BatchPayload = {
204
+ count: number;
205
+ };
206
+ export declare const defineExtension: runtime.Types.Extensions.ExtendsHook<"define", TypeMapCb, runtime.Types.Extensions.DefaultArgs>;
207
+ export type DefaultPrismaClient = PrismaClient;
208
+ export type ErrorFormat = 'pretty' | 'colorless' | 'minimal';
209
+ export type PrismaClientOptions = ({
210
+ adapter: runtime.SqlDriverAdapterFactory;
211
+ accelerateUrl?: never;
212
+ } | {
213
+ accelerateUrl: string;
214
+ adapter?: never;
215
+ }) & {
216
+ errorFormat?: ErrorFormat;
217
+ log?: (LogLevel | LogDefinition)[];
218
+ transactionOptions?: {
219
+ maxWait?: number;
220
+ timeout?: number;
221
+ isolationLevel?: TransactionIsolationLevel;
222
+ };
223
+ omit?: GlobalOmitConfig;
224
+ comments?: runtime.SqlCommenterPlugin[];
225
+ };
226
+ export type GlobalOmitConfig = {};
227
+ export type LogLevel = 'info' | 'query' | 'warn' | 'error';
228
+ export type LogDefinition = {
229
+ level: LogLevel;
230
+ emit: 'stdout' | 'event';
231
+ };
232
+ export type CheckIsLogLevel<T> = T extends LogLevel ? T : never;
233
+ export type GetLogType<T> = CheckIsLogLevel<T extends LogDefinition ? T['level'] : T>;
234
+ export type GetEvents<T extends any[]> = T extends Array<LogLevel | LogDefinition> ? GetLogType<T[number]> : never;
235
+ export type QueryEvent = {
236
+ timestamp: Date;
237
+ query: string;
238
+ params: string;
239
+ duration: number;
240
+ target: string;
241
+ };
242
+ export type LogEvent = {
243
+ timestamp: Date;
244
+ message: string;
245
+ target: string;
246
+ };
247
+ export type PrismaAction = 'findUnique' | 'findUniqueOrThrow' | 'findMany' | 'findFirst' | 'findFirstOrThrow' | 'create' | 'createMany' | 'createManyAndReturn' | 'update' | 'updateMany' | 'updateManyAndReturn' | 'upsert' | 'delete' | 'deleteMany' | 'executeRaw' | 'queryRaw' | 'aggregate' | 'count' | 'runCommandRaw' | 'findRaw' | 'groupBy';
248
+ export type TransactionClient = Omit<DefaultPrismaClient, runtime.ITXClientDenyList>;
@@ -0,0 +1,21 @@
1
+ import * as runtime from '@prisma/client/runtime/index-browser';
2
+ export type * from '../models';
3
+ export type * from './prismaNamespace';
4
+ export declare const Decimal: typeof runtime.Decimal;
5
+ export declare const NullTypes: {
6
+ DbNull: new (secret: never) => typeof runtime.DbNull;
7
+ JsonNull: new (secret: never) => typeof runtime.JsonNull;
8
+ AnyNull: new (secret: never) => typeof runtime.AnyNull;
9
+ };
10
+ export declare const DbNull: import("@prisma/client-runtime-utils").DbNullClass;
11
+ export declare const JsonNull: import("@prisma/client-runtime-utils").JsonNullClass;
12
+ export declare const AnyNull: import("@prisma/client-runtime-utils").AnyNullClass;
13
+ export declare const ModelName: {};
14
+ export type ModelName = (typeof ModelName)[keyof typeof ModelName];
15
+ export declare const TransactionIsolationLevel: {
16
+ readonly ReadUncommitted: "ReadUncommitted";
17
+ readonly ReadCommitted: "ReadCommitted";
18
+ readonly RepeatableRead: "RepeatableRead";
19
+ readonly Serializable: "Serializable";
20
+ };
21
+ export type TransactionIsolationLevel = (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel];
@@ -0,0 +1 @@
1
+ export type * from './commonInputTypes';
@@ -1,17 +1,13 @@
1
1
  import { OnModuleInit, OnModuleDestroy } from '@nestjs/common';
2
- import { ConfigService } from '@nestjs/config';
3
2
  import { HealthIndicatorResult } from '@nestjs/terminus';
4
- import { AllConfigType } from '@infineit-nestjs/types';
5
- import { Prisma, PrismaClient } from '@prisma/client';
3
+ import { PrismaClient } from '../generated/prisma/client';
6
4
  export declare class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
7
- private readonly configService;
8
- constructor(configService: ConfigService<AllConfigType>);
9
5
  onModuleInit(): Promise<void>;
10
6
  onModuleDestroy(): Promise<void>;
11
7
  executeRawQuery<T>(queryMethod: Function, ...args: any[]): Promise<T | T[] | null>;
12
8
  private getQueryDetails;
13
9
  private sanitizeData;
14
10
  executeRawQueryOld(queryObj?: any, data?: any, fields?: string[]): Promise<any>;
15
- executeTransaction(actions: (prisma: Prisma.TransactionClient) => Promise<any>): Promise<any>;
11
+ executeTransaction<T>(actions: (tx: Omit<PrismaClient, '$connect' | '$disconnect' | '$on' | '$transaction' | '$extends'>) => Promise<T>): Promise<T>;
16
12
  isHealthy(): Promise<HealthIndicatorResult>;
17
13
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PrismaService=void 0;const e=require("tslib"),t=require("@nestjs/common"),r=require("@nestjs/config"),s=require("@prisma/client"),a=e.__importStar(require("lodash"));let n=class extends s.PrismaClient{constructor(e){super({datasources:{db:{url:e.get("database.url",{infer:!0})}}}),this.configService=e}async onModuleInit(){await this.$connect()}async onModuleDestroy(){await this.$disconnect()}async executeRawQuery(e,...t){try{let r=[],s=[];Array.isArray(t[t.length-1])&&(r=t.pop()),s=t;const{queryObj:a,sql:n,queryParams:i}=this.getQueryDetails(e,...s),c=r.length>0?this.sanitizeData(i,r):i,o=await this.$queryRawUnsafe(n,...c);let u;return u="SELECT_ONE"===a.type||"INSERT"===a.type?o.length>0?o[0]:null:o,u}catch(e){throw e}}getQueryDetails(e,...t){const r=e(),s=r.syntax(...t),a=r.params(...t);return{queryObj:r,sql:s,queryParams:a}}sanitizeData(e,t){if("object"==typeof e&&null!==e&&!(e instanceof Array)){const r={...e};for(const[e,s]of Object.entries(r))t.includes(e)&&"string"==typeof s&&(r[e]=s.replace(/'/g,"''"));return r}return e}async executeRawQueryOld(e=null,t=null,r=[]){const s=Object.assign({},t);if("object"==typeof t&&t instanceof Object&&!(t instanceof Array))for(const[e,t]of Object.entries(s)){if(r.includes(e)){const r=t;s[e]=r.replace(/'/g,"''")}}let n;n=t?e.syntax("object"==typeof t&&t instanceof Object&&!(t instanceof Array)?s:t):e.syntax();const i=await this.$queryRawUnsafe(n);let c;return c="SELECT_ONE"==e.type||"INSERT"==e.type?a.isEmpty(i)?null:i[0]:i,c}async executeTransaction(e){return this.$transaction(e)}async isHealthy(){try{return await(this.$queryRaw`SELECT 1`),{prisma:{status:"up"}}}catch(e){return{prisma:{status:"down",error:e instanceof Error?e.message:"Unknown error"}}}}};exports.PrismaService=n,exports.PrismaService=n=e.__decorate([(0,t.Injectable)(),e.__metadata("design:paramtypes",[r.ConfigService])],n);
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PrismaService=void 0;const e=require("tslib"),t=require("@nestjs/common"),r=e.__importStar(require("lodash")),s=require("../generated/prisma/client");let n=class extends s.PrismaClient{async onModuleInit(){await this.$connect()}async onModuleDestroy(){await this.$disconnect()}async executeRawQuery(e,...t){try{let r=[],s=[];Array.isArray(t[t.length-1])&&(r=t.pop()),s=t;const{queryObj:n,sql:a,queryParams:i}=this.getQueryDetails(e,...s),c=r.length>0?this.sanitizeData(i,r):i,o=await this.$queryRawUnsafe(a,...c);let u;return u="SELECT_ONE"===n.type||"INSERT"===n.type?o.length>0?o[0]:null:o,u}catch(e){throw e}}getQueryDetails(e,...t){const r=e(),s=r.syntax(...t),n=r.params(...t);return{queryObj:r,sql:s,queryParams:n}}sanitizeData(e,t){if("object"==typeof e&&null!==e&&!(e instanceof Array)){const r={...e};for(const[e,s]of Object.entries(r))t.includes(e)&&"string"==typeof s&&(r[e]=s.replace(/'/g,"''"));return r}return e}async executeRawQueryOld(e=null,t=null,s=[]){const n=Object.assign({},t);if("object"==typeof t&&t instanceof Object&&!(t instanceof Array))for(const[e,t]of Object.entries(n)){if(s.includes(e)){const r=t;n[e]=r.replace(/'/g,"''")}}let a;a=t?e.syntax("object"==typeof t&&t instanceof Object&&!(t instanceof Array)?n:t):e.syntax();const i=await this.$queryRawUnsafe(a);let c;return c="SELECT_ONE"==e.type||"INSERT"==e.type?r.isEmpty(i)?null:i[0]:i,c}async executeTransaction(e){return this.$transaction(e)}async isHealthy(){try{return await(this.$queryRaw`SELECT 1`),{prisma:{status:"up"}}}catch(e){return{prisma:{status:"down",error:e instanceof Error?e.message:"Unknown error"}}}}};exports.PrismaService=n,exports.PrismaService=n=e.__decorate([(0,t.Injectable)()],n);
@@ -0,0 +1,4 @@
1
+ import * as Prisma from './internal/prismaNamespaceBrowser';
2
+ export { Prisma };
3
+ export * as $Enums from './enums';
4
+ export * from './enums';
@@ -0,0 +1,8 @@
1
+ import * as runtime from '@prisma/client/runtime/client';
2
+ import * as $Class from './internal/class';
3
+ import * as Prisma from './internal/prismaNamespace';
4
+ export * as $Enums from './enums';
5
+ export * from './enums';
6
+ export declare const PrismaClient: $Class.PrismaClientConstructor;
7
+ export type PrismaClient<LogOpts extends Prisma.LogLevel = never, OmitOpts extends Prisma.PrismaClientOptions['omit'] = Prisma.PrismaClientOptions['omit'], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = $Class.PrismaClient<LogOpts, OmitOpts, ExtArgs>;
8
+ export { Prisma };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ import * as runtime from '@prisma/client/runtime/client';
2
+ import type * as Prisma from './prismaNamespace';
3
+ export type LogOptions<ClientOptions extends Prisma.PrismaClientOptions> = 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never;
4
+ export interface PrismaClientConstructor {
5
+ new <Options extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions, LogOpts extends LogOptions<Options> = LogOptions<Options>, OmitOpts extends Prisma.PrismaClientOptions['omit'] = Options extends {
6
+ omit: infer U;
7
+ } ? U : Prisma.PrismaClientOptions['omit'], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs>(options: Prisma.Subset<Options, Prisma.PrismaClientOptions>): PrismaClient<LogOpts, OmitOpts, ExtArgs>;
8
+ }
9
+ export interface PrismaClient<in LogOpts extends Prisma.LogLevel = never, in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = undefined, in out ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> {
10
+ [K: symbol]: {
11
+ types: Prisma.TypeMap<ExtArgs>['other'];
12
+ };
13
+ $on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;
14
+ $connect(): runtime.Types.Utils.JsPromise<void>;
15
+ $disconnect(): runtime.Types.Utils.JsPromise<void>;
16
+ $executeRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<number>;
17
+ $executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;
18
+ $queryRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<T>;
19
+ $queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;
20
+ $transaction<P extends Prisma.PrismaPromise<any>[]>(arg: [...P], options?: {
21
+ isolationLevel?: Prisma.TransactionIsolationLevel;
22
+ }): runtime.Types.Utils.JsPromise<runtime.Types.Utils.UnwrapTuple<P>>;
23
+ $transaction<R>(fn: (prisma: Omit<PrismaClient, runtime.ITXClientDenyList>) => runtime.Types.Utils.JsPromise<R>, options?: {
24
+ maxWait?: number;
25
+ timeout?: number;
26
+ isolationLevel?: Prisma.TransactionIsolationLevel;
27
+ }): runtime.Types.Utils.JsPromise<R>;
28
+ $extends: runtime.Types.Extensions.ExtendsHook<'extends', Prisma.TypeMapCb<OmitOpts>, ExtArgs, runtime.Types.Utils.Call<Prisma.TypeMapCb<OmitOpts>, {
29
+ extArgs: ExtArgs;
30
+ }>>;
31
+ }
32
+ export declare function getPrismaClientClass(): PrismaClientConstructor;
@@ -0,0 +1,248 @@
1
+ import * as runtime from '@prisma/client/runtime/client';
2
+ import { type PrismaClient } from './class';
3
+ export type * from '../models';
4
+ export type DMMF = typeof runtime.DMMF;
5
+ export type PrismaPromise<T> = runtime.Types.Public.PrismaPromise<T>;
6
+ export declare const PrismaClientKnownRequestError: typeof runtime.PrismaClientKnownRequestError;
7
+ export type PrismaClientKnownRequestError = runtime.PrismaClientKnownRequestError;
8
+ export declare const PrismaClientUnknownRequestError: typeof runtime.PrismaClientUnknownRequestError;
9
+ export type PrismaClientUnknownRequestError = runtime.PrismaClientUnknownRequestError;
10
+ export declare const PrismaClientRustPanicError: typeof runtime.PrismaClientRustPanicError;
11
+ export type PrismaClientRustPanicError = runtime.PrismaClientRustPanicError;
12
+ export declare const PrismaClientInitializationError: typeof runtime.PrismaClientInitializationError;
13
+ export type PrismaClientInitializationError = runtime.PrismaClientInitializationError;
14
+ export declare const PrismaClientValidationError: typeof runtime.PrismaClientValidationError;
15
+ export type PrismaClientValidationError = runtime.PrismaClientValidationError;
16
+ export declare const sql: typeof runtime.sqltag;
17
+ export declare const empty: runtime.Sql;
18
+ export declare const join: typeof runtime.join;
19
+ export declare const raw: typeof runtime.raw;
20
+ export declare const Sql: typeof runtime.Sql;
21
+ export type Sql = runtime.Sql;
22
+ export declare const Decimal: typeof runtime.Decimal;
23
+ export type Decimal = runtime.Decimal;
24
+ export type DecimalJsLike = runtime.DecimalJsLike;
25
+ export type Extension = runtime.Types.Extensions.UserArgs;
26
+ export declare const getExtensionContext: typeof runtime.Extensions.getExtensionContext;
27
+ export type Args<T, F extends runtime.Operation> = runtime.Types.Public.Args<T, F>;
28
+ export type Payload<T, F extends runtime.Operation = never> = runtime.Types.Public.Payload<T, F>;
29
+ export type Result<T, A, F extends runtime.Operation> = runtime.Types.Public.Result<T, A, F>;
30
+ export type Exact<A, W> = runtime.Types.Public.Exact<A, W>;
31
+ export type PrismaVersion = {
32
+ client: string;
33
+ engine: string;
34
+ };
35
+ export declare const prismaVersion: PrismaVersion;
36
+ export type Bytes = runtime.Bytes;
37
+ export type JsonObject = runtime.JsonObject;
38
+ export type JsonArray = runtime.JsonArray;
39
+ export type JsonValue = runtime.JsonValue;
40
+ export type InputJsonObject = runtime.InputJsonObject;
41
+ export type InputJsonArray = runtime.InputJsonArray;
42
+ export type InputJsonValue = runtime.InputJsonValue;
43
+ export declare const NullTypes: {
44
+ DbNull: new (secret: never) => typeof runtime.DbNull;
45
+ JsonNull: new (secret: never) => typeof runtime.JsonNull;
46
+ AnyNull: new (secret: never) => typeof runtime.AnyNull;
47
+ };
48
+ export declare const DbNull: runtime.DbNullClass;
49
+ export declare const JsonNull: runtime.JsonNullClass;
50
+ export declare const AnyNull: runtime.AnyNullClass;
51
+ type SelectAndInclude = {
52
+ select: any;
53
+ include: any;
54
+ };
55
+ type SelectAndOmit = {
56
+ select: any;
57
+ omit: any;
58
+ };
59
+ type Prisma__Pick<T, K extends keyof T> = {
60
+ [P in K]: T[P];
61
+ };
62
+ export type Enumerable<T> = T | Array<T>;
63
+ export type Subset<T, U> = {
64
+ [key in keyof T]: key extends keyof U ? T[key] : never;
65
+ };
66
+ export type SelectSubset<T, U> = {
67
+ [key in keyof T]: key extends keyof U ? T[key] : never;
68
+ } & (T extends SelectAndInclude ? 'Please either choose `select` or `include`.' : T extends SelectAndOmit ? 'Please either choose `select` or `omit`.' : {});
69
+ export type SubsetIntersection<T, U, K> = {
70
+ [key in keyof T]: key extends keyof U ? T[key] : never;
71
+ } & K;
72
+ type Without<T, U> = {
73
+ [P in Exclude<keyof T, keyof U>]?: never;
74
+ };
75
+ export type XOR<T, U> = T extends object ? U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : U : T;
76
+ type IsObject<T extends any> = T extends Array<any> ? False : T extends Date ? False : T extends Uint8Array ? False : T extends BigInt ? False : T extends object ? True : False;
77
+ export type UnEnumerate<T extends unknown> = T extends Array<infer U> ? U : T;
78
+ type __Either<O extends object, K extends Key> = Omit<O, K> & {
79
+ [P in K]: Prisma__Pick<O, P & keyof O>;
80
+ }[K];
81
+ type EitherStrict<O extends object, K extends Key> = Strict<__Either<O, K>>;
82
+ type EitherLoose<O extends object, K extends Key> = ComputeRaw<__Either<O, K>>;
83
+ type _Either<O extends object, K extends Key, strict extends Boolean> = {
84
+ 1: EitherStrict<O, K>;
85
+ 0: EitherLoose<O, K>;
86
+ }[strict];
87
+ export type Either<O extends object, K extends Key, strict extends Boolean = 1> = O extends unknown ? _Either<O, K, strict> : never;
88
+ export type Union = any;
89
+ export type PatchUndefined<O extends object, O1 extends object> = {
90
+ [K in keyof O]: O[K] extends undefined ? At<O1, K> : O[K];
91
+ } & {};
92
+ export type IntersectOf<U extends Union> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
93
+ export type Overwrite<O extends object, O1 extends object> = {
94
+ [K in keyof O]: K extends keyof O1 ? O1[K] : O[K];
95
+ } & {};
96
+ type _Merge<U extends object> = IntersectOf<Overwrite<U, {
97
+ [K in keyof U]-?: At<U, K>;
98
+ }>>;
99
+ type Key = string | number | symbol;
100
+ type AtStrict<O extends object, K extends Key> = O[K & keyof O];
101
+ type AtLoose<O extends object, K extends Key> = O extends unknown ? AtStrict<O, K> : never;
102
+ export type At<O extends object, K extends Key, strict extends Boolean = 1> = {
103
+ 1: AtStrict<O, K>;
104
+ 0: AtLoose<O, K>;
105
+ }[strict];
106
+ export type ComputeRaw<A extends any> = A extends Function ? A : {
107
+ [K in keyof A]: A[K];
108
+ } & {};
109
+ export type OptionalFlat<O> = {
110
+ [K in keyof O]?: O[K];
111
+ } & {};
112
+ type _Record<K extends keyof any, T> = {
113
+ [P in K]: T;
114
+ };
115
+ type NoExpand<T> = T extends unknown ? T : never;
116
+ export type AtLeast<O extends object, K extends string> = NoExpand<O extends unknown ? (K extends keyof O ? {
117
+ [P in K]: O[P];
118
+ } & O : O) | ({
119
+ [P in keyof O as P extends K ? P : never]-?: O[P];
120
+ } & O) : never>;
121
+ type _Strict<U, _U = U> = U extends unknown ? U & OptionalFlat<_Record<Exclude<Keys<_U>, keyof U>, never>> : never;
122
+ export type Strict<U extends object> = ComputeRaw<_Strict<U>>;
123
+ export type Merge<U extends object> = ComputeRaw<_Merge<Strict<U>>>;
124
+ export type Boolean = True | False;
125
+ export type True = 1;
126
+ export type False = 0;
127
+ export type Not<B extends Boolean> = {
128
+ 0: 1;
129
+ 1: 0;
130
+ }[B];
131
+ export type Extends<A1 extends any, A2 extends any> = [A1] extends [never] ? 0 : A1 extends A2 ? 1 : 0;
132
+ export type Has<U extends Union, U1 extends Union> = Not<Extends<Exclude<U1, U>, U1>>;
133
+ export type Or<B1 extends Boolean, B2 extends Boolean> = {
134
+ 0: {
135
+ 0: 0;
136
+ 1: 1;
137
+ };
138
+ 1: {
139
+ 0: 1;
140
+ 1: 1;
141
+ };
142
+ }[B1][B2];
143
+ export type Keys<U extends Union> = U extends unknown ? keyof U : never;
144
+ export type GetScalarType<T, O> = O extends object ? {
145
+ [P in keyof T]: P extends keyof O ? O[P] : never;
146
+ } : never;
147
+ type FieldPaths<T, U = Omit<T, '_avg' | '_sum' | '_count' | '_min' | '_max'>> = IsObject<T> extends True ? U : T;
148
+ export type GetHavingFields<T> = {
149
+ [K in keyof T]: Or<Or<Extends<'OR', K>, Extends<'AND', K>>, Extends<'NOT', K>> extends True ? T[K] extends infer TK ? GetHavingFields<UnEnumerate<TK> extends object ? Merge<UnEnumerate<TK>> : never> : never : {} extends FieldPaths<T[K]> ? never : K;
150
+ }[keyof T];
151
+ type _TupleToUnion<T> = T extends (infer E)[] ? E : never;
152
+ type TupleToUnion<K extends readonly any[]> = _TupleToUnion<K>;
153
+ export type MaybeTupleToUnion<T> = T extends any[] ? TupleToUnion<T> : T;
154
+ export type PickEnumerable<T, K extends Enumerable<keyof T> | keyof T> = Prisma__Pick<T, MaybeTupleToUnion<K>>;
155
+ export type ExcludeUnderscoreKeys<T extends string> = T extends `_${string}` ? never : T;
156
+ export type FieldRef<Model, FieldType> = runtime.FieldRef<Model, FieldType>;
157
+ export declare const ModelName: {};
158
+ export type ModelName = (typeof ModelName)[keyof typeof ModelName];
159
+ export interface TypeMapCb<GlobalOmitOptions = {}> extends runtime.Types.Utils.Fn<{
160
+ extArgs: runtime.Types.Extensions.InternalArgs;
161
+ }, runtime.Types.Utils.Record<string, any>> {
162
+ returns: TypeMap<this['params']['extArgs'], GlobalOmitOptions>;
163
+ }
164
+ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> = {
165
+ globalOmitOptions: {
166
+ omit: GlobalOmitOptions;
167
+ };
168
+ meta: {
169
+ modelProps: never;
170
+ txIsolationLevel: TransactionIsolationLevel;
171
+ };
172
+ model: {};
173
+ } & {
174
+ other: {
175
+ payload: any;
176
+ operations: {
177
+ $executeRaw: {
178
+ args: [query: TemplateStringsArray | Sql, ...values: any[]];
179
+ result: any;
180
+ };
181
+ $executeRawUnsafe: {
182
+ args: [query: string, ...values: any[]];
183
+ result: any;
184
+ };
185
+ $queryRaw: {
186
+ args: [query: TemplateStringsArray | Sql, ...values: any[]];
187
+ result: any;
188
+ };
189
+ $queryRawUnsafe: {
190
+ args: [query: string, ...values: any[]];
191
+ result: any;
192
+ };
193
+ };
194
+ };
195
+ };
196
+ export declare const TransactionIsolationLevel: {
197
+ readonly ReadUncommitted: "ReadUncommitted";
198
+ readonly ReadCommitted: "ReadCommitted";
199
+ readonly RepeatableRead: "RepeatableRead";
200
+ readonly Serializable: "Serializable";
201
+ };
202
+ export type TransactionIsolationLevel = (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel];
203
+ export type BatchPayload = {
204
+ count: number;
205
+ };
206
+ export declare const defineExtension: runtime.Types.Extensions.ExtendsHook<"define", TypeMapCb, runtime.Types.Extensions.DefaultArgs>;
207
+ export type DefaultPrismaClient = PrismaClient;
208
+ export type ErrorFormat = 'pretty' | 'colorless' | 'minimal';
209
+ export type PrismaClientOptions = ({
210
+ adapter: runtime.SqlDriverAdapterFactory;
211
+ accelerateUrl?: never;
212
+ } | {
213
+ accelerateUrl: string;
214
+ adapter?: never;
215
+ }) & {
216
+ errorFormat?: ErrorFormat;
217
+ log?: (LogLevel | LogDefinition)[];
218
+ transactionOptions?: {
219
+ maxWait?: number;
220
+ timeout?: number;
221
+ isolationLevel?: TransactionIsolationLevel;
222
+ };
223
+ omit?: GlobalOmitConfig;
224
+ comments?: runtime.SqlCommenterPlugin[];
225
+ };
226
+ export type GlobalOmitConfig = {};
227
+ export type LogLevel = 'info' | 'query' | 'warn' | 'error';
228
+ export type LogDefinition = {
229
+ level: LogLevel;
230
+ emit: 'stdout' | 'event';
231
+ };
232
+ export type CheckIsLogLevel<T> = T extends LogLevel ? T : never;
233
+ export type GetLogType<T> = CheckIsLogLevel<T extends LogDefinition ? T['level'] : T>;
234
+ export type GetEvents<T extends any[]> = T extends Array<LogLevel | LogDefinition> ? GetLogType<T[number]> : never;
235
+ export type QueryEvent = {
236
+ timestamp: Date;
237
+ query: string;
238
+ params: string;
239
+ duration: number;
240
+ target: string;
241
+ };
242
+ export type LogEvent = {
243
+ timestamp: Date;
244
+ message: string;
245
+ target: string;
246
+ };
247
+ export type PrismaAction = 'findUnique' | 'findUniqueOrThrow' | 'findMany' | 'findFirst' | 'findFirstOrThrow' | 'create' | 'createMany' | 'createManyAndReturn' | 'update' | 'updateMany' | 'updateManyAndReturn' | 'upsert' | 'delete' | 'deleteMany' | 'executeRaw' | 'queryRaw' | 'aggregate' | 'count' | 'runCommandRaw' | 'findRaw' | 'groupBy';
248
+ export type TransactionClient = Omit<DefaultPrismaClient, runtime.ITXClientDenyList>;
@@ -0,0 +1,21 @@
1
+ import * as runtime from '@prisma/client/runtime/index-browser';
2
+ export type * from '../models';
3
+ export type * from './prismaNamespace';
4
+ export declare const Decimal: typeof runtime.Decimal;
5
+ export declare const NullTypes: {
6
+ DbNull: new (secret: never) => typeof runtime.DbNull;
7
+ JsonNull: new (secret: never) => typeof runtime.JsonNull;
8
+ AnyNull: new (secret: never) => typeof runtime.AnyNull;
9
+ };
10
+ export declare const DbNull: import("@prisma/client-runtime-utils").DbNullClass;
11
+ export declare const JsonNull: import("@prisma/client-runtime-utils").JsonNullClass;
12
+ export declare const AnyNull: import("@prisma/client-runtime-utils").AnyNullClass;
13
+ export declare const ModelName: {};
14
+ export type ModelName = (typeof ModelName)[keyof typeof ModelName];
15
+ export declare const TransactionIsolationLevel: {
16
+ readonly ReadUncommitted: "ReadUncommitted";
17
+ readonly ReadCommitted: "ReadCommitted";
18
+ readonly RepeatableRead: "RepeatableRead";
19
+ readonly Serializable: "Serializable";
20
+ };
21
+ export type TransactionIsolationLevel = (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel];
@@ -0,0 +1 @@
1
+ export type * from './commonInputTypes';
@@ -1,17 +1,13 @@
1
1
  import { OnModuleInit, OnModuleDestroy } from '@nestjs/common';
2
- import { ConfigService } from '@nestjs/config';
3
2
  import { HealthIndicatorResult } from '@nestjs/terminus';
4
- import { AllConfigType } from '@infineit-nestjs/types';
5
- import { Prisma, PrismaClient } from '@prisma/client';
3
+ import { PrismaClient } from '../generated/prisma/client';
6
4
  export declare class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
7
- private readonly configService;
8
- constructor(configService: ConfigService<AllConfigType>);
9
5
  onModuleInit(): Promise<void>;
10
6
  onModuleDestroy(): Promise<void>;
11
7
  executeRawQuery<T>(queryMethod: Function, ...args: any[]): Promise<T | T[] | null>;
12
8
  private getQueryDetails;
13
9
  private sanitizeData;
14
10
  executeRawQueryOld(queryObj?: any, data?: any, fields?: string[]): Promise<any>;
15
- executeTransaction(actions: (prisma: Prisma.TransactionClient) => Promise<any>): Promise<any>;
11
+ executeTransaction<T>(actions: (tx: Omit<PrismaClient, '$connect' | '$disconnect' | '$on' | '$transaction' | '$extends'>) => Promise<T>): Promise<T>;
16
12
  isHealthy(): Promise<HealthIndicatorResult>;
17
13
  }
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.PrismaService=void 0;const e=require("tslib"),t=require("@nestjs/common"),r=require("@nestjs/config"),s=require("@prisma/client"),a=e.__importStar(require("lodash"));let n=class extends s.PrismaClient{constructor(e){super({datasources:{db:{url:e.get("database.url",{infer:!0})}}}),this.configService=e}async onModuleInit(){await this.$connect()}async onModuleDestroy(){await this.$disconnect()}async executeRawQuery(e,...t){try{let r=[],s=[];Array.isArray(t[t.length-1])&&(r=t.pop()),s=t;const{queryObj:a,sql:n,queryParams:i}=this.getQueryDetails(e,...s),c=r.length>0?this.sanitizeData(i,r):i,o=await this.$queryRawUnsafe(n,...c);let u;return u="SELECT_ONE"===a.type||"INSERT"===a.type?o.length>0?o[0]:null:o,u}catch(e){throw e}}getQueryDetails(e,...t){const r=e(),s=r.syntax(...t),a=r.params(...t);return{queryObj:r,sql:s,queryParams:a}}sanitizeData(e,t){if("object"==typeof e&&null!==e&&!(e instanceof Array)){const r={...e};for(const[e,s]of Object.entries(r))t.includes(e)&&"string"==typeof s&&(r[e]=s.replace(/'/g,"''"));return r}return e}async executeRawQueryOld(e=null,t=null,r=[]){const s=Object.assign({},t);if("object"==typeof t&&t instanceof Object&&!(t instanceof Array))for(const[e,t]of Object.entries(s)){if(r.includes(e)){const r=t;s[e]=r.replace(/'/g,"''")}}let n;n=t?e.syntax("object"==typeof t&&t instanceof Object&&!(t instanceof Array)?s:t):e.syntax();const i=await this.$queryRawUnsafe(n);let c;return c="SELECT_ONE"==e.type||"INSERT"==e.type?a.isEmpty(i)?null:i[0]:i,c}async executeTransaction(e){return this.$transaction(e)}async isHealthy(){try{return await(this.$queryRaw`SELECT 1`),{prisma:{status:"up"}}}catch(e){return{prisma:{status:"down",error:e instanceof Error?e.message:"Unknown error"}}}}};exports.PrismaService=n,exports.PrismaService=n=e.__decorate([(0,t.Injectable)(),e.__metadata("design:paramtypes",[r.ConfigService])],n);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.PrismaService=void 0;const e=require("tslib"),t=require("@nestjs/common"),r=e.__importStar(require("lodash")),s=require("../generated/prisma/client");let n=class extends s.PrismaClient{async onModuleInit(){await this.$connect()}async onModuleDestroy(){await this.$disconnect()}async executeRawQuery(e,...t){try{let r=[],s=[];Array.isArray(t[t.length-1])&&(r=t.pop()),s=t;const{queryObj:n,sql:a,queryParams:i}=this.getQueryDetails(e,...s),c=r.length>0?this.sanitizeData(i,r):i,o=await this.$queryRawUnsafe(a,...c);let u;return u="SELECT_ONE"===n.type||"INSERT"===n.type?o.length>0?o[0]:null:o,u}catch(e){throw e}}getQueryDetails(e,...t){const r=e(),s=r.syntax(...t),n=r.params(...t);return{queryObj:r,sql:s,queryParams:n}}sanitizeData(e,t){if("object"==typeof e&&null!==e&&!(e instanceof Array)){const r={...e};for(const[e,s]of Object.entries(r))t.includes(e)&&"string"==typeof s&&(r[e]=s.replace(/'/g,"''"));return r}return e}async executeRawQueryOld(e=null,t=null,s=[]){const n=Object.assign({},t);if("object"==typeof t&&t instanceof Object&&!(t instanceof Array))for(const[e,t]of Object.entries(n)){if(s.includes(e)){const r=t;n[e]=r.replace(/'/g,"''")}}let a;a=t?e.syntax("object"==typeof t&&t instanceof Object&&!(t instanceof Array)?n:t):e.syntax();const i=await this.$queryRawUnsafe(a);let c;return c="SELECT_ONE"==e.type||"INSERT"==e.type?r.isEmpty(i)?null:i[0]:i,c}async executeTransaction(e){return this.$transaction(e)}async isHealthy(){try{return await(this.$queryRaw`SELECT 1`),{prisma:{status:"up"}}}catch(e){return{prisma:{status:"down",error:e instanceof Error?e.message:"Unknown error"}}}}};exports.PrismaService=n,exports.PrismaService=n=e.__decorate([(0,t.Injectable)()],n);
@@ -0,0 +1,8 @@
1
+ import * as runtime from '@prisma/client/runtime/client';
2
+ import { PrismaClientConstructor, PrismaClient as PrismaClient$1 } from './internal/class.js';
3
+ import { LogLevel, PrismaClientOptions } from './internal/prismaNamespace.js';
4
+
5
+ declare const PrismaClient: PrismaClientConstructor;
6
+ type PrismaClient<LogOpts extends LogLevel = never, OmitOpts extends PrismaClientOptions['omit'] = PrismaClientOptions['omit'], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = PrismaClient$1<LogOpts, OmitOpts, ExtArgs>;
7
+
8
+ export { PrismaClient };
@@ -0,0 +1,34 @@
1
+ import * as runtime from '@prisma/client/runtime/client';
2
+ import { PrismaClientOptions, LogLevel, LogDefinition, GetEvents, Subset, TypeMap, QueryEvent, LogEvent, Sql, PrismaPromise, TransactionIsolationLevel, TypeMapCb } from './prismaNamespace.js';
3
+
4
+ type LogOptions<ClientOptions extends PrismaClientOptions> = 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<LogLevel | LogDefinition> ? GetEvents<ClientOptions['log']> : never : never;
5
+ interface PrismaClientConstructor {
6
+ new <Options extends PrismaClientOptions = PrismaClientOptions, LogOpts extends LogOptions<Options> = LogOptions<Options>, OmitOpts extends PrismaClientOptions['omit'] = Options extends {
7
+ omit: infer U;
8
+ } ? U : PrismaClientOptions['omit'], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs>(options: Subset<Options, PrismaClientOptions>): PrismaClient<LogOpts, OmitOpts, ExtArgs>;
9
+ }
10
+ interface PrismaClient<in LogOpts extends LogLevel = never, in out OmitOpts extends PrismaClientOptions['omit'] = undefined, in out ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> {
11
+ [K: symbol]: {
12
+ types: TypeMap<ExtArgs>['other'];
13
+ };
14
+ $on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? QueryEvent : LogEvent) => void): PrismaClient;
15
+ $connect(): runtime.Types.Utils.JsPromise<void>;
16
+ $disconnect(): runtime.Types.Utils.JsPromise<void>;
17
+ $executeRaw<T = unknown>(query: TemplateStringsArray | Sql, ...values: any[]): PrismaPromise<number>;
18
+ $executeRawUnsafe<T = unknown>(query: string, ...values: any[]): PrismaPromise<number>;
19
+ $queryRaw<T = unknown>(query: TemplateStringsArray | Sql, ...values: any[]): PrismaPromise<T>;
20
+ $queryRawUnsafe<T = unknown>(query: string, ...values: any[]): PrismaPromise<T>;
21
+ $transaction<P extends PrismaPromise<any>[]>(arg: [...P], options?: {
22
+ isolationLevel?: TransactionIsolationLevel;
23
+ }): runtime.Types.Utils.JsPromise<runtime.Types.Utils.UnwrapTuple<P>>;
24
+ $transaction<R>(fn: (prisma: Omit<PrismaClient, runtime.ITXClientDenyList>) => runtime.Types.Utils.JsPromise<R>, options?: {
25
+ maxWait?: number;
26
+ timeout?: number;
27
+ isolationLevel?: TransactionIsolationLevel;
28
+ }): runtime.Types.Utils.JsPromise<R>;
29
+ $extends: runtime.Types.Extensions.ExtendsHook<'extends', TypeMapCb<OmitOpts>, ExtArgs, runtime.Types.Utils.Call<TypeMapCb<OmitOpts>, {
30
+ extArgs: ExtArgs;
31
+ }>>;
32
+ }
33
+
34
+ export type { LogOptions, PrismaClient, PrismaClientConstructor };
@@ -0,0 +1,94 @@
1
+ import * as runtime from '@prisma/client/runtime/client';
2
+
3
+ type PrismaPromise<T> = runtime.Types.Public.PrismaPromise<T>;
4
+ declare const Sql: typeof runtime.Sql;
5
+ type Sql = runtime.Sql;
6
+ type Subset<T, U> = {
7
+ [key in keyof T]: key extends keyof U ? T[key] : never;
8
+ };
9
+ interface TypeMapCb<GlobalOmitOptions = {}> extends runtime.Types.Utils.Fn<{
10
+ extArgs: runtime.Types.Extensions.InternalArgs;
11
+ }, runtime.Types.Utils.Record<string, any>> {
12
+ returns: TypeMap<this['params']['extArgs'], GlobalOmitOptions>;
13
+ }
14
+ type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> = {
15
+ globalOmitOptions: {
16
+ omit: GlobalOmitOptions;
17
+ };
18
+ meta: {
19
+ modelProps: never;
20
+ txIsolationLevel: TransactionIsolationLevel;
21
+ };
22
+ model: {};
23
+ } & {
24
+ other: {
25
+ payload: any;
26
+ operations: {
27
+ $executeRaw: {
28
+ args: [query: TemplateStringsArray | Sql, ...values: any[]];
29
+ result: any;
30
+ };
31
+ $executeRawUnsafe: {
32
+ args: [query: string, ...values: any[]];
33
+ result: any;
34
+ };
35
+ $queryRaw: {
36
+ args: [query: TemplateStringsArray | Sql, ...values: any[]];
37
+ result: any;
38
+ };
39
+ $queryRawUnsafe: {
40
+ args: [query: string, ...values: any[]];
41
+ result: any;
42
+ };
43
+ };
44
+ };
45
+ };
46
+ declare const TransactionIsolationLevel: {
47
+ readonly ReadUncommitted: "ReadUncommitted";
48
+ readonly ReadCommitted: "ReadCommitted";
49
+ readonly RepeatableRead: "RepeatableRead";
50
+ readonly Serializable: "Serializable";
51
+ };
52
+ type TransactionIsolationLevel = (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel];
53
+ type ErrorFormat = 'pretty' | 'colorless' | 'minimal';
54
+ type PrismaClientOptions = ({
55
+ adapter: runtime.SqlDriverAdapterFactory;
56
+ accelerateUrl?: never;
57
+ } | {
58
+ accelerateUrl: string;
59
+ adapter?: never;
60
+ }) & {
61
+ errorFormat?: ErrorFormat;
62
+ log?: (LogLevel | LogDefinition)[];
63
+ transactionOptions?: {
64
+ maxWait?: number;
65
+ timeout?: number;
66
+ isolationLevel?: TransactionIsolationLevel;
67
+ };
68
+ omit?: GlobalOmitConfig;
69
+ comments?: runtime.SqlCommenterPlugin[];
70
+ };
71
+ type GlobalOmitConfig = {};
72
+ type LogLevel = 'info' | 'query' | 'warn' | 'error';
73
+ type LogDefinition = {
74
+ level: LogLevel;
75
+ emit: 'stdout' | 'event';
76
+ };
77
+ type CheckIsLogLevel<T> = T extends LogLevel ? T : never;
78
+ type GetLogType<T> = CheckIsLogLevel<T extends LogDefinition ? T['level'] : T>;
79
+ type GetEvents<T extends any[]> = T extends Array<LogLevel | LogDefinition> ? GetLogType<T[number]> : never;
80
+ type QueryEvent = {
81
+ timestamp: Date;
82
+ query: string;
83
+ params: string;
84
+ duration: number;
85
+ target: string;
86
+ };
87
+ type LogEvent = {
88
+ timestamp: Date;
89
+ message: string;
90
+ target: string;
91
+ };
92
+
93
+ export { Sql, TransactionIsolationLevel };
94
+ export type { CheckIsLogLevel, ErrorFormat, GetEvents, GetLogType, GlobalOmitConfig, LogDefinition, LogEvent, LogLevel, PrismaClientOptions, PrismaPromise, QueryEvent, Subset, TypeMap, TypeMapCb };
@@ -1,19 +1,15 @@
1
1
  import { OnModuleInit, OnModuleDestroy } from '@nestjs/common';
2
- import { ConfigService } from '@nestjs/config';
3
2
  import { HealthIndicatorResult } from '@nestjs/terminus';
4
- import { AllConfigType } from '@infineit-nestjs/types';
5
- import { PrismaClient, Prisma } from '@prisma/client';
3
+ import { PrismaClient } from '../generated/prisma/client.js';
6
4
 
7
5
  declare class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
8
- private readonly configService;
9
- constructor(configService: ConfigService<AllConfigType>);
10
6
  onModuleInit(): Promise<void>;
11
7
  onModuleDestroy(): Promise<void>;
12
8
  executeRawQuery<T>(queryMethod: Function, ...args: any[]): Promise<T | T[] | null>;
13
9
  private getQueryDetails;
14
10
  private sanitizeData;
15
11
  executeRawQueryOld(queryObj?: any, data?: any, fields?: string[]): Promise<any>;
16
- executeTransaction(actions: (prisma: Prisma.TransactionClient) => Promise<any>): Promise<any>;
12
+ executeTransaction<T>(actions: (tx: Omit<PrismaClient, '$connect' | '$disconnect' | '$on' | '$transaction' | '$extends'>) => Promise<T>): Promise<T>;
17
13
  isHealthy(): Promise<HealthIndicatorResult>;
18
14
  }
19
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infineit-nestjs/services",
3
- "version": "1.0.41",
3
+ "version": "1.0.43",
4
4
  "main": "./dist/cjs/index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -49,12 +49,12 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@infineit-nestjs/types": "1.0.11",
52
- "@infineit-nestjs/utils": "1.0.37",
52
+ "@infineit-nestjs/utils": "1.0.38",
53
53
  "@infineit/winston-logger": "^1.0.30",
54
54
  "@nestjs/axios": "^4.0.0",
55
55
  "@nestjs/microservices": "^11.1.2",
56
56
  "@nestjs/terminus": "^11.0.0",
57
- "@prisma/client": "^6.5.0",
57
+ "@prisma/client": "7.1.0",
58
58
  "argon2": "^0.41.1",
59
59
  "axios-retry": "^4.5.0",
60
60
  "ioredis": "^5.6.1",
@@ -114,5 +114,5 @@
114
114
  "node": ">=18.0.0",
115
115
  "npm": ">=9.0.0"
116
116
  },
117
- "gitHead": "fe06666bec17125beb6faafc6860e5eeb6385115"
117
+ "gitHead": "c2ca4146d1061190fe4acc9c9dcca1a83af7b438"
118
118
  }