@estiva-app/interop 0.98.0 → 0.100.0
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/CHANGELOG.md +24 -0
- package/README.md +3 -2
- package/dist/activity.d.ts +10 -1
- package/dist/activity.d.ts.map +1 -1
- package/dist/activity.js +132 -3
- package/dist/activity.js.map +1 -1
- package/dist/folders.d.ts +5 -4
- package/dist/folders.d.ts.map +1 -1
- package/dist/folders.js +5 -4
- package/dist/folders.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/projection.d.ts +8 -3
- package/dist/projection.d.ts.map +1 -1
- package/dist/projection.js +56 -8
- package/dist/projection.js.map +1 -1
- package/dist/yourTopics.d.ts +3 -0
- package/dist/yourTopics.d.ts.map +1 -1
- package/dist/yourTopics.js +1 -1
- package/dist/yourTopics.js.map +1 -1
- package/package.json +3 -3
- package/src/activity.ts +138 -4
- package/src/folders.ts +5 -4
- package/src/index.ts +1 -0
- package/src/projection.ts +71 -10
- package/src/yourTopics.ts +4 -2
package/dist/yourTopics.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ProjectionCache, type QueryFn } from './projection.js';
|
|
2
2
|
import { type ListReadOptions, type ReadTopic } from './topics.js';
|
|
3
|
+
import { type TimesFn } from './activity.js';
|
|
3
4
|
/** {@link readYourTopics}' answer. */
|
|
4
5
|
export interface YourTopicsRead {
|
|
5
6
|
me: string;
|
|
@@ -31,5 +32,7 @@ export declare function readYourTopics(query: QueryFn, me: string, options: List
|
|
|
31
32
|
spaces?: boolean;
|
|
32
33
|
cache?: ProjectionCache;
|
|
33
34
|
nowSeconds?: number;
|
|
35
|
+
/** The relay's times read, where NIP-11 says `file_list.times`: the order is then learnt as times ({@link readTopicActivity}). */
|
|
36
|
+
times?: TimesFn;
|
|
34
37
|
}): Promise<YourTopicsRead>;
|
|
35
38
|
//# sourceMappingURL=yourTopics.d.ts.map
|
package/dist/yourTopics.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yourTopics.d.ts","sourceRoot":"","sources":["../src/yourTopics.ts"],"names":[],"mappings":"AA0BA,OAAO,EAQL,KAAK,eAAe,EACpB,KAAK,OAAO,EACb,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAcL,KAAK,eAAe,EACpB,KAAK,SAAS,EACf,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"yourTopics.d.ts","sourceRoot":"","sources":["../src/yourTopics.ts"],"names":[],"mappings":"AA0BA,OAAO,EAQL,KAAK,eAAe,EACpB,KAAK,OAAO,EACb,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAcL,KAAK,eAAe,EACpB,KAAK,SAAS,EACf,MAAM,aAAa,CAAA;AACpB,OAAO,EAAiD,KAAK,OAAO,EAAE,MAAM,eAAe,CAAA;AAQ3F,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV;;;;;;OAMG;IACH,MAAM,EAAE,SAAS,EAAE,CAAA;IACnB,iEAAiE;IACjE,EAAE,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACvB,iJAAiJ;IACjJ,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;CACvC;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,OAAO,EACd,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,eAAe,GAAG;IACzB,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kIAAkI;IAClI,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,GACA,OAAO,CAAC,cAAc,CAAC,CAsFzB"}
|
package/dist/yourTopics.js
CHANGED
|
@@ -116,7 +116,7 @@ export async function readYourTopics(query, me, options) {
|
|
|
116
116
|
const topics = candidates.map((topic) => ({ ...topic, listed: lists.get(topic.address) ?? [] }));
|
|
117
117
|
// 4. Their parents, while their activity is read: one archived with a parent is left out after.
|
|
118
118
|
const [activity] = await Promise.all([
|
|
119
|
-
readTopicActivity(query, activityTopics(topics), { nowSeconds: options.nowSeconds }),
|
|
119
|
+
readTopicActivity(query, activityTopics(topics), { nowSeconds: options.nowSeconds, times: options.times }),
|
|
120
120
|
markTopicsArchivedWith(topics.map((topic) => topic.object), query, cache, listRead ? FILE_KINDS : []),
|
|
121
121
|
]);
|
|
122
122
|
const open = topics.filter((topic) => !isArchived(topic.object));
|
package/dist/yourTopics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yourTopics.js","sourceRoot":"","sources":["../src/yourTopics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACnF,OAAO,EAAE,UAAU,EAAoB,MAAM,sBAAsB,CAAA;AACnE,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,sBAAsB,EACtB,aAAa,EACb,aAAa,GAId,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,SAAS,EACT,aAAa,EACb,OAAO,EACP,WAAW,EACX,UAAU,EACV,QAAQ,EACR,eAAe,EACf,eAAe,EACf,UAAU,GAGX,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"yourTopics.js","sourceRoot":"","sources":["../src/yourTopics.ts"],"names":[],"mappings":"AAAA;;;;;;;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AM,EAAE,MAAM,CAAC;4BAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;oBAC3G,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;gBACjC,CAAC;YACH,CAAC,EACD,CAAC,KAAc,EAAE,EAAE;gBACjB,KAAK,MAAM,GAAG,IAAI,IAAI;oBAAE,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YAC3C,CAAC,CACF,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@estiva-app/interop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.100.0",
|
|
4
4
|
"description": "Render and act on another app's objects from its published NIP-89 manifest. The owner defines the projection; the consumer decides how it looks.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@estiva-app/conversation": ">=0.34.0",
|
|
51
|
-
"@estiva-app/protocol": ">=0.
|
|
51
|
+
"@estiva-app/protocol": ">=0.59.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@estiva-app/conversation": ">=0.34.0",
|
|
55
|
-
"@estiva-app/protocol": ">=0.
|
|
55
|
+
"@estiva-app/protocol": ">=0.59.0",
|
|
56
56
|
"typescript": "~5.9.3"
|
|
57
57
|
}
|
|
58
58
|
}
|
package/src/activity.ts
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* No decision record states this order of topics: the rule lives here, and
|
|
38
38
|
* writing it up as SPEC §6.14 text is on the project's Later list.
|
|
39
39
|
*/
|
|
40
|
-
import { fileIdOf, type LiveRelay, type SignedEvent } from '@estiva-app/protocol'
|
|
40
|
+
import { fileIdOf, RELAY_PAGE_CEILING, type FileTimes, type LiveRelay, type SignedEvent } from '@estiva-app/protocol'
|
|
41
41
|
import { isAbout, KIND_COMMENT } from '@estiva-app/conversation'
|
|
42
42
|
import { folderOf, KIND_MESSAGE, type QueryFn } from './projection.js'
|
|
43
43
|
import { answeredByEach, answers, firstPages, nextPages, type ReadTopic } from './topics.js'
|
|
@@ -290,7 +290,16 @@ interface Probe {
|
|
|
290
290
|
export async function readTopicActivity(
|
|
291
291
|
query: QueryFn,
|
|
292
292
|
topics: readonly ActivityTopic[],
|
|
293
|
-
options: {
|
|
293
|
+
options: {
|
|
294
|
+
nowSeconds?: number
|
|
295
|
+
/**
|
|
296
|
+
* The relay's times read (SPEC §6.13, `"fields": "times"`), where NIP-11
|
|
297
|
+
* says `file_list.times` (`relayFileReadsOf`): the listed files' changes
|
|
298
|
+
* and the files under them are then learnt as times, never as whole
|
|
299
|
+
* changes and roots. Without it, every change is read whole as before.
|
|
300
|
+
*/
|
|
301
|
+
times?: TimesFn
|
|
302
|
+
} = {},
|
|
294
303
|
): Promise<TopicActivity> {
|
|
295
304
|
const now = options.nowSeconds ?? Math.floor(Date.now() / 1000)
|
|
296
305
|
const capped = (at: number) => Math.min(at, now)
|
|
@@ -324,12 +333,14 @@ export async function readTopicActivity(
|
|
|
324
333
|
const folderOfFile = new Map<string, string | null>()
|
|
325
334
|
for (const topic of topics) for (const file of topic.files) if (!folderOfFile.get(file.address)) folderOfFile.set(file.address, file.folder)
|
|
326
335
|
|
|
336
|
+
const times = options.times
|
|
327
337
|
const fileProbes = (target: ActivityFile, list: string[], keepsComments = false): Probe[] => {
|
|
328
338
|
const file = target.address
|
|
329
339
|
const id = fileIdOf(file)
|
|
330
340
|
// Every change carries the file's `a`; its `O` only since 30 Oct 2026. A comment carries `A`, or `O` in its newer form (§6.4).
|
|
341
|
+
// With the times read, a file's changes are learnt as times (readByTimes), and only its comments are read.
|
|
331
342
|
return [
|
|
332
|
-
{ filter: { kinds: [KIND_CHANGE], '#a': [file] }, target, topics: list },
|
|
343
|
+
...(times ? [] : [{ filter: { kinds: [KIND_CHANGE], '#a': [file] }, target, topics: list }]),
|
|
333
344
|
{ filter: { kinds: [KIND_COMMENT], '#A': [file] }, target, topics: list, keepsComments },
|
|
334
345
|
...(id ? [{ filter: { kinds: [KIND_COMMENT], '#O': [id] }, target, topics: list, keepsComments }] : []),
|
|
335
346
|
]
|
|
@@ -346,7 +357,8 @@ export async function readTopicActivity(
|
|
|
346
357
|
// first page of each file found by the level before, and every probe still
|
|
347
358
|
// open, a page further back. No filter here names a team (`#h`), the only
|
|
348
359
|
// values a relay caps per request, so none is split across requests.
|
|
349
|
-
|
|
360
|
+
if (times) await readByTimes(times)
|
|
361
|
+
const under = filesUnder(times ? [] : [...listed.keys()])
|
|
350
362
|
// Each file found under a listed one, as last found, and the topics it has been read for.
|
|
351
363
|
const asFound = new Map<string, ActivityFile>()
|
|
352
364
|
const readFor = new Map<string, Set<string>>()
|
|
@@ -387,6 +399,83 @@ export async function readTopicActivity(
|
|
|
387
399
|
for (const list of comments.values()) list.sort(oldestFirst)
|
|
388
400
|
return { at, files, folders, comments, parents }
|
|
389
401
|
|
|
402
|
+
/**
|
|
403
|
+
* The listed files' changes and the files under them, a level at a time, as
|
|
404
|
+
* the relay's times: each current change judged by the same rule as a whole
|
|
405
|
+
* one ({@link countsAsActivity}), each file found under one placed and its
|
|
406
|
+
* comments queued in `first` as {@link filesUnder} and the probes do.
|
|
407
|
+
*/
|
|
408
|
+
async function readByTimes(read: TimesFn): Promise<void> {
|
|
409
|
+
const count = (entry: FileTimes, on: Iterable<string>) => {
|
|
410
|
+
const list = [...on]
|
|
411
|
+
for (const change of entry.changes) {
|
|
412
|
+
const event = changeOf(entry.a, change)
|
|
413
|
+
for (const topic of list) if (countsAsActivity(event, topic)) bump(topic, change.created_at)
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
const byKind = new Map<number, string[]>()
|
|
417
|
+
for (const file of listed.keys()) {
|
|
418
|
+
const kind = kindOf(file)
|
|
419
|
+
const d = idOf(file)
|
|
420
|
+
if (kind === undefined || !d) continue
|
|
421
|
+
byKind.set(kind, [...(byKind.get(kind) ?? []), d])
|
|
422
|
+
}
|
|
423
|
+
const ownFilters = [...byKind].flatMap(([kind, ds]) =>
|
|
424
|
+
chunked(ds, VALUES_PER_FILTER).map((values) => ({ fields: 'times', kinds: [kind], '#d': values })),
|
|
425
|
+
)
|
|
426
|
+
const own = ownFilters.length > 0 ? read(ownFilters) : Promise.resolve([])
|
|
427
|
+
// Awaited after the walk; a refusal before then is not left unhandled, and still throws there.
|
|
428
|
+
own.catch(() => undefined)
|
|
429
|
+
// Each file under one is answered once per parent; each parent is walked once.
|
|
430
|
+
const found = new Set<string>()
|
|
431
|
+
let level = [...listed.keys()].filter((address) => CHILD_KINDS[kindOf(address) ?? -1])
|
|
432
|
+
const walked = new Set(level)
|
|
433
|
+
for (let depth = 0; depth < MAX_DEPTH && level.length > 0; depth++) {
|
|
434
|
+
const asked = new Set(level)
|
|
435
|
+
// A replaceable root the relay still holds twice is one file: its newest names its team.
|
|
436
|
+
const newest = new Map<string, FileTimes>()
|
|
437
|
+
for (const entry of await timesUnder(read, level)) {
|
|
438
|
+
if (!entry.under || !asked.has(entry.under) || !(CHILD_KINDS[kindOf(entry.under)!] ?? []).includes(kindOf(entry.a) ?? -1)) continue
|
|
439
|
+
const held = newest.get(entry.a)
|
|
440
|
+
if (!held || entry.created_at > held.created_at) newest.set(entry.a, entry)
|
|
441
|
+
}
|
|
442
|
+
const perParent = new Map<string, number>()
|
|
443
|
+
const next: string[] = []
|
|
444
|
+
for (const entry of [...newest.values()].sort((a, b) => b.created_at - a.created_at)) {
|
|
445
|
+
const parent = entry.under!
|
|
446
|
+
const taken = perParent.get(parent) ?? 0
|
|
447
|
+
if (taken >= MAX_CHILDREN) continue
|
|
448
|
+
perParent.set(parent, taken + 1)
|
|
449
|
+
if (found.has(`${parent} ${entry.a}`)) continue
|
|
450
|
+
found.add(`${parent} ${entry.a}`)
|
|
451
|
+
const file: ActivityFile = { address: entry.a, folder: entry.h }
|
|
452
|
+
parents.set(entry.a, parent)
|
|
453
|
+
const before = new Set(topicsOf.get(entry.a) ?? [])
|
|
454
|
+
for (const topic of topicsOf.get(parent) ?? []) {
|
|
455
|
+
if (!before.has(topic)) files.get(topic)!.push(file)
|
|
456
|
+
onTopic(entry.a, topic)
|
|
457
|
+
// A new issue filed in a listed project is news.
|
|
458
|
+
bump(topic, entry.created_at)
|
|
459
|
+
}
|
|
460
|
+
count(entry, topicsOf.get(entry.a) ?? [])
|
|
461
|
+
// Its comments, for the topics it was not already read for as a listed file.
|
|
462
|
+
const fresh = [...(topicsOf.get(entry.a) ?? [])].filter((topic) => !before.has(topic) && !listed.get(entry.a)?.has(topic))
|
|
463
|
+
const kept = listed.has(parent) && !listed.has(entry.a)
|
|
464
|
+
if (kept && !comments.has(entry.a)) comments.set(entry.a, [])
|
|
465
|
+
if (fresh.length > 0) first.push(...fileProbes(file, fresh, kept))
|
|
466
|
+
if (CHILD_KINDS[kindOf(entry.a) ?? -1] && !walked.has(entry.a)) {
|
|
467
|
+
walked.add(entry.a)
|
|
468
|
+
next.push(entry.a)
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
level = next
|
|
472
|
+
}
|
|
473
|
+
for (const entry of await own) {
|
|
474
|
+
const on = listed.get(entry.a)
|
|
475
|
+
if (on) count(entry, on)
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
390
479
|
/**
|
|
391
480
|
* Per probe, the newest event that counts for one of its topics, from the
|
|
392
481
|
* page this tick answered it: the probes still open, each a page further
|
|
@@ -444,6 +533,51 @@ function chunked<T>(list: readonly T[], size: number): T[][] {
|
|
|
444
533
|
return out
|
|
445
534
|
}
|
|
446
535
|
|
|
536
|
+
/** The relay's times read (`Relay.queryTimes`, or an app's own post through `timesOf`): every filter says `"fields": "times"`. */
|
|
537
|
+
export type TimesFn = (filters: Record<string, unknown>[]) => Promise<FileTimes[]>
|
|
538
|
+
|
|
539
|
+
/** Roots asked per page of a times read: a parent with thousands under it is still read whole, a page at a time. */
|
|
540
|
+
const TIMES_PAGE = RELAY_PAGE_CEILING
|
|
541
|
+
const MAX_TIMES_PAGES = 20
|
|
542
|
+
|
|
543
|
+
/** The files under the given ones, by the times read, every page of each filter. */
|
|
544
|
+
async function timesUnder(read: TimesFn, parents: readonly string[]): Promise<FileTimes[]> {
|
|
545
|
+
const kinds = [...new Set(parents.flatMap((address) => CHILD_KINDS[kindOf(address)!]!))]
|
|
546
|
+
let asking: Record<string, unknown>[] = chunked(parents, VALUES_PER_FILTER).map((values) => ({ fields: 'times', kinds, '#a': values, limit: TIMES_PAGE }))
|
|
547
|
+
const out: FileTimes[] = []
|
|
548
|
+
for (let page = 0; asking.length > 0 && page < MAX_TIMES_PAGES; page++) {
|
|
549
|
+
const answer = await read(asking)
|
|
550
|
+
out.push(...answer)
|
|
551
|
+
asking = asking.flatMap((filter) => {
|
|
552
|
+
const values = new Set(filter['#a'] as string[])
|
|
553
|
+
// The roots this filter picked, by the file each sits under.
|
|
554
|
+
const mine = answer.filter((entry) => entry.under !== undefined && values.has(entry.under))
|
|
555
|
+
if (mine.length < TIMES_PAGE) return []
|
|
556
|
+
const until = Math.min(...mine.map((entry) => entry.created_at))
|
|
557
|
+
// A second holding a whole page: asking again would repeat it.
|
|
558
|
+
return until === filter.until ? [] : [{ ...filter, until }]
|
|
559
|
+
})
|
|
560
|
+
}
|
|
561
|
+
return out
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* A current change as the times read answers it, shaped as the change {@link countsAsActivity} judges: its field names
|
|
566
|
+
* as `set` tags with no value. The rule reads a value only for `lists:` on the topic itself, whose changes are still
|
|
567
|
+
* read whole.
|
|
568
|
+
*/
|
|
569
|
+
function changeOf(file: string, change: FileTimes['changes'][number]): SignedEvent {
|
|
570
|
+
return {
|
|
571
|
+
id: change.id,
|
|
572
|
+
pubkey: '',
|
|
573
|
+
created_at: change.created_at,
|
|
574
|
+
kind: KIND_CHANGE,
|
|
575
|
+
tags: [['a', file], ...change.fields.map((field) => ['set', field, ''])],
|
|
576
|
+
content: '',
|
|
577
|
+
sig: '',
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
447
581
|
/**
|
|
448
582
|
* Keep {@link TopicActivity} current, live: hear every new event that is news
|
|
449
583
|
* for a topic it holds (the rule above), raise that topic's time, and say so.
|
package/src/folders.ts
CHANGED
|
@@ -117,8 +117,8 @@ export function planCreateFolder(
|
|
|
117
117
|
* Rename a Folder: `[kind:9002]`, and nothing else.
|
|
118
118
|
*
|
|
119
119
|
* The title is the channel's name (§3.2), so the channel is the only home to
|
|
120
|
-
* write. The relay refuses it to anybody but the channel's owners and admins
|
|
121
|
-
* A name left on an older state by a command is never shown.
|
|
120
|
+
* write. The relay refuses it to anybody but the channel's owners and admins
|
|
121
|
+
* (and, on a team with no owner, the workspace's). A name left on an older state by a command is never shown.
|
|
122
122
|
*/
|
|
123
123
|
export function planRenameFolder(
|
|
124
124
|
pubkey: string,
|
|
@@ -221,8 +221,9 @@ export function planUnlistFile(
|
|
|
221
221
|
* unlist a file from somewhere a person would have to remember.
|
|
222
222
|
*
|
|
223
223
|
* **Always in the Folder's own `h`**, and readers count it only from an owner
|
|
224
|
-
* or admin on the Folder's `kind:39001`
|
|
225
|
-
*
|
|
224
|
+
* or admin on the Folder's `kind:39001` — or, on a team with no owner, from an
|
|
225
|
+
* owner or admin of the workspace (§3.2) — the people who may rename it. So
|
|
226
|
+
* offer Archive only to them (`FolderSummary.admins`): from anybody else the
|
|
226
227
|
* relay accepts the event and every reader ignores it.
|
|
227
228
|
*
|
|
228
229
|
* `resolution` is what the person archiving said about it, carried as the
|
package/src/index.ts
CHANGED
package/src/projection.ts
CHANGED
|
@@ -2521,7 +2521,8 @@ export function isArchived(file: { archived?: Archive } | null | undefined): boo
|
|
|
2521
2521
|
*
|
|
2522
2522
|
* **A Folder is the exception** (SPEC §3.2): on a `kind:39000` address only a
|
|
2523
2523
|
* change in the Folder's own `h` by one of `folderAdmins` — the owners and
|
|
2524
|
-
* admins on its relay-signed `kind:39001
|
|
2524
|
+
* admins on its relay-signed `kind:39001`, and on a team with no owner the
|
|
2525
|
+
* workspace's owners and admins — counts. A caller that has not read
|
|
2525
2526
|
* the admin list passes none, and then no change counts: a Folder shown live
|
|
2526
2527
|
* when it is archived is recoverable, one any member could hide is not.
|
|
2527
2528
|
*/
|
|
@@ -6746,10 +6747,55 @@ function folderAdminsOf(admins: SignedEvent | undefined, channel: SignedEvent |
|
|
|
6746
6747
|
]
|
|
6747
6748
|
}
|
|
6748
6749
|
|
|
6750
|
+
/** NIP-43's relay membership list: the workspace's roster, one `member` tag per key, with its role. */
|
|
6751
|
+
const KIND_RELAY_MEMBERS = 13534
|
|
6752
|
+
|
|
6753
|
+
/** The relay's roster, as a filter to add to a request that already reads a team's records. */
|
|
6754
|
+
const RELAY_MEMBERS_FILTER = { kinds: [KIND_RELAY_MEMBERS], limit: 1 }
|
|
6755
|
+
|
|
6756
|
+
/**
|
|
6757
|
+
* The workspace's owners and admins: the `member` tags whose role is `owner`
|
|
6758
|
+
* or `admin` on the newest `kind:13534` signed by `relay` (the key that signed
|
|
6759
|
+
* the team's `kind:39000`). A roster anybody else signed means nothing.
|
|
6760
|
+
*/
|
|
6761
|
+
function workspaceAdminsOf(events: readonly SignedEvent[], relay: string): string[] {
|
|
6762
|
+
const roster = events
|
|
6763
|
+
.filter((event) => event.kind === KIND_RELAY_MEMBERS && event.pubkey === relay)
|
|
6764
|
+
.sort((a, b) => b.created_at - a.created_at || a.id.localeCompare(b.id))[0]
|
|
6765
|
+
if (!roster) return []
|
|
6766
|
+
return roster.tags
|
|
6767
|
+
.filter((tag) => tag[0] === 'member' && tag[1] && FOLDER_ADMIN_ROLES.has(tag[2] ?? ''))
|
|
6768
|
+
.map((tag) => tag[1])
|
|
6769
|
+
}
|
|
6770
|
+
|
|
6771
|
+
/**
|
|
6772
|
+
* Who may rename and archive a team: the owners and admins its relay-signed
|
|
6773
|
+
* `kind:39001` lists, and, when that list names no `owner`, the workspace's
|
|
6774
|
+
* owners and admins on the relay-signed roster as well. A team with no 39001 at
|
|
6775
|
+
* all is not taken as one with no owner: nothing says who is on it. Only a
|
|
6776
|
+
* team (`isTeam`: it holds a `kind:30890`) is looked after this way; a DM or
|
|
6777
|
+
* another conversation space, whose list names no owner either, never is.
|
|
6778
|
+
*
|
|
6779
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-team-with-no-owner-is-looked-after-by-the-workspaces-admins.md
|
|
6780
|
+
*/
|
|
6781
|
+
function teamStewardsOf(
|
|
6782
|
+
admins: SignedEvent | undefined,
|
|
6783
|
+
channel: SignedEvent | undefined,
|
|
6784
|
+
events: readonly SignedEvent[],
|
|
6785
|
+
isTeam: boolean,
|
|
6786
|
+
): string[] {
|
|
6787
|
+
const own = folderAdminsOf(admins, channel)
|
|
6788
|
+
if (!isTeam || !admins || !channel || admins.pubkey !== channel.pubkey) return own
|
|
6789
|
+
if (channel.tags.some((tag) => tag[0] === 't' && tag[1] === 'dm')) return own
|
|
6790
|
+
const hasOwner = admins.tags.some((tag) => tag[0] === 'p' && tag[1] && tag.slice(2).includes('owner'))
|
|
6791
|
+
return hasOwner ? own : [...new Set([...own, ...workspaceAdminsOf(events, channel.pubkey)])]
|
|
6792
|
+
}
|
|
6793
|
+
|
|
6749
6794
|
/**
|
|
6750
6795
|
* A Folder's own archive (SPEC §3.2): the `archived` changes on its channel's
|
|
6751
|
-
* address, counting only one carrying the Folder's own `h` whose author
|
|
6752
|
-
*
|
|
6796
|
+
* address, counting only one carrying the Folder's own `h` whose author is in
|
|
6797
|
+
* its {@link FolderSummary.admins} (its owners and admins, and on a team with
|
|
6798
|
+
* no owner the workspace's too). From anybody else the relay accepts the
|
|
6753
6799
|
* change, and it means nothing.
|
|
6754
6800
|
*/
|
|
6755
6801
|
function folderArchiveOf(changes: SignedEvent[], folder: Pick<FolderSummary, 'id' | 'channel' | 'admins'>): Archive | undefined {
|
|
@@ -6792,8 +6838,12 @@ export interface FolderSummary {
|
|
|
6792
6838
|
company?: true
|
|
6793
6839
|
/**
|
|
6794
6840
|
* Who may rename and archive it: the owners and admins on its relay-signed
|
|
6795
|
-
* `kind:39001
|
|
6796
|
-
*
|
|
6841
|
+
* `kind:39001` and, on a team whose 39001 lists no owner, the workspace's
|
|
6842
|
+
* owners and admins on the relay-signed roster (`kind:13534`) too. Offer
|
|
6843
|
+
* Archive only to them — a reader ignores an archive from anybody else
|
|
6844
|
+
* (§3.2). Absent when the relay returned no admin list.
|
|
6845
|
+
*
|
|
6846
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-team-with-no-owner-is-looked-after-by-the-workspaces-admins.md
|
|
6797
6847
|
*/
|
|
6798
6848
|
admins?: string[]
|
|
6799
6849
|
/**
|
|
@@ -6905,7 +6955,8 @@ export interface FolderContents extends FolderSummary {
|
|
|
6905
6955
|
*
|
|
6906
6956
|
* Both shapes in one pass: folders the relay maintains state for, and bare
|
|
6907
6957
|
* channels that have none yet. A channel with state appears once, titled by its
|
|
6908
|
-
* `kind:39000` (SPEC §3.2), with
|
|
6958
|
+
* `kind:39000` (SPEC §3.2), with who may rename and archive it
|
|
6959
|
+
* ({@link FolderSummary.admins}).
|
|
6909
6960
|
*
|
|
6910
6961
|
* **A direct route, deliberately.** §4.2's post-mortem on REW-11 is that
|
|
6911
6962
|
* discovering children only through their parent loses them when the parent
|
|
@@ -7014,6 +7065,8 @@ async function readFolderRecords(query: QueryFn): Promise<{ events: SignedEvent[
|
|
|
7014
7065
|
{ kinds: [KIND_FOLDER_STATE], limit: 500 },
|
|
7015
7066
|
{ kinds: [KIND_CHANNEL], limit: 500 },
|
|
7016
7067
|
{ kinds: [KIND_CHANNEL_ADMINS], limit: 500 },
|
|
7068
|
+
// Who looks after a team with no owner (FolderSummary.admins). Same request.
|
|
7069
|
+
RELAY_MEMBERS_FILTER,
|
|
7017
7070
|
])
|
|
7018
7071
|
const byId = new Map<string, FolderSummary>()
|
|
7019
7072
|
const channelOf = new Map<string, SignedEvent>()
|
|
@@ -7044,7 +7097,7 @@ async function readFolderRecords(query: QueryFn): Promise<{ events: SignedEvent[
|
|
|
7044
7097
|
if (name !== undefined) folder.name = name
|
|
7045
7098
|
if (channel.tags.some((tag) => tag[0] === 'private')) folder.private = true
|
|
7046
7099
|
if (channel.tags.some((tag) => tag[0] === 'company')) folder.company = true
|
|
7047
|
-
const admins =
|
|
7100
|
+
const admins = teamStewardsOf(adminsOf.get(id), channel, events, folder.hasState)
|
|
7048
7101
|
if (admins.length) folder.admins = admins
|
|
7049
7102
|
folder.channel = pointerToAddress({ kind: KIND_CHANNEL, pubkey: channel.pubkey, identifier: id, relays: [] })
|
|
7050
7103
|
}
|
|
@@ -7480,12 +7533,17 @@ export async function resolveFolderContents(
|
|
|
7480
7533
|
{ kinds: [KIND_FOLDER_STATE], '#d': [folder], limit: 1 },
|
|
7481
7534
|
{ kinds: [KIND_CHANNEL], '#d': [folder], limit: 1 },
|
|
7482
7535
|
{ kinds: [KIND_CHANNEL_ADMINS], '#d': [folder], limit: 1 },
|
|
7536
|
+
// Who looks after it, and every team it lists, when one has no owner. Same request.
|
|
7537
|
+
RELAY_MEMBERS_FILTER,
|
|
7483
7538
|
])
|
|
7484
7539
|
const state = identity.find((e) => e.kind === KIND_FOLDER_STATE && tagValue(e, 'd') === folder)
|
|
7485
7540
|
const channel = identity.find((e) => e.kind === KIND_CHANNEL && tagValue(e, 'd') === folder)
|
|
7486
|
-
const
|
|
7541
|
+
const roster = identity.filter((e) => e.kind === KIND_RELAY_MEMBERS)
|
|
7542
|
+
const admins = teamStewardsOf(
|
|
7487
7543
|
identity.find((e) => e.kind === KIND_CHANNEL_ADMINS && tagValue(e, 'd') === folder),
|
|
7488
7544
|
channel,
|
|
7545
|
+
roster,
|
|
7546
|
+
state !== undefined,
|
|
7489
7547
|
)
|
|
7490
7548
|
const channelAddress = channel
|
|
7491
7549
|
? pointerToAddress({ kind: KIND_CHANNEL, pubkey: channel.pubkey, identifier: folder, relays: [] })
|
|
@@ -7599,7 +7657,7 @@ export async function resolveFolderContents(
|
|
|
7599
7657
|
// Every change, in groups small enough that a busy Folder's changes cannot
|
|
7600
7658
|
// push one file's off the page — one Folder has already had 688. Same request.
|
|
7601
7659
|
...archiveFilters(channelAddress ? [...changesAsked, channelAddress] : changesAsked),
|
|
7602
|
-
// A Folder listed here counts its archive only from
|
|
7660
|
+
// A Folder listed here counts its archive only from who looks after it (§3.2). Same request.
|
|
7603
7661
|
...(nestedFolderIds.length ? [{ kinds: [KIND_CHANNEL_ADMINS], '#d': nestedFolderIds, limit: nestedFolderIds.length }] : []),
|
|
7604
7662
|
], query),
|
|
7605
7663
|
queryChunked(rootFilters.filter((filter) => 'fields' in filter), query),
|
|
@@ -7642,9 +7700,12 @@ export async function resolveFolderContents(
|
|
|
7642
7700
|
const nestedAdmins =
|
|
7643
7701
|
pointer.kind === KIND_CHANNEL
|
|
7644
7702
|
? new Set(
|
|
7645
|
-
|
|
7703
|
+
teamStewardsOf(
|
|
7646
7704
|
events.find((e) => e.kind === KIND_CHANNEL_ADMINS && tagValue(e, 'd') === pointer.identifier),
|
|
7647
7705
|
root,
|
|
7706
|
+
roster,
|
|
7707
|
+
// A team listed in this one; a DM listed here is still never looked after.
|
|
7708
|
+
true,
|
|
7648
7709
|
),
|
|
7649
7710
|
)
|
|
7650
7711
|
: undefined
|
package/src/yourTopics.ts
CHANGED
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
type ListReadOptions,
|
|
53
53
|
type ReadTopic,
|
|
54
54
|
} from './topics.js'
|
|
55
|
-
import { activityTopics, byActivity, readTopicActivity } from './activity.js'
|
|
55
|
+
import { activityTopics, byActivity, readTopicActivity, type TimesFn } from './activity.js'
|
|
56
56
|
|
|
57
57
|
const KIND_TOPIC = 30840
|
|
58
58
|
const KIND_CHANGE = 1851
|
|
@@ -95,6 +95,8 @@ export async function readYourTopics(
|
|
|
95
95
|
spaces?: boolean
|
|
96
96
|
cache?: ProjectionCache
|
|
97
97
|
nowSeconds?: number
|
|
98
|
+
/** The relay's times read, where NIP-11 says `file_list.times`: the order is then learnt as times ({@link readTopicActivity}). */
|
|
99
|
+
times?: TimesFn
|
|
98
100
|
},
|
|
99
101
|
): Promise<YourTopicsRead> {
|
|
100
102
|
const listRead = options.listRead ?? false
|
|
@@ -170,7 +172,7 @@ export async function readYourTopics(
|
|
|
170
172
|
|
|
171
173
|
// 4. Their parents, while their activity is read: one archived with a parent is left out after.
|
|
172
174
|
const [activity] = await Promise.all([
|
|
173
|
-
readTopicActivity(query, activityTopics(topics), { nowSeconds: options.nowSeconds }),
|
|
175
|
+
readTopicActivity(query, activityTopics(topics), { nowSeconds: options.nowSeconds, times: options.times }),
|
|
174
176
|
markTopicsArchivedWith(
|
|
175
177
|
topics.map((topic) => topic.object),
|
|
176
178
|
query,
|