@omnifyjp/ts 5.9.3 → 5.9.5
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.
|
@@ -158,6 +158,10 @@ export function buildSchemaMetadata(schema, allSchemas, options, displayNames) {
|
|
|
158
158
|
const prop = schema.properties[propName];
|
|
159
159
|
if (!prop)
|
|
160
160
|
continue;
|
|
161
|
+
// Metadata drives generic create/update forms. Stored generated columns
|
|
162
|
+
// remain on read models but are not caller-writable form fields.
|
|
163
|
+
if (typeof prop.storedAs === 'string')
|
|
164
|
+
continue;
|
|
161
165
|
// Skip inverse associations — they don't carry a column.
|
|
162
166
|
const isInverseAssoc = prop.type === 'Association' &&
|
|
163
167
|
(Boolean(prop.mappedBy) ||
|
|
@@ -164,6 +164,10 @@ export function buildFormShape(schema, allSchemas, options) {
|
|
|
164
164
|
const prop = schema.properties[propName];
|
|
165
165
|
if (!prop)
|
|
166
166
|
continue;
|
|
167
|
+
// Database-generated columns remain available on read models but are not
|
|
168
|
+
// form state and must never enter create/update payloads.
|
|
169
|
+
if (typeof prop.storedAs === 'string')
|
|
170
|
+
continue;
|
|
167
171
|
// Skip inverse-side associations — they have no column.
|
|
168
172
|
if (prop.type === 'Association' &&
|
|
169
173
|
(prop.mappedBy || prop.relation === 'OneToMany' ||
|
|
@@ -494,6 +494,8 @@ function buildFillable(properties, expandedProperties, propertyOrder) {
|
|
|
494
494
|
if (!prop)
|
|
495
495
|
continue;
|
|
496
496
|
const type = prop['type'] ?? 'String';
|
|
497
|
+
if (typeof prop['storedAs'] === 'string')
|
|
498
|
+
continue;
|
|
497
499
|
const fillable = prop['fillable'] ?? true;
|
|
498
500
|
if (!fillable)
|
|
499
501
|
continue;
|
|
@@ -64,6 +64,10 @@ function generateBaseRequest(name, schema, reader, config, action) {
|
|
|
64
64
|
const prop = properties[propName];
|
|
65
65
|
if (!prop)
|
|
66
66
|
continue;
|
|
67
|
+
// Stored generated columns are computed by the database and must never be
|
|
68
|
+
// accepted from create/update payloads.
|
|
69
|
+
if (typeof prop['storedAs'] === 'string')
|
|
70
|
+
continue;
|
|
67
71
|
const type = prop['type'] ?? 'String';
|
|
68
72
|
// Compound type: generate rules for expanded columns
|
|
69
73
|
if (expandedProperties[propName]) {
|
package/dist/types.d.ts
CHANGED
|
@@ -307,6 +307,8 @@ export interface PropertyDefinition {
|
|
|
307
307
|
readonly unique?: boolean;
|
|
308
308
|
readonly primary?: boolean;
|
|
309
309
|
readonly translatable?: boolean;
|
|
310
|
+
/** Database-generated stored column expression. Generated columns are read-only. */
|
|
311
|
+
readonly storedAs?: string;
|
|
310
312
|
readonly default?: unknown;
|
|
311
313
|
readonly length?: number;
|
|
312
314
|
readonly minLength?: number;
|
package/dist/zod-generator.js
CHANGED
|
@@ -437,6 +437,13 @@ export function getExcludedFields(schema) {
|
|
|
437
437
|
createExclude.add('deleted_at');
|
|
438
438
|
updateExclude.add('deleted_at');
|
|
439
439
|
}
|
|
440
|
+
for (const [propName, prop] of Object.entries(schema.properties ?? {})) {
|
|
441
|
+
if (typeof prop.storedAs !== 'string')
|
|
442
|
+
continue;
|
|
443
|
+
const fieldName = toSnakeCase(propName);
|
|
444
|
+
createExclude.add(fieldName);
|
|
445
|
+
updateExclude.add(fieldName);
|
|
446
|
+
}
|
|
440
447
|
return { create: createExclude, update: updateExclude };
|
|
441
448
|
}
|
|
442
449
|
/**
|