@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.d.cts
CHANGED
|
@@ -409,6 +409,7 @@ type toKyselyFieldType<Schema extends SchemaDef, Model extends GetModels<Schema>
|
|
|
409
409
|
declare class InputValidator<Schema extends SchemaDef> {
|
|
410
410
|
private readonly client;
|
|
411
411
|
private readonly schemaCache;
|
|
412
|
+
private readonly allFilterKinds;
|
|
412
413
|
constructor(client: ClientContract<Schema>);
|
|
413
414
|
private get schema();
|
|
414
415
|
private get options();
|
package/dist/index.d.ts
CHANGED
|
@@ -409,6 +409,7 @@ type toKyselyFieldType<Schema extends SchemaDef, Model extends GetModels<Schema>
|
|
|
409
409
|
declare class InputValidator<Schema extends SchemaDef> {
|
|
410
410
|
private readonly client;
|
|
411
411
|
private readonly schemaCache;
|
|
412
|
+
private readonly allFilterKinds;
|
|
412
413
|
constructor(client: ClientContract<Schema>);
|
|
413
414
|
private get schema();
|
|
414
415
|
private get options();
|
package/dist/index.js
CHANGED
|
@@ -5017,6 +5017,9 @@ var InputValidator = class {
|
|
|
5017
5017
|
}
|
|
5018
5018
|
client;
|
|
5019
5019
|
schemaCache = /* @__PURE__ */ new Map();
|
|
5020
|
+
allFilterKinds = [
|
|
5021
|
+
...new Set(Object.values(FILTER_PROPERTY_TO_KIND))
|
|
5022
|
+
];
|
|
5020
5023
|
constructor(client) {
|
|
5021
5024
|
this.client = client;
|
|
5022
5025
|
}
|
|
@@ -5301,7 +5304,7 @@ var InputValidator = class {
|
|
|
5301
5304
|
continue;
|
|
5302
5305
|
}
|
|
5303
5306
|
const allowedFilterKinds = this.getEffectiveFilterKinds(model, field);
|
|
5304
|
-
if (allowedFilterKinds && !allowedFilterKinds.
|
|
5307
|
+
if (allowedFilterKinds && !allowedFilterKinds.includes("Relation")) {
|
|
5305
5308
|
fieldSchema = z2.never();
|
|
5306
5309
|
} else {
|
|
5307
5310
|
fieldSchema = z2.lazy(() => this.makeWhereSchema(fieldDef.type, false).optional());
|
|
@@ -5523,7 +5526,7 @@ var InputValidator = class {
|
|
|
5523
5526
|
}
|
|
5524
5527
|
makeJsonFilterSchema(contextModel, field, optional) {
|
|
5525
5528
|
const allowedFilterKinds = this.getEffectiveFilterKinds(contextModel, field);
|
|
5526
|
-
if (allowedFilterKinds && !allowedFilterKinds.
|
|
5529
|
+
if (allowedFilterKinds && !allowedFilterKinds.includes("Json")) {
|
|
5527
5530
|
return z2.never();
|
|
5528
5531
|
}
|
|
5529
5532
|
const valueSchema = this.makeJsonValueSchema(optional, true);
|
|
@@ -6419,21 +6422,18 @@ var InputValidator = class {
|
|
|
6419
6422
|
computeFilterKinds(included, excluded) {
|
|
6420
6423
|
let result;
|
|
6421
6424
|
if (included !== void 0) {
|
|
6422
|
-
result =
|
|
6425
|
+
result = [
|
|
6426
|
+
...included
|
|
6427
|
+
];
|
|
6423
6428
|
}
|
|
6424
6429
|
if (excluded !== void 0) {
|
|
6425
6430
|
if (!result) {
|
|
6426
|
-
result =
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
"Like",
|
|
6430
|
-
"Json",
|
|
6431
|
-
"List",
|
|
6432
|
-
"Relation"
|
|
6433
|
-
]);
|
|
6431
|
+
result = [
|
|
6432
|
+
...this.allFilterKinds
|
|
6433
|
+
];
|
|
6434
6434
|
}
|
|
6435
6435
|
for (const kind of excluded) {
|
|
6436
|
-
result.
|
|
6436
|
+
result = result.filter((k) => k !== kind);
|
|
6437
6437
|
}
|
|
6438
6438
|
}
|
|
6439
6439
|
return result;
|
|
@@ -6446,17 +6446,17 @@ var InputValidator = class {
|
|
|
6446
6446
|
return operators;
|
|
6447
6447
|
}
|
|
6448
6448
|
return Object.fromEntries(Object.entries(operators).filter(([key, _]) => {
|
|
6449
|
-
return !(key in FILTER_PROPERTY_TO_KIND) || allowedKinds.
|
|
6449
|
+
return !(key in FILTER_PROPERTY_TO_KIND) || allowedKinds.includes(FILTER_PROPERTY_TO_KIND[key]);
|
|
6450
6450
|
}));
|
|
6451
6451
|
}
|
|
6452
6452
|
createUnionFilterSchema(valueSchema, optional, components, allowedFilterKinds) {
|
|
6453
6453
|
if (Object.keys(components).length === 0) {
|
|
6454
|
-
if (!allowedFilterKinds || allowedFilterKinds.
|
|
6454
|
+
if (!allowedFilterKinds || allowedFilterKinds.includes("Equality")) {
|
|
6455
6455
|
return this.nullableIf(valueSchema, optional);
|
|
6456
6456
|
}
|
|
6457
6457
|
return z2.never();
|
|
6458
6458
|
}
|
|
6459
|
-
if (!allowedFilterKinds || allowedFilterKinds.
|
|
6459
|
+
if (!allowedFilterKinds || allowedFilterKinds.includes("Equality")) {
|
|
6460
6460
|
return z2.union([
|
|
6461
6461
|
this.nullableIf(valueSchema, optional),
|
|
6462
6462
|
z2.strictObject(components)
|