@estiva-app/interop 0.99.0 → 0.101.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 +15 -0
- 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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loadQuery.d.ts.map +1 -1
- package/dist/loadQuery.js +64 -0
- package/dist/loadQuery.js.map +1 -1
- package/dist/projection.d.ts +8 -0
- package/dist/projection.d.ts.map +1 -1
- package/dist/projection.js +6 -4
- 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/index.ts +1 -0
- package/src/loadQuery.ts +72 -0
- package/src/projection.ts +14 -4
- 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;;;;;;;;;;;;;;;;;;;;;;;GAu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BAAE,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.101.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/index.ts
CHANGED
package/src/loadQuery.ts
CHANGED
|
@@ -81,6 +81,42 @@ function wholeKindsOf(filter: Filter, paged: boolean): WholeKinds | null {
|
|
|
81
81
|
return { kinds, limit: limit ?? RELAY_PAGE_CEILING }
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* SPEC §6.13's list read of files by address, `{ kinds: [kind], authors:
|
|
86
|
+
* [pubkey], '#d': ds, limit, fields: 'newest' }` (with `text: true`, the text
|
|
87
|
+
* too): each `d` answers one file, its first record and its fields' current
|
|
88
|
+
* changes, and `limit` counts first records. So a page with room for every
|
|
89
|
+
* file named holds each one whole, or says it has none (deleted, or not this
|
|
90
|
+
* reader's).
|
|
91
|
+
*/
|
|
92
|
+
interface ListRead {
|
|
93
|
+
kind: number
|
|
94
|
+
author: string
|
|
95
|
+
ds: string[]
|
|
96
|
+
text: boolean
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function listReadOf(filter: Filter): ListRead | null {
|
|
100
|
+
const { kinds, authors, limit, fields, text, ...rest } = filter
|
|
101
|
+
const ds = rest['#d']
|
|
102
|
+
if (Object.keys(rest).length !== 1 || fields !== 'newest' || (text !== undefined && text !== true)) return null
|
|
103
|
+
if (!Array.isArray(kinds) || kinds.length !== 1 || typeof kinds[0] !== 'number') return null
|
|
104
|
+
if (!Array.isArray(authors) || authors.length !== 1 || typeof authors[0] !== 'string') return null
|
|
105
|
+
if (!Array.isArray(ds) || ds.length === 0 || !ds.every((d) => typeof d === 'string')) return null
|
|
106
|
+
const files = new Set(ds).size
|
|
107
|
+
if (typeof limit !== 'number' || limit < files || files > RELAY_PAGE_CEILING) return null
|
|
108
|
+
return { kind: kinds[0], author: authors[0], ds, text: text === true }
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** A list read's answer for one file: its first record (by `d`) and the changes whose file it is (their first `a`, §6.10). */
|
|
112
|
+
function fileOf(read: ListRead, d: string, answer: SignedEvent[]): SignedEvent[] {
|
|
113
|
+
const address = `${read.kind}:${read.author}:${d}`
|
|
114
|
+
return answer.filter((event) => {
|
|
115
|
+
if (event.kind === read.kind && event.pubkey === read.author) return event.tags.find((tag) => tag[0] === 'd')?.[1] === d
|
|
116
|
+
return event.tags.find((tag) => tag[0] === 'a')?.[1] === address
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
84
120
|
/**
|
|
85
121
|
* The tags a whole read answers a later read by: the ones the relay matches as
|
|
86
122
|
* NIP-01 does, on every kind. Never `h`, which is a Folder's scope on the relay
|
|
@@ -163,6 +199,9 @@ export function createLoadQuery(query: QueryFn, options: LoadQueryOptions = {}):
|
|
|
163
199
|
const known = new Map<string, Held>()
|
|
164
200
|
// Per kind: every event of it, read by a filter naming only kinds.
|
|
165
201
|
const wholes = new Map<number, Held>()
|
|
202
|
+
// Per file a list read asked for, `<text|list>:<kind>:<author>:<d>`: what the relay answered for it (APP-11).
|
|
203
|
+
const files = new Map<string, Promise<SignedEvent[]>>()
|
|
204
|
+
const fileKey = (read: ListRead, d: string) => `${read.text ? 'text' : 'list'}:${read.kind}:${read.author}:${d}`
|
|
166
205
|
const flights = new Map<string, Promise<SignedEvent[]>>()
|
|
167
206
|
|
|
168
207
|
const remember = <K>(memo: Map<K, Held>, key: K, entry: Held) => {
|
|
@@ -192,7 +231,30 @@ export function createLoadQuery(query: QueryFn, options: LoadQueryOptions = {}):
|
|
|
192
231
|
// Answered from a held read; `again` is what to ask if that read's page came back full.
|
|
193
232
|
const joined: { again: Filter; entry: Promise<SignedEvent[] | null> }[] = []
|
|
194
233
|
const joinedByTag: { shape: ByTag; value: string; entry: Promise<SignedEvent[] | null> }[] = []
|
|
234
|
+
const askedFiles: ListRead[] = []
|
|
235
|
+
// A Set, and the files this call asks, so a file two of its filters name is answered and asked once.
|
|
236
|
+
const joinedFiles = new Set<Promise<SignedEvent[]>>()
|
|
237
|
+
const askedHere = new Set<string>()
|
|
195
238
|
for (const filter of filters) {
|
|
239
|
+
// Several Folders list the same files: each is read once per load, the rest of a list read goes on (APP-11).
|
|
240
|
+
const list = listReadOf(filter)
|
|
241
|
+
if (list) {
|
|
242
|
+
const fresh: string[] = []
|
|
243
|
+
for (const d of new Set(list.ds)) {
|
|
244
|
+
const key = fileKey(list, d)
|
|
245
|
+
const held = files.get(key)
|
|
246
|
+
if (held) joinedFiles.add(held)
|
|
247
|
+
else if (!askedHere.has(key)) {
|
|
248
|
+
askedHere.add(key)
|
|
249
|
+
fresh.push(d)
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (fresh.length === 0) continue
|
|
253
|
+
// `limit` counts first records: one per file asked.
|
|
254
|
+
send.push({ ...filter, '#d': fresh, limit: fresh.length })
|
|
255
|
+
askedFiles.push({ ...list, ds: fresh })
|
|
256
|
+
continue
|
|
257
|
+
}
|
|
196
258
|
const whole = wholeKindsOf(filter, paged)
|
|
197
259
|
if (whole) {
|
|
198
260
|
const held = whole.kinds.map((kind) => wholes.get(kind))
|
|
@@ -226,6 +288,15 @@ export function createLoadQuery(query: QueryFn, options: LoadQueryOptions = {}):
|
|
|
226
288
|
}
|
|
227
289
|
|
|
228
290
|
const answer = send.length ? ask(send) : Promise.resolve([])
|
|
291
|
+
for (const read of askedFiles) {
|
|
292
|
+
for (const d of read.ds) {
|
|
293
|
+
const key = fileKey(read, d)
|
|
294
|
+
const entry = answer.then((events) => fileOf(read, d, events))
|
|
295
|
+
files.set(key, entry)
|
|
296
|
+
// A refused read is forgotten, so the next ask goes to the relay.
|
|
297
|
+
entry.catch(() => files.get(key) === entry && files.delete(key))
|
|
298
|
+
}
|
|
299
|
+
}
|
|
229
300
|
for (const shape of askedWhole) {
|
|
230
301
|
const split = answer.then((events) => completeWhole(shape, events, paged))
|
|
231
302
|
for (const kind of shape.kinds) {
|
|
@@ -240,6 +311,7 @@ export function createLoadQuery(query: QueryFn, options: LoadQueryOptions = {}):
|
|
|
240
311
|
}
|
|
241
312
|
|
|
242
313
|
const out = [...(await answer)]
|
|
314
|
+
for (const entry of joinedFiles) out.push(...(await entry))
|
|
243
315
|
const again: Filter[] = []
|
|
244
316
|
for (const { again: filter, entry } of joined) {
|
|
245
317
|
const events = await entry
|
package/src/projection.ts
CHANGED
|
@@ -3748,7 +3748,7 @@ export async function resolveForeignObjects(
|
|
|
3748
3748
|
: []
|
|
3749
3749
|
const [read, opened, creatorLists, fileLists] = await Promise.all([
|
|
3750
3750
|
queryChunked(filters, query),
|
|
3751
|
-
openedEvents(plans.map(({ plan }) => plan), query),
|
|
3751
|
+
openedEvents(plans.map(({ plan }) => plan), query, !options.withoutText),
|
|
3752
3752
|
Promise.all(kinds.map((kind) => creatorsOrNone(kind, query, cache))),
|
|
3753
3753
|
Promise.all(folders.map((folder) => folderFilesOf(folder, query, lookupPeople, cache))),
|
|
3754
3754
|
])
|
|
@@ -3794,13 +3794,15 @@ export async function resolveForeignObjects(
|
|
|
3794
3794
|
// it happened to be resolved beside.
|
|
3795
3795
|
const own: People = {}
|
|
3796
3796
|
for (const key of peopleOf(built)) if (key in people) own[key] = people[key]
|
|
3797
|
-
|
|
3797
|
+
const object = withFiles(
|
|
3798
3798
|
withBorrowed(
|
|
3799
3799
|
withPeople(built, own),
|
|
3800
3800
|
borrowedActions(plan.pointer.kind, plan.resolved, creatorsByKind.get(plan.pointer.kind) ?? []),
|
|
3801
3801
|
),
|
|
3802
3802
|
plan.pointer.kind === KIND_CHANNEL_METADATA ? filesByFolder.get(plan.pointer.identifier) : undefined,
|
|
3803
3803
|
)
|
|
3804
|
+
// Opened without its text: what it says was not read, as a list read's (APP-11).
|
|
3805
|
+
results[reference] = options.withoutText && plan.opened ? textUnread([object])[0]! : object
|
|
3804
3806
|
}
|
|
3805
3807
|
return results
|
|
3806
3808
|
}
|
|
@@ -4334,6 +4336,14 @@ export interface ArchiveReadOptions {
|
|
|
4334
4336
|
* card would pay it every time (SHI-13's one request per tick).
|
|
4335
4337
|
*/
|
|
4336
4338
|
archivedWith?: boolean
|
|
4339
|
+
/**
|
|
4340
|
+
* With `openRead`, open each file by the list read (SPEC §6.13) without its
|
|
4341
|
+
* text: its first record and each field's current change, for a list that
|
|
4342
|
+
* draws a file's title, summary and conversation but never what it says.
|
|
4343
|
+
* Each opened file's `prevs.description` reads as unread (`''`), as a list
|
|
4344
|
+
* read's does. The Screener's rows (APP-11: 3.5 MB of text on Miky's Desk).
|
|
4345
|
+
*/
|
|
4346
|
+
withoutText?: boolean
|
|
4337
4347
|
/**
|
|
4338
4348
|
* For a Folder's card: also list the files in it this reader can open, as
|
|
4339
4349
|
* `children` — SPEC §3.2. What its relay-signed `30890` lists, read as
|
|
@@ -4756,7 +4766,7 @@ function planObject(
|
|
|
4756
4766
|
* reader's — has its root and every change read as before, so a deleted file
|
|
4757
4767
|
* still says who deleted it and an unreadable one is still told apart from it.
|
|
4758
4768
|
*/
|
|
4759
|
-
async function openedEvents(plans: readonly ObjectPlan[], query: QueryFn): Promise<SignedEvent[]> {
|
|
4769
|
+
async function openedEvents(plans: readonly ObjectPlan[], query: QueryFn, text = true): Promise<SignedEvent[]> {
|
|
4760
4770
|
const opened = new Map<string, ObjectPlan>()
|
|
4761
4771
|
for (const plan of plans) if (plan.opened) opened.set(plan.address, plan)
|
|
4762
4772
|
if (opened.size === 0) return []
|
|
@@ -4771,7 +4781,7 @@ async function openedEvents(plans: readonly ObjectPlan[], query: QueryFn): Promi
|
|
|
4771
4781
|
for (const { kind, pubkey, identifiers } of groups.values()) {
|
|
4772
4782
|
for (let start = 0; start < identifiers.length; start += RELAY_PAGE_CEILING) {
|
|
4773
4783
|
const chunk = identifiers.slice(start, start + RELAY_PAGE_CEILING)
|
|
4774
|
-
filters.push({ fields: 'newest', kinds: [kind], authors: [pubkey], '#d': chunk, limit: chunk.length, text: true })
|
|
4784
|
+
filters.push({ fields: 'newest', kinds: [kind], authors: [pubkey], '#d': chunk, limit: chunk.length, ...(text ? { text: true } : {}) })
|
|
4775
4785
|
}
|
|
4776
4786
|
}
|
|
4777
4787
|
const answered = await queryChunked(filters, query)
|
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,
|