@rsktash/beads-ui 0.1.43 → 0.1.44
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/package.json +1 -1
- package/server/list-adapters.js +22 -4
package/package.json
CHANGED
package/server/list-adapters.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { runBdJson } from './bd.js';
|
|
2
2
|
import {
|
|
3
3
|
isDoltPoolReady,
|
|
4
|
+
enrichListItems,
|
|
4
5
|
queryAllIssues,
|
|
5
6
|
queryBlockedIssues,
|
|
6
7
|
queryEpics,
|
|
@@ -136,10 +137,13 @@ export function normalizeIssueList(value) {
|
|
|
136
137
|
* @returns {Promise<FetchListResultSuccess | FetchListResultFailure>}
|
|
137
138
|
*/
|
|
138
139
|
export async function fetchListForSubscription(spec, options = {}) {
|
|
140
|
+
/** @type {FetchListResultSuccess | FetchListResultFailure} */
|
|
141
|
+
let result;
|
|
142
|
+
|
|
139
143
|
if (isDoltPoolReady()) {
|
|
140
144
|
log('using SQL fast path for %s', spec.type);
|
|
141
145
|
try {
|
|
142
|
-
|
|
146
|
+
result = await fetchViaSQL(spec);
|
|
143
147
|
} catch (err) {
|
|
144
148
|
log('SQL fast path failed for %s: %o', spec.type, err);
|
|
145
149
|
// Don't fall back to bd CLI — sql-server holds the lock
|
|
@@ -151,10 +155,21 @@ export async function fetchListForSubscription(spec, options = {}) {
|
|
|
151
155
|
}
|
|
152
156
|
};
|
|
153
157
|
}
|
|
158
|
+
} else {
|
|
159
|
+
log('using bd CLI fallback for %s', spec.type);
|
|
160
|
+
result = await fetchViaBdCli(spec, options);
|
|
154
161
|
}
|
|
155
162
|
|
|
156
|
-
|
|
157
|
-
|
|
163
|
+
// Enrich items regardless of which path produced them
|
|
164
|
+
if (result.ok && result.items.length > 0) {
|
|
165
|
+
try {
|
|
166
|
+
result = { ...result, items: await enrichListItems(result.items) };
|
|
167
|
+
} catch (err) {
|
|
168
|
+
log('enrichListItems failed for %s: %o', spec.type, err);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return result;
|
|
158
173
|
}
|
|
159
174
|
|
|
160
175
|
/**
|
|
@@ -235,7 +250,10 @@ async function fetchViaSQL(spec) {
|
|
|
235
250
|
* @param {{ ok: true, items: any[], total: number }} res
|
|
236
251
|
* @returns {FetchListResultSuccess}
|
|
237
252
|
*/
|
|
238
|
-
const withTotal = (res) =>
|
|
253
|
+
const withTotal = (res) => {
|
|
254
|
+
const items = normalizeIssueList(res.items);
|
|
255
|
+
return { ok: true, items, total: res.total };
|
|
256
|
+
};
|
|
239
257
|
|
|
240
258
|
/** @param {() => Promise<any>} queryFn */
|
|
241
259
|
const run = async (queryFn) => {
|