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 =
|
|
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