@famgia/omnify-typescript 2.0.34 → 2.0.35
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/dist/{chunk-XOH4DFMH.js → chunk-RBAAB73K.js} +29 -1
- package/dist/chunk-RBAAB73K.js.map +1 -0
- package/dist/index.cjs +28 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin.cjs +28 -0
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-XOH4DFMH.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/plugin.cjs
CHANGED
|
@@ -210,6 +210,34 @@ function propertyToTSProperties(propertyName, property, allSchemas, options = {}
|
|
|
210
210
|
}
|
|
211
211
|
];
|
|
212
212
|
}
|
|
213
|
+
if ((assocProp.relation === "ManyToOne" || assocProp.relation === "OneToOne") && !assocProp.mappedBy) {
|
|
214
|
+
const propBaseName = toPropertyName(propertyName);
|
|
215
|
+
const targetName = assocProp.target ?? "unknown";
|
|
216
|
+
const isNullable = baseProp.nullable ?? false;
|
|
217
|
+
let fkType = "number";
|
|
218
|
+
const targetSchema = assocProp.target ? allSchemas[assocProp.target] : void 0;
|
|
219
|
+
const effectiveIdType = assocProp.idType ?? targetSchema?.options?.idType ?? "BigInt";
|
|
220
|
+
if (effectiveIdType === "Uuid" || effectiveIdType === "String") {
|
|
221
|
+
fkType = "string";
|
|
222
|
+
}
|
|
223
|
+
return [
|
|
224
|
+
{
|
|
225
|
+
name: `${propBaseName}_id`,
|
|
226
|
+
type: fkType,
|
|
227
|
+
optional: isNullable,
|
|
228
|
+
readonly: isReadonly,
|
|
229
|
+
comment: `Foreign key for ${propertyName}`
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: propBaseName,
|
|
233
|
+
type: isNullable ? `${targetName} | null` : targetName,
|
|
234
|
+
optional: true,
|
|
235
|
+
// Relation may not be loaded
|
|
236
|
+
readonly: isReadonly,
|
|
237
|
+
comment: displayName ?? `Relation to ${targetName}`
|
|
238
|
+
}
|
|
239
|
+
];
|
|
240
|
+
}
|
|
213
241
|
}
|
|
214
242
|
const type = getPropertyType(property, allSchemas);
|
|
215
243
|
return [{
|