prisma-sql 1.75.1 → 1.75.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/generator.cjs +8 -41
- package/dist/generator.cjs.map +1 -1
- package/dist/generator.js +8 -41
- package/dist/generator.js.map +1 -1
- package/dist/index.cjs +1 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -34
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1264,7 +1264,7 @@ var expandToSingleFieldEntries = (item) => {
|
|
|
1264
1264
|
if (!isPlainObject(item)) {
|
|
1265
1265
|
throw new Error("orderBy array entries must be objects");
|
|
1266
1266
|
}
|
|
1267
|
-
const entries = Object.entries(item);
|
|
1267
|
+
const entries = Object.entries(item).filter(([, v]) => v !== void 0);
|
|
1268
1268
|
if (entries.length === 0) {
|
|
1269
1269
|
throw new Error("orderBy array entries must have at least one field");
|
|
1270
1270
|
}
|
|
@@ -5792,38 +5792,6 @@ Available fields: ${[...scalarSet].join(", ")}`
|
|
|
5792
5792
|
assertScalarField(model, f, "distinct");
|
|
5793
5793
|
}
|
|
5794
5794
|
}
|
|
5795
|
-
function validateOrderBy(model, orderBy, schemas) {
|
|
5796
|
-
if (!isNotNullish(orderBy)) return;
|
|
5797
|
-
const expanded = expandOrderByInput(orderBy);
|
|
5798
|
-
if (expanded.length === 0) return;
|
|
5799
|
-
const scalarSet = getScalarFieldSet(model);
|
|
5800
|
-
const relationSet = getRelationFieldSet(model);
|
|
5801
|
-
for (const [fieldName, value] of expanded) {
|
|
5802
|
-
const f = String(fieldName).trim();
|
|
5803
|
-
if (f.length === 0) {
|
|
5804
|
-
throw new Error("orderBy field name cannot be empty");
|
|
5805
|
-
}
|
|
5806
|
-
if (f.length > 255) {
|
|
5807
|
-
throw new Error(
|
|
5808
|
-
`orderBy field name too long (${f.length} chars, max 255): ${f.slice(0, 50)}...`
|
|
5809
|
-
);
|
|
5810
|
-
}
|
|
5811
|
-
if (scalarSet.has(f)) {
|
|
5812
|
-
assertScalarField(model, f, "orderBy");
|
|
5813
|
-
continue;
|
|
5814
|
-
}
|
|
5815
|
-
if (relationSet.has(f)) {
|
|
5816
|
-
if (!isPlainObject(value)) {
|
|
5817
|
-
throw new Error(`Relation orderBy for '${f}' must be an object`);
|
|
5818
|
-
}
|
|
5819
|
-
continue;
|
|
5820
|
-
}
|
|
5821
|
-
throw new Error(
|
|
5822
|
-
`orderBy field '${f}' does not exist on model ${model.name}.
|
|
5823
|
-
Available fields: ${[...scalarSet].join(", ")}`
|
|
5824
|
-
);
|
|
5825
|
-
}
|
|
5826
|
-
}
|
|
5827
5795
|
function validateCursor(model, cursor, distinct) {
|
|
5828
5796
|
if (!isNotNullish(cursor)) return;
|
|
5829
5797
|
if (!isPlainObject(cursor)) {
|
|
@@ -5971,7 +5939,6 @@ function buildSelectSql(input) {
|
|
|
5971
5939
|
const argsForSql = normalizeArgsForNegativeTake(method, args);
|
|
5972
5940
|
const normalizedArgs = normalizeArgsForDialect(dialectToUse, argsForSql);
|
|
5973
5941
|
validateDistinct(model, normalizedArgs.distinct);
|
|
5974
|
-
validateOrderBy(model, normalizedArgs.orderBy);
|
|
5975
5942
|
validateCursor(model, normalizedArgs.cursor, normalizedArgs.distinct);
|
|
5976
5943
|
const spec = buildSelectSpec({
|
|
5977
5944
|
method,
|