clavarium 0.2.256-beta.1 → 0.2.257-beta.1
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/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/web/app.js +9 -5
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.257-beta.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.257-beta.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/web/app.js
CHANGED
|
@@ -6426,6 +6426,7 @@
|
|
|
6426
6426
|
an event opened says its time, place, link and organiser. Read only. Each read is journaled by Tether, which
|
|
6427
6427
|
moves its count and paints the panel again: an answer is kept AGENDA_KEEP_MS here, so a paint reads no calendar. */
|
|
6428
6428
|
const AGENDA_KEEP_MS = 5 * 60_000;
|
|
6429
|
+
const AGENDA_FAIL_KEEP_MS = 60_000;
|
|
6429
6430
|
const AGENDA_DAYS = 7; /* one week; the pages follow each other, no day twice */
|
|
6430
6431
|
const agendaKept = new Map(); /* `${target}|${from}` -> { at, answer } or { at, pending } */
|
|
6431
6432
|
const agendaFrom = new Map(); /* target -> the first day shown, when moved from today */
|
|
@@ -6448,10 +6449,12 @@
|
|
|
6448
6449
|
const calendar = agendaCal.get(target) ?? '';
|
|
6449
6450
|
const key = `${target}|${calendar}|${from}`;
|
|
6450
6451
|
const kept = agendaKept.get(key);
|
|
6451
|
-
if (kept && !fresh && (kept.pending || Date.now() - kept.at < AGENDA_KEEP_MS)) return kept.pending ?? kept.answer;
|
|
6452
|
+
if (kept && !fresh && (kept.pending || Date.now() - kept.at < (kept.answer?.error ? AGENDA_FAIL_KEEP_MS : AGENDA_KEEP_MS))) return kept.pending ?? kept.answer;
|
|
6452
6453
|
const pending = post(`${API}/tether/agenda`, { target, from, to: dayAdd(from, AGENDA_DAYS), ...(calendar ? { calendar } : {}) })
|
|
6453
6454
|
.then((answer) => { agendaKept.set(key, { at: Date.now(), answer }); return answer; })
|
|
6454
|
-
|
|
6455
|
+
/* A failure is kept a while too (29-11): each read is journaled, which paints the panel again -- forgotten at
|
|
6456
|
+
once, every paint read it again, without end. "Try again" reads it fresh. */
|
|
6457
|
+
.catch((error) => { const answer = { error: error.message || uiSaid('set-ag-failed', 'The calendar could not be read.') }; agendaKept.set(key, { at: Date.now(), answer }); return answer; });
|
|
6455
6458
|
agendaKept.set(key, { at: Date.now(), pending });
|
|
6456
6459
|
return pending;
|
|
6457
6460
|
}
|
|
@@ -6866,7 +6869,8 @@
|
|
|
6866
6869
|
/* Which calendar: shown when the account has more than one (its own and those shared with it), as a mailbox's folder. */
|
|
6867
6870
|
const pick = el('select', 'mv-folder ag-cal'); pick.hidden = true; pick.setAttribute('aria-label', uiSaid('set-ag-cal', 'Calendar'));
|
|
6868
6871
|
pick.addEventListener('change', () => { if (pick.value) agendaCal.set(target.id, pick.value); else agendaCal.delete(target.id); void agendaFill(holder, target.id); });
|
|
6869
|
-
|
|
6872
|
+
/* peekRead gives a kept answer as it is (not a promise) once read: always awaited (29-11, a paint threw here). */
|
|
6873
|
+
void Promise.resolve(peekRead(`calendars|${target.id}`, 'calendars', { target: target.id }, '')).then((got) => {
|
|
6870
6874
|
const cals = got?.calendars ?? [];
|
|
6871
6875
|
if (cals.length < 2 || !pick.isConnected) return;
|
|
6872
6876
|
for (const c of cals) {
|
|
@@ -6895,10 +6899,10 @@
|
|
|
6895
6899
|
const peekKept = new Map();
|
|
6896
6900
|
function peekRead(key, path, body, failed, { fresh = false } = {}) {
|
|
6897
6901
|
const kept = peekKept.get(key);
|
|
6898
|
-
if (kept && !fresh && (kept.pending || Date.now() - kept.at < PEEK_KEEP_MS)) return kept.pending ?? kept.answer;
|
|
6902
|
+
if (kept && !fresh && (kept.pending || Date.now() - kept.at < (kept.answer?.error ? 60_000 : PEEK_KEEP_MS))) return kept.pending ?? kept.answer;
|
|
6899
6903
|
const pending = post(`${API}/tether/${path}`, body)
|
|
6900
6904
|
.then((answer) => { peekKept.set(key, { at: Date.now(), answer }); return answer; })
|
|
6901
|
-
.catch((error) => {
|
|
6905
|
+
.catch((error) => { const answer = { error: error.message || failed }; peekKept.set(key, { at: Date.now(), answer }); return answer; });
|
|
6902
6906
|
peekKept.set(key, { at: Date.now(), pending });
|
|
6903
6907
|
return pending;
|
|
6904
6908
|
}
|