@bounded-sh/core 0.0.39 → 0.0.40
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 +1 -1
- package/dist/index.js +20 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +65 -65
package/dist/index.mjs
CHANGED
|
@@ -5016,6 +5016,7 @@ async function runQuery(absolutePath, queryName, queryArgs, opts) {
|
|
|
5016
5016
|
return result[0];
|
|
5017
5017
|
}
|
|
5018
5018
|
async function runQueryMany(many, opts) {
|
|
5019
|
+
var _a, _b, _c, _d;
|
|
5019
5020
|
try {
|
|
5020
5021
|
let queries = [];
|
|
5021
5022
|
for (const { absolutePath, queryName, queryArgs } of many) {
|
|
@@ -5027,7 +5028,16 @@ async function runQueryMany(many, opts) {
|
|
|
5027
5028
|
queries.push({ path: normalizedPath, queryName, queryArgs });
|
|
5028
5029
|
}
|
|
5029
5030
|
const response = await makeApiRequest('POST', 'queries', { queries }, opts === null || opts === void 0 ? void 0 : opts._overrides);
|
|
5030
|
-
|
|
5031
|
+
// makeApiRequest returns `{ data: <httpBody> }`, and the worker's httpBody
|
|
5032
|
+
// is `{ data: { queries: [...] }, status }` — so the rows are double-nested
|
|
5033
|
+
// at response.data.data.queries. (Reading response.data.queries here is
|
|
5034
|
+
// undefined → "Cannot read properties of undefined".) Tolerate both shapes,
|
|
5035
|
+
// same as getMany does for items/batch.
|
|
5036
|
+
const rows = (_c = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.queries) !== null && _c !== void 0 ? _c : (_d = response.data) === null || _d === void 0 ? void 0 : _d.queries;
|
|
5037
|
+
if (!Array.isArray(rows)) {
|
|
5038
|
+
throw new Error(`queries endpoint returned an unexpected response shape (status ${response.status})`);
|
|
5039
|
+
}
|
|
5040
|
+
return rows.map((result) => result.result);
|
|
5031
5041
|
}
|
|
5032
5042
|
catch (error) {
|
|
5033
5043
|
throw error;
|
|
@@ -5039,6 +5049,7 @@ async function runExpression(expression, queryArgs, options) {
|
|
|
5039
5049
|
return results[0];
|
|
5040
5050
|
}
|
|
5041
5051
|
async function runExpressionMany(many) {
|
|
5052
|
+
var _a, _b, _c, _d;
|
|
5042
5053
|
try {
|
|
5043
5054
|
let queries = [];
|
|
5044
5055
|
let overrides = undefined;
|
|
@@ -5050,8 +5061,15 @@ async function runExpressionMany(many) {
|
|
|
5050
5061
|
queries.push({ queryArgs, expression, returnType });
|
|
5051
5062
|
}
|
|
5052
5063
|
const response = await makeApiRequest('POST', 'queries', { queries }, overrides);
|
|
5064
|
+
// Same double-nesting as runQueryMany: the worker's httpBody is
|
|
5065
|
+
// { data: { queries: [...] }, status } under makeApiRequest's own
|
|
5066
|
+
// { data: <httpBody> } wrapper. Tolerate both shapes.
|
|
5067
|
+
const rows = (_c = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.queries) !== null && _c !== void 0 ? _c : (_d = response.data) === null || _d === void 0 ? void 0 : _d.queries;
|
|
5068
|
+
if (!Array.isArray(rows)) {
|
|
5069
|
+
throw new Error(`queries endpoint returned an unexpected response shape (status ${response.status})`);
|
|
5070
|
+
}
|
|
5053
5071
|
// Map results - trace is automatically included by server for non-mainnet networks
|
|
5054
|
-
return
|
|
5072
|
+
return rows.map((queryResult) => {
|
|
5055
5073
|
const result = { result: queryResult.result };
|
|
5056
5074
|
// Include trace if present (server includes it for non-mainnet networks)
|
|
5057
5075
|
if (queryResult.trace) {
|