joist-core 2.3.0-next.69 → 2.3.0-next.70
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/build/EntityManager.cjs +5 -2
- package/build/EntityManager.cjs.map +1 -1
- package/build/EntityManager.d.cts +8 -0
- package/build/EntityManager.d.cts.map +1 -1
- package/build/EntityManager.d.mts +8 -0
- package/build/EntityManager.d.mts.map +1 -1
- package/build/EntityManager.js +5 -2
- package/build/EntityManager.js.map +1 -1
- package/package.json +2 -2
package/build/EntityManager.cjs
CHANGED
|
@@ -300,13 +300,16 @@ var EntityManager = class EntityManager {
|
|
|
300
300
|
if (populate) await this.populate(result, populate);
|
|
301
301
|
return result;
|
|
302
302
|
}
|
|
303
|
-
query(q) {
|
|
303
|
+
query(q, options) {
|
|
304
304
|
this.#assertFindAllowed("query");
|
|
305
305
|
const em = this;
|
|
306
306
|
return (async function query() {
|
|
307
307
|
const plan = require_query.parseUserQuery(q);
|
|
308
|
+
if (options?.populate && plan.output.kind !== "entity") require_utils.fail("em.query populate requires an entity selection");
|
|
308
309
|
const { rows } = await em.driver.executeQuery(em, plan.sql, plan.bindings);
|
|
309
|
-
|
|
310
|
+
const result = plan.decodeRows(em, rows);
|
|
311
|
+
if (options?.populate) await em.populate(result, options.populate);
|
|
312
|
+
return result;
|
|
310
313
|
})().catch(function query(err) {
|
|
311
314
|
throw appendStack(err, /* @__PURE__ */ new Error());
|
|
312
315
|
});
|