@forklaunch/better-auth-mikro-orm-fork 0.5.1 → 0.5.2
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/lib/adapter.cjs +15 -2
- package/lib/adapter.js +16 -3
- package/package.json +1 -1
package/lib/adapter.cjs
CHANGED
|
@@ -138,9 +138,22 @@ function createAdapterUtils(orm) {
|
|
|
138
138
|
return fields;
|
|
139
139
|
};
|
|
140
140
|
const normalizeOutput = (metadata2, output) => {
|
|
141
|
-
|
|
141
|
+
try {
|
|
142
|
+
const wrapped = (0, import_core.wrap)(output, true);
|
|
143
|
+
if (wrapped.__originalEntityData) {
|
|
144
|
+
for (const prop of metadata2.props) {
|
|
145
|
+
if (prop.kind !== import_core.ReferenceKind.SCALAR) continue;
|
|
146
|
+
const val = output[prop.name];
|
|
147
|
+
if (val !== void 0) {
|
|
148
|
+
wrapped.__originalEntityData[prop.name] = val;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
} catch {
|
|
153
|
+
}
|
|
154
|
+
const serialized = (0, import_core.serialize)(output);
|
|
142
155
|
const result = {};
|
|
143
|
-
Object.entries(
|
|
156
|
+
Object.entries(serialized).map(([key, value]) => ({
|
|
144
157
|
path: getReferencedPropertyName(
|
|
145
158
|
metadata2,
|
|
146
159
|
getPropertyMetadata(metadata2, key)
|
package/lib/adapter.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import { dset as dset2 } from "dset";
|
|
6
6
|
|
|
7
7
|
// src/utils/adapterUtils.ts
|
|
8
|
-
import { ReferenceKind, serialize } from "@mikro-orm/core";
|
|
8
|
+
import { ReferenceKind, serialize, wrap } from "@mikro-orm/core";
|
|
9
9
|
import { dset } from "dset";
|
|
10
10
|
|
|
11
11
|
// src/utils/createAdapterError.ts
|
|
@@ -114,9 +114,22 @@ function createAdapterUtils(orm) {
|
|
|
114
114
|
return fields;
|
|
115
115
|
};
|
|
116
116
|
const normalizeOutput = (metadata2, output) => {
|
|
117
|
-
|
|
117
|
+
try {
|
|
118
|
+
const wrapped = wrap(output, true);
|
|
119
|
+
if (wrapped.__originalEntityData) {
|
|
120
|
+
for (const prop of metadata2.props) {
|
|
121
|
+
if (prop.kind !== ReferenceKind.SCALAR) continue;
|
|
122
|
+
const val = output[prop.name];
|
|
123
|
+
if (val !== void 0) {
|
|
124
|
+
wrapped.__originalEntityData[prop.name] = val;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
} catch {
|
|
129
|
+
}
|
|
130
|
+
const serialized = serialize(output);
|
|
118
131
|
const result = {};
|
|
119
|
-
Object.entries(
|
|
132
|
+
Object.entries(serialized).map(([key, value]) => ({
|
|
120
133
|
path: getReferencedPropertyName(
|
|
121
134
|
metadata2,
|
|
122
135
|
getPropertyMetadata(metadata2, key)
|