@emeryld/rrroutes-client 2.6.8 → 2.6.10
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/index.cjs +11 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +15 -19
- package/dist/index.mjs.map +1 -1
- package/dist/routesV3.client.types.d.ts +1 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1376,18 +1376,18 @@ function createRouteClient(opts) {
|
|
|
1376
1376
|
};
|
|
1377
1377
|
const fetchBranch = async (input) => {
|
|
1378
1378
|
const payload = {};
|
|
1379
|
-
const keyByAlias = /* @__PURE__ */ new Map();
|
|
1380
1379
|
for (const [aliasRaw, built] of Object.entries(leaves)) {
|
|
1381
|
-
const alias = aliasRaw;
|
|
1382
1380
|
const leaf = getBuiltLeaf(built);
|
|
1383
1381
|
const encodedLeaf = encodeLeafKey(leaf);
|
|
1384
|
-
|
|
1382
|
+
const alias = aliasRaw;
|
|
1385
1383
|
const branchInput = input[alias];
|
|
1386
|
-
const
|
|
1384
|
+
const query = branchInput?.query;
|
|
1385
|
+
const params = branchInput?.params;
|
|
1387
1386
|
const body = branchInput?.body;
|
|
1388
|
-
payload[
|
|
1389
|
-
|
|
1390
|
-
...
|
|
1387
|
+
payload[aliasRaw] = {
|
|
1388
|
+
encodedLeaf,
|
|
1389
|
+
...params !== void 0 ? { params } : {},
|
|
1390
|
+
...query !== void 0 ? { query } : {},
|
|
1391
1391
|
...body !== void 0 ? { body } : {}
|
|
1392
1392
|
};
|
|
1393
1393
|
}
|
|
@@ -1400,23 +1400,16 @@ function createRouteClient(opts) {
|
|
|
1400
1400
|
const rawData = batchResponse.data;
|
|
1401
1401
|
if (!rawData || typeof rawData !== "object" || Array.isArray(rawData)) {
|
|
1402
1402
|
throw new Error(
|
|
1403
|
-
"Batch response must be a plain object keyed by
|
|
1403
|
+
"Batch response must be a plain object keyed by branch aliases."
|
|
1404
1404
|
);
|
|
1405
1405
|
}
|
|
1406
1406
|
const mapped = {};
|
|
1407
1407
|
for (const [aliasRaw, built] of Object.entries(leaves)) {
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
if (!encodedLeaf) {
|
|
1411
|
-
throw new Error(
|
|
1412
|
-
`Internal batch error: missing encoded key for alias "${String(alias)}".`
|
|
1413
|
-
);
|
|
1414
|
-
}
|
|
1415
|
-
if (!(encodedLeaf in rawData)) {
|
|
1416
|
-
throw new Error(`Batch response missing key "${encodedLeaf}".`);
|
|
1408
|
+
if (!(aliasRaw in rawData)) {
|
|
1409
|
+
throw new Error(`Batch response missing alias "${aliasRaw}".`);
|
|
1417
1410
|
}
|
|
1418
1411
|
const leaf = getBuiltLeaf(built);
|
|
1419
|
-
const rawLeafData = rawData[
|
|
1412
|
+
const rawLeafData = rawData[aliasRaw];
|
|
1420
1413
|
const parsedLeafData = validateResponses && leaf.cfg.outputSchema ? (0, import_rrroutes_contract5.lowProfileParse)(leaf.cfg.outputSchema, rawLeafData) : rawLeafData;
|
|
1421
1414
|
if (validateResponses && !leaf.cfg.outputSchema) {
|
|
1422
1415
|
throw new Error(
|