dsh-sessions-manager 3.7.4 → 3.7.6

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/lib/index.js CHANGED
@@ -2039,7 +2039,7 @@ function emptyScanCandidate(sizeBytes) {
2039
2039
  }
2040
2040
 
2041
2041
  // src/index.js
2042
- var BUILD_STAMP = true ? "3.7.4+a351e274" : "dev";
2042
+ var BUILD_STAMP = true ? "3.7.6+68c2ab69" : "dev";
2043
2043
  var name = "dsh-sessions-manager";
2044
2044
  var inject = ["webServer", "workspaceRegistry", "sessionPersistence", "sessionQuery", "storageDomain"];
2045
2045
  var MAX_TITLE = 80;
@@ -2198,6 +2198,19 @@ function apply(ctx) {
2198
2198
  if (result.status === "rejected") return null;
2199
2199
  return result;
2200
2200
  }
2201
+ function projectionTitleOf(liveStore, id) {
2202
+ try {
2203
+ const reg = ctx.get("sessionProjections");
2204
+ if (!reg || typeof reg.cachedSnapshot !== "function") return null;
2205
+ const session = liveStore && liveStore.get && liveStore.get(id);
2206
+ if (!session) return null;
2207
+ const snap = reg.cachedSnapshot(session, ["title"]);
2208
+ const title = snap && snap.values ? snap.values.title : null;
2209
+ return typeof title === "string" && title.length > 0 ? title : null;
2210
+ } catch (e) {
2211
+ return null;
2212
+ }
2213
+ }
2201
2214
  async function archivedState() {
2202
2215
  const d = dom();
2203
2216
  if (!d) throw new Error("workspace domain is not open");
@@ -3287,11 +3300,29 @@ function apply(ctx) {
3287
3300
  createdAt: header && header.createdAt != null ? header.createdAt : meta.createdAt
3288
3301
  });
3289
3302
  }
3290
- const stillMissing = missing.filter((id) => !persisted.has(id));
3303
+ const stillMissing0 = missing.filter((id) => !persisted.has(id));
3304
+ const projectionMeta = /* @__PURE__ */ new Map();
3305
+ const stillMissing = [];
3306
+ for (const id of stillMissing0) {
3307
+ const title = projectionTitleOf(live, id);
3308
+ if (title == null) {
3309
+ stillMissing.push(id);
3310
+ continue;
3311
+ }
3312
+ const entry = entryById.get(id);
3313
+ const header = entry && entry.header ? entry.header : null;
3314
+ const meta = {
3315
+ title,
3316
+ cwd: header && typeof header.cwd === "string" && header.cwd ? header.cwd : null,
3317
+ createdAt: header && header.createdAt != null ? header.createdAt : null
3318
+ };
3319
+ projectionMeta.set(id, meta);
3320
+ metaCache.set(id, statsById.get(id), meta);
3321
+ }
3291
3322
  if (stillMissing.length) enqueueWarm(stillMissing, statsById, entryById);
3292
3323
  const items = [];
3293
3324
  for (const id of visibleIds) {
3294
- let meta = metaCache.get(id, statsById.get(id)) || persisted.get(id) || null;
3325
+ let meta = metaCache.get(id, statsById.get(id)) || persisted.get(id) || projectionMeta.get(id) || null;
3295
3326
  if (!meta) {
3296
3327
  meta = { title: null, cwd: null, createdAt: null };
3297
3328
  const entry = entryById.get(id);