@hedhog/prisma 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,5 +2,8 @@ import { OnModuleInit } from '@nestjs/common';
2
2
  import { PrismaClient } from '@prisma/client';
3
3
  export declare class PrismaService extends PrismaClient implements OnModuleInit {
4
4
  onModuleInit(): Promise<void>;
5
+ getProvider(): any;
6
+ isPostgres(): boolean;
7
+ isMysql(): boolean;
5
8
  }
6
9
  //# sourceMappingURL=prisma.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.service.d.ts","sourceRoot":"","sources":["../src/prisma.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBACa,aAAc,SAAQ,YAAa,YAAW,YAAY;IAC/D,YAAY;CAGnB"}
1
+ {"version":3,"file":"prisma.service.d.ts","sourceRoot":"","sources":["../src/prisma.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBACa,aAAc,SAAQ,YAAa,YAAW,YAAY;IAC/D,YAAY;IAIlB,WAAW;IAKX,UAAU;IAIV,OAAO;CAGR"}
@@ -13,6 +13,16 @@ let PrismaService = class PrismaService extends client_1.PrismaClient {
13
13
  async onModuleInit() {
14
14
  await this.$connect();
15
15
  }
16
+ getProvider() {
17
+ console.log('getProvider', this._engineConfig.activeProvider);
18
+ return this._engineConfig.activeProvider;
19
+ }
20
+ isPostgres() {
21
+ return this.getProvider() === 'postgres';
22
+ }
23
+ isMysql() {
24
+ return this.getProvider() === 'mysql';
25
+ }
16
26
  };
17
27
  exports.PrismaService = PrismaService;
18
28
  exports.PrismaService = PrismaService = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.service.js","sourceRoot":"","sources":["../src/prisma.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA0D;AAC1D,2CAA8C;AAGvC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,qBAAY;IAC7C,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;CACF,CAAA;AAJY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CAIzB"}
1
+ {"version":3,"file":"prisma.service.js","sourceRoot":"","sources":["../src/prisma.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA0D;AAC1D,2CAA8C;AAGvC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,qBAAY;IAC7C,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED,WAAW;QACT,OAAO,CAAC,GAAG,CAAC,aAAa,EAAG,IAAY,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QACvE,OAAQ,IAAY,CAAC,aAAa,CAAC,cAAc,CAAC;IACpD,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC;IAC3C,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC;IACxC,CAAC;CACF,CAAA;AAjBY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CAiBzB"}
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
- {
2
- "name": "@hedhog/prisma",
3
- "version": "0.0.2",
4
- "private": false,
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "build": "tsc && npm version patch",
8
- "prod": "npm run build && npm publish"
9
- },
10
- "keywords": [],
11
- "author": "",
12
- "license": "MIT",
13
- "description": "",
14
- "peerDependencies": {
15
- "@nestjs/common": "^10.0.0",
16
- "@nestjs/core": "^10.0.0",
17
- "@prisma/client": "^5.17.0"
18
- },
19
- "devDependencies": {
20
- "ts-node": "^10.9.1",
21
- "typescript": "^5.1.3"
22
- }
23
- }
1
+ {
2
+ "name": "@hedhog/prisma",
3
+ "version": "0.0.4",
4
+ "private": false,
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "build": "tsc && npm version patch",
8
+ "prod": "npm run build && npm publish --access public"
9
+ },
10
+ "keywords": [],
11
+ "author": "",
12
+ "license": "MIT",
13
+ "description": "",
14
+ "peerDependencies": {
15
+ "@nestjs/common": "^10.0.0",
16
+ "@nestjs/core": "^10.0.0",
17
+ "@prisma/client": "^5.19.1"
18
+ },
19
+ "devDependencies": {
20
+ "ts-node": "^10.9.1",
21
+ "typescript": "^5.1.3"
22
+ }
23
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './prisma.module';
2
+ export * from './prisma.service';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
package/src/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./prisma.module"), exports);
18
+ __exportStar(require("./prisma.service"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,mDAAiC"}
@@ -0,0 +1,3 @@
1
+ export declare class PrismaModule {
2
+ }
3
+ //# sourceMappingURL=prisma.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prisma.module.d.ts","sourceRoot":"","sources":["prisma.module.ts"],"names":[],"mappings":"AAGA,qBAIa,YAAY;CAAG"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.PrismaModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const prisma_service_1 = require("./prisma.service");
12
+ let PrismaModule = class PrismaModule {
13
+ };
14
+ exports.PrismaModule = PrismaModule;
15
+ exports.PrismaModule = PrismaModule = __decorate([
16
+ (0, common_1.Module)({
17
+ providers: [prisma_service_1.PrismaService],
18
+ exports: [prisma_service_1.PrismaService],
19
+ })
20
+ ], PrismaModule);
21
+ //# sourceMappingURL=prisma.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prisma.module.js","sourceRoot":"","sources":["prisma.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AAM1C,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,oCAAY;uBAAZ,YAAY;IAJxB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,8BAAa,CAAC;QAC1B,OAAO,EAAE,CAAC,8BAAa,CAAC;KACzB,CAAC;GACW,YAAY,CAAG"}
@@ -0,0 +1,6 @@
1
+ import { OnModuleInit } from '@nestjs/common';
2
+ import { PrismaClient } from '@prisma/client';
3
+ export declare class PrismaService extends PrismaClient implements OnModuleInit {
4
+ onModuleInit(): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=prisma.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prisma.service.d.ts","sourceRoot":"","sources":["prisma.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBACa,aAAc,SAAQ,YAAa,YAAW,YAAY;IAC/D,YAAY;CAGnB"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.PrismaService = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const client_1 = require("@prisma/client");
12
+ let PrismaService = class PrismaService extends client_1.PrismaClient {
13
+ async onModuleInit() {
14
+ await this.$connect();
15
+ }
16
+ };
17
+ exports.PrismaService = PrismaService;
18
+ exports.PrismaService = PrismaService = __decorate([
19
+ (0, common_1.Injectable)()
20
+ ], PrismaService);
21
+ //# sourceMappingURL=prisma.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prisma.service.js","sourceRoot":"","sources":["prisma.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA0D;AAC1D,2CAA8C;AAGvC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,qBAAY;IAC7C,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;CACF,CAAA;AAJY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CAIzB"}
@@ -6,4 +6,17 @@ export class PrismaService extends PrismaClient implements OnModuleInit {
6
6
  async onModuleInit() {
7
7
  await this.$connect();
8
8
  }
9
+
10
+ getProvider() {
11
+ console.log('getProvider', (this as any)._engineConfig.activeProvider);
12
+ return (this as any)._engineConfig.activeProvider;
13
+ }
14
+
15
+ isPostgres() {
16
+ return this.getProvider() === 'postgres';
17
+ }
18
+
19
+ isMysql() {
20
+ return this.getProvider() === 'mysql';
21
+ }
9
22
  }