whatap 0.5.10 → 0.5.11

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.
@@ -57,17 +57,29 @@ PrismaObserver.prototype.inject = function(mod, moduleName) {
57
57
  if (mod.PrismaClient) {
58
58
  // 직접 PrismaClient 생성자 후킹
59
59
  shimmer.wrap(mod, 'PrismaClient', function(originalConstructor) {
60
- return function() {
61
- // 원래 생성자 호출
62
- const instance = new originalConstructor(...arguments);
60
+ return function(...args) {
61
+ const originalInstance = new originalConstructor(...args);
62
+ const instance = Object.create(originalInstance);
63
+
64
+ const prismaServicePrototype = Object.getPrototypeOf(this);
65
+ Object.getOwnPropertyNames(prismaServicePrototype).forEach((method) => {
66
+ if (typeof prismaServicePrototype[method] === "function" && !instance[method]) {
67
+ instance[method] = prismaServicePrototype[method].bind(instance);
68
+ }
69
+ });
70
+
71
+ Object.getOwnPropertyNames(originalInstance).forEach((prop) => {
72
+ if (!instance.hasOwnProperty(prop)) {
73
+ instance[prop] = originalInstance[prop];
74
+ }
75
+ });
63
76
 
64
- // 이 시점에서 instance가 생성된 Prisma 클라이언트 인스턴스
65
77
  self.patchPrismaInstance(instance);
66
78
 
67
- if(!instance[prisma_read_func_name]){
68
- instance[prisma_read_func_name] = function() {
79
+ if (!instance[prisma_read_func_name]) {
80
+ instance[prisma_read_func_name] = function () {
69
81
  return this;
70
- }
82
+ };
71
83
  }
72
84
 
73
85
  return instance;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "whatap",
3
3
  "homepage": "http://www.whatap.io",
4
- "version": "0.5.10",
5
- "releaseDate": "20250310",
4
+ "version": "0.5.11",
5
+ "releaseDate": "20250317",
6
6
  "description": "Monitoring and Profiling Service",
7
7
  "main": "index.js",
8
8
  "scripts": {},