@zenstackhq/orm 3.4.0-beta.2 → 3.4.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 +15 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -5062,6 +5062,9 @@ var InputValidator = class {
|
|
|
5062
5062
|
}
|
|
5063
5063
|
client;
|
|
5064
5064
|
schemaCache = /* @__PURE__ */ new Map();
|
|
5065
|
+
allFilterKinds = [
|
|
5066
|
+
...new Set(Object.values(FILTER_PROPERTY_TO_KIND))
|
|
5067
|
+
];
|
|
5065
5068
|
constructor(client) {
|
|
5066
5069
|
this.client = client;
|
|
5067
5070
|
}
|
|
@@ -5346,7 +5349,7 @@ var InputValidator = class {
|
|
|
5346
5349
|
continue;
|
|
5347
5350
|
}
|
|
5348
5351
|
const allowedFilterKinds = this.getEffectiveFilterKinds(model, field);
|
|
5349
|
-
if (allowedFilterKinds && !allowedFilterKinds.
|
|
5352
|
+
if (allowedFilterKinds && !allowedFilterKinds.includes("Relation")) {
|
|
5350
5353
|
fieldSchema = import_zod2.z.never();
|
|
5351
5354
|
} else {
|
|
5352
5355
|
fieldSchema = import_zod2.z.lazy(() => this.makeWhereSchema(fieldDef.type, false).optional());
|
|
@@ -5568,7 +5571,7 @@ var InputValidator = class {
|
|
|
5568
5571
|
}
|
|
5569
5572
|
makeJsonFilterSchema(contextModel, field, optional) {
|
|
5570
5573
|
const allowedFilterKinds = this.getEffectiveFilterKinds(contextModel, field);
|
|
5571
|
-
if (allowedFilterKinds && !allowedFilterKinds.
|
|
5574
|
+
if (allowedFilterKinds && !allowedFilterKinds.includes("Json")) {
|
|
5572
5575
|
return import_zod2.z.never();
|
|
5573
5576
|
}
|
|
5574
5577
|
const valueSchema = this.makeJsonValueSchema(optional, true);
|
|
@@ -6464,21 +6467,18 @@ var InputValidator = class {
|
|
|
6464
6467
|
computeFilterKinds(included, excluded) {
|
|
6465
6468
|
let result;
|
|
6466
6469
|
if (included !== void 0) {
|
|
6467
|
-
result =
|
|
6470
|
+
result = [
|
|
6471
|
+
...included
|
|
6472
|
+
];
|
|
6468
6473
|
}
|
|
6469
6474
|
if (excluded !== void 0) {
|
|
6470
6475
|
if (!result) {
|
|
6471
|
-
result =
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
"Like",
|
|
6475
|
-
"Json",
|
|
6476
|
-
"List",
|
|
6477
|
-
"Relation"
|
|
6478
|
-
]);
|
|
6476
|
+
result = [
|
|
6477
|
+
...this.allFilterKinds
|
|
6478
|
+
];
|
|
6479
6479
|
}
|
|
6480
6480
|
for (const kind of excluded) {
|
|
6481
|
-
result.
|
|
6481
|
+
result = result.filter((k) => k !== kind);
|
|
6482
6482
|
}
|
|
6483
6483
|
}
|
|
6484
6484
|
return result;
|
|
@@ -6491,17 +6491,17 @@ var InputValidator = class {
|
|
|
6491
6491
|
return operators;
|
|
6492
6492
|
}
|
|
6493
6493
|
return Object.fromEntries(Object.entries(operators).filter(([key, _]) => {
|
|
6494
|
-
return !(key in FILTER_PROPERTY_TO_KIND) || allowedKinds.
|
|
6494
|
+
return !(key in FILTER_PROPERTY_TO_KIND) || allowedKinds.includes(FILTER_PROPERTY_TO_KIND[key]);
|
|
6495
6495
|
}));
|
|
6496
6496
|
}
|
|
6497
6497
|
createUnionFilterSchema(valueSchema, optional, components, allowedFilterKinds) {
|
|
6498
6498
|
if (Object.keys(components).length === 0) {
|
|
6499
|
-
if (!allowedFilterKinds || allowedFilterKinds.
|
|
6499
|
+
if (!allowedFilterKinds || allowedFilterKinds.includes("Equality")) {
|
|
6500
6500
|
return this.nullableIf(valueSchema, optional);
|
|
6501
6501
|
}
|
|
6502
6502
|
return import_zod2.z.never();
|
|
6503
6503
|
}
|
|
6504
|
-
if (!allowedFilterKinds || allowedFilterKinds.
|
|
6504
|
+
if (!allowedFilterKinds || allowedFilterKinds.includes("Equality")) {
|
|
6505
6505
|
return import_zod2.z.union([
|
|
6506
6506
|
this.nullableIf(valueSchema, optional),
|
|
6507
6507
|
import_zod2.z.strictObject(components)
|