@zenstackhq/orm 3.8.0-beta.1 → 3.8.0-beta.3
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/index.cjs +12 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -14
- package/dist/index.d.mts +36 -16
- package/dist/index.mjs +198 -188
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -1869,7 +1869,7 @@ var PostgresCrudDialect = class PostgresCrudDialect extends LateralJoinDialectBa
|
|
|
1869
1869
|
return this.eb.fn("trim", [expression, kysely.sql.lit("\"")]);
|
|
1870
1870
|
}
|
|
1871
1871
|
buildArrayLength(array) {
|
|
1872
|
-
return this.eb.fn("array_length", [array]);
|
|
1872
|
+
return this.eb.fn("array_length", [array, kysely.sql.lit(1)]);
|
|
1873
1873
|
}
|
|
1874
1874
|
buildArrayValue(values, elemType) {
|
|
1875
1875
|
const arr = kysely.sql`ARRAY[${kysely.sql.join(values, kysely.sql.raw(","))}]`;
|
|
@@ -2874,7 +2874,8 @@ var ZodSchemaFactory = class {
|
|
|
2874
2874
|
for (const [field, fieldDef] of this.getModelFields(model)) if (fieldDef.relation) {
|
|
2875
2875
|
if (!this.shouldIncludeRelations(options)) continue;
|
|
2876
2876
|
if (this.isModelAllowed(fieldDef.type)) fields[field] = this.makeRelationSelectIncludeSchema(model, field, options).optional();
|
|
2877
|
-
} else fields[field] = zod.z.
|
|
2877
|
+
} else if (this.options.allowQueryTimeOmitOverride === false && this.isFieldOmittedByConfig(model, field)) fields[field] = zod.z.literal(false).optional();
|
|
2878
|
+
else fields[field] = zod.z.boolean().optional();
|
|
2878
2879
|
if (this.shouldIncludeRelations(options)) {
|
|
2879
2880
|
const _countSchema = this.makeCountSelectionSchema(model, options);
|
|
2880
2881
|
if (!(_countSchema instanceof zod.z.ZodNever)) fields["_count"] = _countSchema;
|
|
@@ -2920,6 +2921,15 @@ var ZodSchemaFactory = class {
|
|
|
2920
2921
|
this.registerSchema(`${model}${(0, _zenstackhq_common_helpers.upperCaseFirst)(field)}RelationInput`, result);
|
|
2921
2922
|
return result;
|
|
2922
2923
|
}
|
|
2924
|
+
/**
|
|
2925
|
+
* Determines whether a field is configured to be omitted at the schema or client-options level
|
|
2926
|
+
* (query-level omit is excluded as it's mutually exclusive with `select`).
|
|
2927
|
+
*/
|
|
2928
|
+
isFieldOmittedByConfig(model, field) {
|
|
2929
|
+
const omitConfig = this.options.omit?.[(0, _zenstackhq_common_helpers.lowerCaseFirst)(model)] ?? this.options.omit?.[model];
|
|
2930
|
+
if (omitConfig && typeof omitConfig[field] === "boolean") return omitConfig[field];
|
|
2931
|
+
return !!requireField(this.schema, model, field).omit;
|
|
2932
|
+
}
|
|
2923
2933
|
makeOmitSchema(model) {
|
|
2924
2934
|
const fields = {};
|
|
2925
2935
|
for (const [field, fieldDef] of this.getModelFields(model)) if (!fieldDef.relation) if (this.options.allowQueryTimeOmitOverride !== false) fields[field] = zod.z.boolean().optional();
|