prisma-guard 1.25.0 → 1.26.1
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/runtime/index.js
CHANGED
|
@@ -1551,6 +1551,18 @@ function createWhereBuilder(typeMap, enumMap, scalarBase, uniqueMap = {}) {
|
|
|
1551
1551
|
scalarConditions
|
|
1552
1552
|
);
|
|
1553
1553
|
}
|
|
1554
|
+
for (const key of Object.keys(scalarConditions)) {
|
|
1555
|
+
if (COMBINATOR_KEYS.has(key))
|
|
1556
|
+
continue;
|
|
1557
|
+
if (!(key in fieldSchemas)) {
|
|
1558
|
+
fieldSchemas[key] = z4.object({}).strict().optional();
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
for (const key of Object.keys(relationForced)) {
|
|
1562
|
+
if (!(key in fieldSchemas)) {
|
|
1563
|
+
fieldSchemas[key] = z4.object({}).strict().optional();
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1554
1566
|
const schema = Object.keys(fieldSchemas).length > 0 ? z4.object(fieldSchemas).strict().optional() : null;
|
|
1555
1567
|
const forcedOnlyKeys = /* @__PURE__ */ new Set();
|
|
1556
1568
|
for (const key of Object.keys(whereConfig)) {
|
|
@@ -1960,7 +1972,12 @@ function createWhereBuilder(typeMap, enumMap, scalarBase, uniqueMap = {}) {
|
|
|
1960
1972
|
fieldSchemas[key] = directSchema;
|
|
1961
1973
|
continue;
|
|
1962
1974
|
}
|
|
1963
|
-
forcedConditions[key] = parseForcedUniqueValue(
|
|
1975
|
+
forcedConditions[key] = parseForcedUniqueValue(
|
|
1976
|
+
model,
|
|
1977
|
+
key,
|
|
1978
|
+
fieldMeta,
|
|
1979
|
+
value
|
|
1980
|
+
);
|
|
1964
1981
|
forcedOnlyKeys.add(key);
|
|
1965
1982
|
}
|
|
1966
1983
|
return {
|
|
@@ -4412,10 +4429,30 @@ function isGuardShape(obj) {
|
|
|
4412
4429
|
function isSingleShape(input) {
|
|
4413
4430
|
return typeof input === "function" || isGuardShape(input);
|
|
4414
4431
|
}
|
|
4432
|
+
function toPlainObject(value) {
|
|
4433
|
+
if (value === null || typeof value !== "object")
|
|
4434
|
+
return value;
|
|
4435
|
+
if (Array.isArray(value))
|
|
4436
|
+
return value.map(toPlainObject);
|
|
4437
|
+
if (value instanceof Date)
|
|
4438
|
+
return value;
|
|
4439
|
+
if (value instanceof Uint8Array)
|
|
4440
|
+
return value;
|
|
4441
|
+
if (value instanceof RegExp)
|
|
4442
|
+
return value;
|
|
4443
|
+
if (typeof value.toFixed === "function" && typeof value.toNumber === "function")
|
|
4444
|
+
return value;
|
|
4445
|
+
const result = {};
|
|
4446
|
+
for (const [k, v] of Object.entries(value)) {
|
|
4447
|
+
result[k] = toPlainObject(v);
|
|
4448
|
+
}
|
|
4449
|
+
return result;
|
|
4450
|
+
}
|
|
4415
4451
|
function requireBody(body) {
|
|
4416
|
-
|
|
4452
|
+
const normalized = toPlainObject(body);
|
|
4453
|
+
if (!isPlainObject(normalized))
|
|
4417
4454
|
throw new ShapeError("Request body must be an object");
|
|
4418
|
-
return
|
|
4455
|
+
return normalized;
|
|
4419
4456
|
}
|
|
4420
4457
|
function resolveDynamicShape(fn, contextFn) {
|
|
4421
4458
|
const ctx = validateContext(contextFn());
|