@zenstackhq/orm 3.0.0-beta.22 → 3.0.0-beta.23
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 +24 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -98
- package/dist/index.d.ts +80 -98
- package/dist/index.js +24 -22
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -4091,9 +4091,9 @@ var InputValidator = class {
|
|
|
4091
4091
|
} else {
|
|
4092
4092
|
fields["where"] = where.optional();
|
|
4093
4093
|
}
|
|
4094
|
-
fields["select"] = this.makeSelectSchema(model).optional();
|
|
4095
|
-
fields["include"] = this.makeIncludeSchema(model).optional();
|
|
4096
|
-
fields["omit"] = this.makeOmitSchema(model).optional();
|
|
4094
|
+
fields["select"] = this.makeSelectSchema(model).optional().nullable();
|
|
4095
|
+
fields["include"] = this.makeIncludeSchema(model).optional().nullable();
|
|
4096
|
+
fields["omit"] = this.makeOmitSchema(model).optional().nullable();
|
|
4097
4097
|
if (!options.unique) {
|
|
4098
4098
|
fields["skip"] = this.makeSkipSchema().optional();
|
|
4099
4099
|
if (options.findOne) {
|
|
@@ -4467,9 +4467,9 @@ var InputValidator = class {
|
|
|
4467
4467
|
// to-many relations and optional to-one relations are filterable
|
|
4468
4468
|
where: import_zod2.z.lazy(() => this.makeWhereSchema(fieldDef.type, false)).optional()
|
|
4469
4469
|
} : {},
|
|
4470
|
-
select: import_zod2.z.lazy(() => this.makeSelectSchema(fieldDef.type)).optional(),
|
|
4471
|
-
include: import_zod2.z.lazy(() => this.makeIncludeSchema(fieldDef.type)).optional(),
|
|
4472
|
-
omit: import_zod2.z.lazy(() => this.makeOmitSchema(fieldDef.type)).optional(),
|
|
4470
|
+
select: import_zod2.z.lazy(() => this.makeSelectSchema(fieldDef.type)).optional().nullable(),
|
|
4471
|
+
include: import_zod2.z.lazy(() => this.makeIncludeSchema(fieldDef.type)).optional().nullable(),
|
|
4472
|
+
omit: import_zod2.z.lazy(() => this.makeOmitSchema(fieldDef.type)).optional().nullable(),
|
|
4473
4473
|
...fieldDef.array ? {
|
|
4474
4474
|
// to-many relations can be ordered, skipped, taken, and cursor-located
|
|
4475
4475
|
orderBy: import_zod2.z.lazy(() => this.orArray(this.makeOrderBySchema(fieldDef.type, true, false), true)).optional(),
|
|
@@ -4578,9 +4578,9 @@ var InputValidator = class {
|
|
|
4578
4578
|
const dataSchema = this.makeCreateDataSchema(model, false);
|
|
4579
4579
|
let schema = import_zod2.z.strictObject({
|
|
4580
4580
|
data: dataSchema,
|
|
4581
|
-
select: this.makeSelectSchema(model).optional(),
|
|
4582
|
-
include: this.makeIncludeSchema(model).optional(),
|
|
4583
|
-
omit: this.makeOmitSchema(model).optional()
|
|
4581
|
+
select: this.makeSelectSchema(model).optional().nullable(),
|
|
4582
|
+
include: this.makeIncludeSchema(model).optional().nullable(),
|
|
4583
|
+
omit: this.makeOmitSchema(model).optional().nullable()
|
|
4584
4584
|
});
|
|
4585
4585
|
schema = this.refineForSelectIncludeMutuallyExclusive(schema);
|
|
4586
4586
|
schema = this.refineForSelectOmitMutuallyExclusive(schema);
|
|
@@ -4592,8 +4592,8 @@ var InputValidator = class {
|
|
|
4592
4592
|
makeCreateManyAndReturnSchema(model) {
|
|
4593
4593
|
const base = this.makeCreateManyDataSchema(model, []);
|
|
4594
4594
|
const result = base.extend({
|
|
4595
|
-
select: this.makeSelectSchema(model).optional(),
|
|
4596
|
-
omit: this.makeOmitSchema(model).optional()
|
|
4595
|
+
select: this.makeSelectSchema(model).optional().nullable(),
|
|
4596
|
+
omit: this.makeOmitSchema(model).optional().nullable()
|
|
4597
4597
|
});
|
|
4598
4598
|
return this.refineForSelectOmitMutuallyExclusive(result).optional();
|
|
4599
4599
|
}
|
|
@@ -4783,9 +4783,9 @@ var InputValidator = class {
|
|
|
4783
4783
|
let schema = import_zod2.z.strictObject({
|
|
4784
4784
|
where: this.makeWhereSchema(model, true),
|
|
4785
4785
|
data: this.makeUpdateDataSchema(model),
|
|
4786
|
-
select: this.makeSelectSchema(model).optional(),
|
|
4787
|
-
include: this.makeIncludeSchema(model).optional(),
|
|
4788
|
-
omit: this.makeOmitSchema(model).optional()
|
|
4786
|
+
select: this.makeSelectSchema(model).optional().nullable(),
|
|
4787
|
+
include: this.makeIncludeSchema(model).optional().nullable(),
|
|
4788
|
+
omit: this.makeOmitSchema(model).optional().nullable()
|
|
4789
4789
|
});
|
|
4790
4790
|
schema = this.refineForSelectIncludeMutuallyExclusive(schema);
|
|
4791
4791
|
schema = this.refineForSelectOmitMutuallyExclusive(schema);
|
|
@@ -4801,8 +4801,8 @@ var InputValidator = class {
|
|
|
4801
4801
|
makeUpdateManyAndReturnSchema(model) {
|
|
4802
4802
|
const base = this.makeUpdateManySchema(model);
|
|
4803
4803
|
let schema = base.extend({
|
|
4804
|
-
select: this.makeSelectSchema(model).optional(),
|
|
4805
|
-
omit: this.makeOmitSchema(model).optional()
|
|
4804
|
+
select: this.makeSelectSchema(model).optional().nullable(),
|
|
4805
|
+
omit: this.makeOmitSchema(model).optional().nullable()
|
|
4806
4806
|
});
|
|
4807
4807
|
schema = this.refineForSelectOmitMutuallyExclusive(schema);
|
|
4808
4808
|
return schema;
|
|
@@ -4812,9 +4812,9 @@ var InputValidator = class {
|
|
|
4812
4812
|
where: this.makeWhereSchema(model, true),
|
|
4813
4813
|
create: this.makeCreateDataSchema(model, false),
|
|
4814
4814
|
update: this.makeUpdateDataSchema(model),
|
|
4815
|
-
select: this.makeSelectSchema(model).optional(),
|
|
4816
|
-
include: this.makeIncludeSchema(model).optional(),
|
|
4817
|
-
omit: this.makeOmitSchema(model).optional()
|
|
4815
|
+
select: this.makeSelectSchema(model).optional().nullable(),
|
|
4816
|
+
include: this.makeIncludeSchema(model).optional().nullable(),
|
|
4817
|
+
omit: this.makeOmitSchema(model).optional().nullable()
|
|
4818
4818
|
});
|
|
4819
4819
|
schema = this.refineForSelectIncludeMutuallyExclusive(schema);
|
|
4820
4820
|
schema = this.refineForSelectOmitMutuallyExclusive(schema);
|
|
@@ -4904,8 +4904,8 @@ var InputValidator = class {
|
|
|
4904
4904
|
makeDeleteSchema(model) {
|
|
4905
4905
|
let schema = import_zod2.z.strictObject({
|
|
4906
4906
|
where: this.makeWhereSchema(model, true),
|
|
4907
|
-
select: this.makeSelectSchema(model).optional(),
|
|
4908
|
-
include: this.makeIncludeSchema(model).optional()
|
|
4907
|
+
select: this.makeSelectSchema(model).optional().nullable(),
|
|
4908
|
+
include: this.makeIncludeSchema(model).optional().nullable()
|
|
4909
4909
|
});
|
|
4910
4910
|
schema = this.refineForSelectIncludeMutuallyExclusive(schema);
|
|
4911
4911
|
schema = this.refineForSelectOmitMutuallyExclusive(schema);
|
|
@@ -5295,7 +5295,9 @@ var QueryNameMapper = class extends import_kysely6.OperationNodeTransformer {
|
|
|
5295
5295
|
return super.transformSelectQuery(node);
|
|
5296
5296
|
}
|
|
5297
5297
|
const processedFroms = node.from.froms.map((from) => this.processSelectTable(from));
|
|
5298
|
-
const processedJoins =
|
|
5298
|
+
const processedJoins = this.withScopes([
|
|
5299
|
+
...processedFroms.map(({ scope }) => scope)
|
|
5300
|
+
], () => (node.joins ?? []).map((join) => this.processSelectTable(join.table)));
|
|
5299
5301
|
const scopes = [
|
|
5300
5302
|
...processedFroms.map(({ scope }) => scope),
|
|
5301
5303
|
...processedJoins.map(({ scope }) => scope)
|