@bounded-sh/core 0.0.40 → 0.0.41
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/client/operations.d.ts +2 -0
- package/dist/index.js +25 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +65 -65
package/dist/index.mjs
CHANGED
|
@@ -5012,10 +5012,27 @@ async function getMany(paths, opts = {}) {
|
|
|
5012
5012
|
return results;
|
|
5013
5013
|
}
|
|
5014
5014
|
async function runQuery(absolutePath, queryName, queryArgs, opts) {
|
|
5015
|
-
|
|
5016
|
-
|
|
5015
|
+
var _a;
|
|
5016
|
+
const rows = await runQueryManyRows([{ absolutePath, queryName, queryArgs }], opts);
|
|
5017
|
+
const row = rows[0];
|
|
5018
|
+
// The worker disambiguates a computed null from a failed/undeclared query
|
|
5019
|
+
// with a per-row `error` string — surface it instead of returning undefined.
|
|
5020
|
+
if ((row === null || row === void 0 ? void 0 : row.error) != null) {
|
|
5021
|
+
const err = new Error(String(row.error));
|
|
5022
|
+
err.isQueryError = true;
|
|
5023
|
+
err.queryName = queryName;
|
|
5024
|
+
err.path = absolutePath;
|
|
5025
|
+
throw err;
|
|
5026
|
+
}
|
|
5027
|
+
return (_a = row === null || row === void 0 ? void 0 : row.result) !== null && _a !== void 0 ? _a : null;
|
|
5017
5028
|
}
|
|
5018
5029
|
async function runQueryMany(many, opts) {
|
|
5030
|
+
// Batch shape stays an array of result values (errored rows map to null) so
|
|
5031
|
+
// existing callers keep working; use runQuery for per-row error surfacing.
|
|
5032
|
+
const rows = await runQueryManyRows(many, opts);
|
|
5033
|
+
return rows.map((row) => { var _a; return (_a = row === null || row === void 0 ? void 0 : row.result) !== null && _a !== void 0 ? _a : null; });
|
|
5034
|
+
}
|
|
5035
|
+
async function runQueryManyRows(many, opts) {
|
|
5019
5036
|
var _a, _b, _c, _d;
|
|
5020
5037
|
try {
|
|
5021
5038
|
let queries = [];
|
|
@@ -5037,7 +5054,7 @@ async function runQueryMany(many, opts) {
|
|
|
5037
5054
|
if (!Array.isArray(rows)) {
|
|
5038
5055
|
throw new Error(`queries endpoint returned an unexpected response shape (status ${response.status})`);
|
|
5039
5056
|
}
|
|
5040
|
-
return rows
|
|
5057
|
+
return rows;
|
|
5041
5058
|
}
|
|
5042
5059
|
catch (error) {
|
|
5043
5060
|
throw error;
|
|
@@ -5075,6 +5092,11 @@ async function runExpressionMany(many) {
|
|
|
5075
5092
|
if (queryResult.trace) {
|
|
5076
5093
|
result.trace = queryResult.trace;
|
|
5077
5094
|
}
|
|
5095
|
+
// Pass through the server's per-row failure so callers can distinguish
|
|
5096
|
+
// a computed null from a failed row.
|
|
5097
|
+
if (queryResult.error != null) {
|
|
5098
|
+
result.error = String(queryResult.error);
|
|
5099
|
+
}
|
|
5078
5100
|
return result;
|
|
5079
5101
|
});
|
|
5080
5102
|
}
|