@prisma/orm-family-sql 8.0.0-rc.9-dev.6 → 8.0.0-rc.9-dev.8
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/orm-client.mjs +12 -26
- package/dist/orm-client.mjs.map +1 -1
- package/package.json +17 -17
package/dist/orm-client.mjs
CHANGED
|
@@ -540,16 +540,6 @@ function mapResultRows(result, mapper) {
|
|
|
540
540
|
};
|
|
541
541
|
return new AsyncIterableResult(generator());
|
|
542
542
|
}
|
|
543
|
-
async function acquireRuntimeScope(runtime) {
|
|
544
|
-
if (typeof runtime.connection !== "function") return { scope: runtime };
|
|
545
|
-
const connection = await runtime.connection();
|
|
546
|
-
const release = connection.release;
|
|
547
|
-
if (typeof release === "function") return {
|
|
548
|
-
scope: connection,
|
|
549
|
-
release: () => release.call(connection) ?? Promise.resolve()
|
|
550
|
-
};
|
|
551
|
-
return { scope: connection };
|
|
552
|
-
}
|
|
553
543
|
function deriveParamsFromAst(ast) {
|
|
554
544
|
return { params: collectOrderedParamRefs(ast).map((p) => p.kind === "param-ref" ? p.value : void 0) };
|
|
555
545
|
}
|
|
@@ -1972,22 +1962,18 @@ function dispatchWithIncludes(options) {
|
|
|
1972
1962
|
const { context, runtime, state, tableName, modelName, namespaceId } = options;
|
|
1973
1963
|
const { contract } = context;
|
|
1974
1964
|
const generator = async function* () {
|
|
1975
|
-
const
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
for (const row of parentRows) yield blindCast(row.mapped);
|
|
1988
|
-
} finally {
|
|
1989
|
-
if (release) await release();
|
|
1990
|
-
}
|
|
1965
|
+
const compiled = compileSelectWithIncludes(contract, context.aggregateDescriptors, namespaceId, tableName, state, modelName);
|
|
1966
|
+
const parentRowsRaw = await queryPlanRows(runtime, compiled).toArray();
|
|
1967
|
+
if (parentRowsRaw.length === 0) return;
|
|
1968
|
+
const polyInfo = resolvePolymorphismInfo(contract, namespaceId, modelName);
|
|
1969
|
+
const parentRows = parentRowsRaw.map((row) => {
|
|
1970
|
+
return {
|
|
1971
|
+
raw: row,
|
|
1972
|
+
mapped: polyInfo ? mapPolymorphicRow(contract, namespaceId, modelName, polyInfo, row, state.variantName) : mapStorageRowToModelFields(contract, namespaceId, modelName, row)
|
|
1973
|
+
};
|
|
1974
|
+
});
|
|
1975
|
+
for (const parent of parentRows) for (const include of state.includes) parent.mapped[include.relationName] = await decodeIncludePayload(contract, context, include, parent.raw[include.relationName]);
|
|
1976
|
+
for (const row of parentRows) yield blindCast(row.mapped);
|
|
1991
1977
|
};
|
|
1992
1978
|
return new AsyncIterableResult(generator());
|
|
1993
1979
|
}
|