@estiva-app/conversation 0.12.0 → 0.13.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 +16 -0
- package/README.md +1 -0
- package/dist/composer.d.ts +80 -0
- package/dist/composer.d.ts.map +1 -0
- package/dist/composer.js +145 -0
- package/dist/composer.js.map +1 -0
- package/dist/edits.d.ts +1 -1
- package/dist/edits.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/composer.ts +178 -0
- package/src/edits.ts +1 -1
- package/src/index.ts +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,22 @@ none. A change to how an event is read is a MINOR in `0.x` even when no
|
|
|
6
6
|
signature moved, because two apps on different versions would then disagree
|
|
7
7
|
about a conversation.
|
|
8
8
|
|
|
9
|
+
## 0.13.0 — 2026-10-17
|
|
10
|
+
|
|
11
|
+
**What the shared comment box holds, as the message it writes, and back**
|
|
12
|
+
(COMM-2). `@estiva-app/ui/editor`'s `CommentBox` hands its app the editor's
|
|
13
|
+
document; `composerText(doc)` is the trimmed marker text a send writes and the
|
|
14
|
+
keys its urgent chips name, for `urgentTagsFor`. `composerDocument(text,
|
|
15
|
+
labels, urgent?)` opens an edit or a draft with its people and references as
|
|
16
|
+
chips again, and leaves as a `reference` whatever the app cannot name, or one
|
|
17
|
+
with marks or a card. `withoutNewUrgency` (an edit makes nobody newly urgent)
|
|
18
|
+
and `composerDraft(store, key, labels)` (a `DraftStore` in the box's terms)
|
|
19
|
+
come with them. Moved from Ship's `composerTriggers.tsx`, byte for byte in what
|
|
20
|
+
they write, so every app's box writes the same text.
|
|
21
|
+
|
|
22
|
+
SPEC: none changed how this package reads or writes; §13.1 is written as
|
|
23
|
+
before.
|
|
24
|
+
|
|
9
25
|
## 0.12.0 — 2026-10-16
|
|
10
26
|
|
|
11
27
|
**A `[` row carries the file's summary, and a Leaf page is a type `[` names**
|
package/README.md
CHANGED
|
@@ -26,6 +26,7 @@ pass, the clock is a `createdAtMs` you pass, and drafts take their storage.
|
|
|
26
26
|
| threading | §6.4 *Replies* | `parentOf`, `groupThreads` |
|
|
27
27
|
| writing | §6.4 | `buildComment`, `buildReply`, `referenceTagsFor`, `mentionTagsFor` |
|
|
28
28
|
| what a composer's pick writes | §13.1 | `mentionText`, `messageReference`, `urgentTagsFor`, `URGENT_TAG` |
|
|
29
|
+
| what the shared comment box holds, as the message it writes, and back | §13.1 | `composerText`, `composerDocument`, `withoutNewUrgency`, `composerDraft` |
|
|
29
30
|
| what `[` offers, and in what order | §13.1 | `rankReferences`, `referenceMatch`, `fileReference`, `referenceSearch`, `MESSAGE_TIER`, `FILE_TIER`, `REFERENCE_CAPS` |
|
|
30
31
|
| ordering | §6.2, §6.3 | `trustedTs`, `orderingMs`, `byOrder` |
|
|
31
32
|
| edits and attachments | §6.8 | `editTargetOf`, `foldEdits`, `foldAttachments` |
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the shared comment box holds, as the message it writes, and back
|
|
3
|
+
* (COMM-2).
|
|
4
|
+
*
|
|
5
|
+
* The box is `@estiva-app/ui/editor`'s `CommentBox`, and it hands its app the
|
|
6
|
+
* editor's document: a person as a `mention` or `urgentMention` chip, a
|
|
7
|
+
* message or a file as a `captionedReference` chip. That package depends on no
|
|
8
|
+
* protocol package, so the translation is here, once, for every app — Ship
|
|
9
|
+
* wrote it itself until now (`chipsAsReferences`, `withoutNewUrgency`,
|
|
10
|
+
* `urgentChipsFrom`), and Peek and Leaf each would have again.
|
|
11
|
+
*
|
|
12
|
+
* - {@link composerText}: the document → the marker text a send writes, and the
|
|
13
|
+
* people it names urgently (what {@link urgentTagsFor} takes).
|
|
14
|
+
* - {@link composerDocument}: marker text → the document an edit or a draft
|
|
15
|
+
* opens with, the people and references as chips again.
|
|
16
|
+
* - {@link withoutNewUrgency}: an edit's text, making nobody newly urgent.
|
|
17
|
+
* - {@link composerDraft}: a {@link DraftStore} as the box reads and writes it.
|
|
18
|
+
*
|
|
19
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/every-app-writes-and-reacts-with-one-shared-box.md
|
|
20
|
+
*/
|
|
21
|
+
import { type EditorDocument, type EditorNode } from '@estiva-app/protocol';
|
|
22
|
+
import type { DraftStore } from './drafts.js';
|
|
23
|
+
/** What a composer's document writes: the trimmed marker text, and whom it names urgently. */
|
|
24
|
+
export interface ComposerText {
|
|
25
|
+
text: string;
|
|
26
|
+
/** The keys its urgent chips name, once each; absent when none do. What `urgentTagsFor` takes. */
|
|
27
|
+
urgent?: string[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The message a composer's document writes: its marker text, trimmed, and the
|
|
31
|
+
* keys its urgent chips name. A document with no blocks (an edit of a message
|
|
32
|
+
* that is only files starts as one) is no text.
|
|
33
|
+
*
|
|
34
|
+
* The send then earns its tags from these, as before: `mentionTagsFor`,
|
|
35
|
+
* `urgentTagsFor(text, urgent)`, `quoteTagsFor`, `referenceTagsFor`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function composerText(doc: EditorDocument | EditorNode): ComposerText;
|
|
38
|
+
/** What a composer needs to draw marker text as chips again. Each answers `undefined` for what it does not know. */
|
|
39
|
+
export interface ComposerLabels {
|
|
40
|
+
/** A person's name, by key: their `nostr:npub…` becomes a chip again. */
|
|
41
|
+
personLabel?: (pubkey: string) => string | undefined;
|
|
42
|
+
/** A message's or a file's chip, by its `nostr:` URI, as `[` captioned it. */
|
|
43
|
+
referenceCaption?: (uri: string) => {
|
|
44
|
+
label: string;
|
|
45
|
+
snippet: string;
|
|
46
|
+
} | undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The document a composer opens with for marker text — an edit's or a draft's.
|
|
50
|
+
*
|
|
51
|
+
* A person written as `nostr:npub…` becomes a `mention` chip again, or an
|
|
52
|
+
* `urgentMention` one when `urgent` names them (§13.1 keeps the urgency in a
|
|
53
|
+
* tag, so marker text alone cannot say it); a message or a file becomes its
|
|
54
|
+
* `captionedReference` chip. Whatever `labels` does not know stays the
|
|
55
|
+
* `reference` it was, and so does one with marks or a card, which a chip
|
|
56
|
+
* would lose.
|
|
57
|
+
*/
|
|
58
|
+
export declare function composerDocument(text: string, labels?: ComposerLabels, urgent?: readonly string[]): EditorDocument;
|
|
59
|
+
/**
|
|
60
|
+
* An edit's text with any `!@Name` the message did not already hold written as
|
|
61
|
+
* an ordinary `@Name` — CON-24. An edit carries no tags, so it makes nobody
|
|
62
|
+
* urgent (Miky, kickoff, 2026-10-07); a hand-typed `!@Name` is the old urgent
|
|
63
|
+
* text, which Peek still draws urgent while it pages nobody.
|
|
64
|
+
*/
|
|
65
|
+
export declare function withoutNewUrgency(text: string, original: string): string;
|
|
66
|
+
/** One composer's draft, in the composer's own terms. */
|
|
67
|
+
export interface ComposerDraft {
|
|
68
|
+
/** The document to open with, or `undefined` when there is no draft. */
|
|
69
|
+
read(): EditorDocument | undefined;
|
|
70
|
+
/** Keep what is written; an empty document clears the draft. */
|
|
71
|
+
write(doc: EditorDocument): void;
|
|
72
|
+
clear(): void;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A draft kept in `store` under `key` (one of `draftKeys`), read and written as
|
|
76
|
+
* the composer's document: the marker text and the urgent picks (CON-31), and
|
|
77
|
+
* the chips back through {@link composerDocument}.
|
|
78
|
+
*/
|
|
79
|
+
export declare function composerDraft(store: DraftStore, key: string, labels?: ComposerLabels): ComposerDraft;
|
|
80
|
+
//# sourceMappingURL=composer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composer.d.ts","sourceRoot":"","sources":["../src/composer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,sBAAsB,CAAA;AAE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
* What the shared comment box holds, as the message it writes, and back
|
|
3
|
+
* (COMM-2).
|
|
4
|
+
*
|
|
5
|
+
* The box is `@estiva-app/ui/editor`'s `CommentBox`, and it hands its app the
|
|
6
|
+
* editor's document: a person as a `mention` or `urgentMention` chip, a
|
|
7
|
+
* message or a file as a `captionedReference` chip. That package depends on no
|
|
8
|
+
* protocol package, so the translation is here, once, for every app — Ship
|
|
9
|
+
* wrote it itself until now (`chipsAsReferences`, `withoutNewUrgency`,
|
|
10
|
+
* `urgentChipsFrom`), and Peek and Leaf each would have again.
|
|
11
|
+
*
|
|
12
|
+
* - {@link composerText}: the document → the marker text a send writes, and the
|
|
13
|
+
* people it names urgently (what {@link urgentTagsFor} takes).
|
|
14
|
+
* - {@link composerDocument}: marker text → the document an edit or a draft
|
|
15
|
+
* opens with, the people and references as chips again.
|
|
16
|
+
* - {@link withoutNewUrgency}: an edit's text, making nobody newly urgent.
|
|
17
|
+
* - {@link composerDraft}: a {@link DraftStore} as the box reads and writes it.
|
|
18
|
+
*
|
|
19
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/every-app-writes-and-reacts-with-one-shared-box.md
|
|
20
|
+
*/
|
|
21
|
+
import { blockDocumentToMarkerText, decodeNpub, documentForEditing, fromEditorDocument, toEditorDocument, } from '@estiva-app/protocol';
|
|
22
|
+
import { mentionText } from './compose.js';
|
|
23
|
+
const HEX_KEY = /^[0-9a-f]{64}$/;
|
|
24
|
+
const keyOf = (node) => {
|
|
25
|
+
const pubkey = node.attrs?.pubkey;
|
|
26
|
+
return typeof pubkey === 'string' && HEX_KEY.test(pubkey) ? pubkey : null;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The chips as the block bridge can write them. `fromEditorDocument` knows a
|
|
30
|
+
* `reference` and drops any inline node it does not, so a picked person would
|
|
31
|
+
* vanish from the message: a chip becomes the `reference` its `nostr:` text
|
|
32
|
+
* names (§13.1), or `@Name` / `!@Name` for somebody with no key.
|
|
33
|
+
*/
|
|
34
|
+
function chipsAsReferences(node) {
|
|
35
|
+
if (node.type === 'mention' || node.type === 'urgentMention') {
|
|
36
|
+
const pubkey = keyOf(node);
|
|
37
|
+
const written = mentionText({ pubkey, label: String(node.attrs?.label ?? '') }, node.type === 'urgentMention');
|
|
38
|
+
return pubkey ? { type: 'reference', attrs: { uri: written } } : { type: 'text', text: written };
|
|
39
|
+
}
|
|
40
|
+
if (node.type === 'captionedReference') {
|
|
41
|
+
const uri = typeof node.attrs?.uri === 'string' ? node.attrs.uri : '';
|
|
42
|
+
return uri ? { type: 'reference', attrs: { uri } } : { type: 'text', text: String(node.attrs?.label ?? '') };
|
|
43
|
+
}
|
|
44
|
+
return node.content ? { ...node, content: node.content.map(chipsAsReferences) } : node;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The message a composer's document writes: its marker text, trimmed, and the
|
|
48
|
+
* keys its urgent chips name. A document with no blocks (an edit of a message
|
|
49
|
+
* that is only files starts as one) is no text.
|
|
50
|
+
*
|
|
51
|
+
* The send then earns its tags from these, as before: `mentionTagsFor`,
|
|
52
|
+
* `urgentTagsFor(text, urgent)`, `quoteTagsFor`, `referenceTagsFor`.
|
|
53
|
+
*/
|
|
54
|
+
export function composerText(doc) {
|
|
55
|
+
const urgent = new Set();
|
|
56
|
+
const walk = (node) => {
|
|
57
|
+
if (node.type === 'urgentMention') {
|
|
58
|
+
const pubkey = keyOf(node);
|
|
59
|
+
if (pubkey)
|
|
60
|
+
urgent.add(pubkey);
|
|
61
|
+
}
|
|
62
|
+
node.content?.forEach(walk);
|
|
63
|
+
};
|
|
64
|
+
walk(doc);
|
|
65
|
+
const text = doc.content?.length ? blockDocumentToMarkerText(fromEditorDocument(chipsAsReferences(doc))).trim() : '';
|
|
66
|
+
return urgent.size > 0 ? { text, urgent: [...urgent] } : { text };
|
|
67
|
+
}
|
|
68
|
+
/** A reference that carries nothing a chip would drop: no marks, no card, no URL. */
|
|
69
|
+
const plainReference = (node) => {
|
|
70
|
+
if (node.type !== 'reference')
|
|
71
|
+
return null;
|
|
72
|
+
const { uri, marks, embed, extra, href } = node.attrs ?? {};
|
|
73
|
+
if (typeof uri !== 'string' || !uri)
|
|
74
|
+
return null;
|
|
75
|
+
if ((Array.isArray(marks) && marks.length > 0) || embed || extra || href)
|
|
76
|
+
return null;
|
|
77
|
+
return uri;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* The document a composer opens with for marker text — an edit's or a draft's.
|
|
81
|
+
*
|
|
82
|
+
* A person written as `nostr:npub…` becomes a `mention` chip again, or an
|
|
83
|
+
* `urgentMention` one when `urgent` names them (§13.1 keeps the urgency in a
|
|
84
|
+
* tag, so marker text alone cannot say it); a message or a file becomes its
|
|
85
|
+
* `captionedReference` chip. Whatever `labels` does not know stays the
|
|
86
|
+
* `reference` it was, and so does one with marks or a card, which a chip
|
|
87
|
+
* would lose.
|
|
88
|
+
*/
|
|
89
|
+
export function composerDocument(text, labels = {}, urgent) {
|
|
90
|
+
const keys = new Set(urgent ?? []);
|
|
91
|
+
const walk = (node) => {
|
|
92
|
+
const uri = plainReference(node);
|
|
93
|
+
if (uri && /^nostr:npub1/i.test(uri)) {
|
|
94
|
+
let pubkey = null;
|
|
95
|
+
try {
|
|
96
|
+
pubkey = decodeNpub(uri.slice('nostr:'.length).toLowerCase());
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
pubkey = null;
|
|
100
|
+
}
|
|
101
|
+
const label = pubkey ? labels.personLabel?.(pubkey) : undefined;
|
|
102
|
+
if (pubkey && label !== undefined)
|
|
103
|
+
return { type: keys.has(pubkey) ? 'urgentMention' : 'mention', attrs: { id: pubkey, label, pubkey } };
|
|
104
|
+
return node;
|
|
105
|
+
}
|
|
106
|
+
if (uri) {
|
|
107
|
+
const caption = labels.referenceCaption?.(uri);
|
|
108
|
+
if (caption)
|
|
109
|
+
return { type: 'captionedReference', attrs: { id: uri, label: caption.label, snippet: caption.snippet, uri } };
|
|
110
|
+
return node;
|
|
111
|
+
}
|
|
112
|
+
return node.content ? { ...node, content: node.content.map(walk) } : node;
|
|
113
|
+
};
|
|
114
|
+
return walk(toEditorDocument(documentForEditing(text, 'marker')));
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* An edit's text with any `!@Name` the message did not already hold written as
|
|
118
|
+
* an ordinary `@Name` — CON-24. An edit carries no tags, so it makes nobody
|
|
119
|
+
* urgent (Miky, kickoff, 2026-10-07); a hand-typed `!@Name` is the old urgent
|
|
120
|
+
* text, which Peek still draws urgent while it pages nobody.
|
|
121
|
+
*/
|
|
122
|
+
export function withoutNewUrgency(text, original) {
|
|
123
|
+
return text.replace(/!@([^\s!@]+)/g, (whole, name) => (original.includes(whole) ? whole : `@${name}`));
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* A draft kept in `store` under `key` (one of `draftKeys`), read and written as
|
|
127
|
+
* the composer's document: the marker text and the urgent picks (CON-31), and
|
|
128
|
+
* the chips back through {@link composerDocument}.
|
|
129
|
+
*/
|
|
130
|
+
export function composerDraft(store, key, labels = {}) {
|
|
131
|
+
return {
|
|
132
|
+
read() {
|
|
133
|
+
const draft = store.readDraft(key);
|
|
134
|
+
return draft && draft.text.trim() ? composerDocument(draft.text, labels, draft.urgent) : undefined;
|
|
135
|
+
},
|
|
136
|
+
write(doc) {
|
|
137
|
+
const { text, urgent } = composerText(doc);
|
|
138
|
+
store.write(key, text, urgent);
|
|
139
|
+
},
|
|
140
|
+
clear() {
|
|
141
|
+
store.clear(key);
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=composer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composer.js","sourceRoot":"","sources":["../src/composer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,yBAAyB,EACzB,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GAGjB,MA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OAAO;QACL,IAAI;YACF,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;YAClC,OAAO,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QACpG,CAAC;QACD,KAAK,CAAC,GAAG;YACP,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC,CAAA;YAC1C,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;QAChC,CAAC;QACD,KAAK;YACH,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAClB,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/edits.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export declare function foldAttachments(events: readonly SignedEvent[]): Record<
|
|
|
81
81
|
* edit removes a card. Which of these the body still names is
|
|
82
82
|
* `cardsIn`'s question, asked of the folded body. Messages with none are absent.
|
|
83
83
|
*
|
|
84
|
-
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/where-a-link-sits-
|
|
84
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/where-a-link-sits-and-which-file-gets-the-card.md
|
|
85
85
|
*/
|
|
86
86
|
export declare function foldEmbeds(events: readonly SignedEvent[]): Record<string, Embed[]>;
|
|
87
87
|
//# sourceMappingURL=edits.d.ts.map
|
package/dist/edits.js
CHANGED
|
@@ -128,7 +128,7 @@ export function foldAttachments(events) {
|
|
|
128
128
|
* edit removes a card. Which of these the body still names is
|
|
129
129
|
* `cardsIn`'s question, asked of the folded body. Messages with none are absent.
|
|
130
130
|
*
|
|
131
|
-
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/where-a-link-sits-
|
|
131
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/where-a-link-sits-and-which-file-gets-the-card.md
|
|
132
132
|
*/
|
|
133
133
|
export function foldEmbeds(events) {
|
|
134
134
|
const out = {};
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* apps: it imports no app's data layer, opens no socket, and takes every
|
|
13
13
|
* environment touch — the relay read, the clock, storage — as a parameter.
|
|
14
14
|
*/
|
|
15
|
-
export declare const CONVERSATION_VERSION = "0.
|
|
15
|
+
export declare const CONVERSATION_VERSION = "0.13.0";
|
|
16
16
|
export { KIND_MESSAGE, KIND_COMMENT, KIND_EDIT, KIND_REACTION, KIND_DELETION, KIND_ASSERTION, isConversationKind, isEventId, } from './kinds.js';
|
|
17
17
|
export { trustedTs, orderingMs, byOrder } from './order.js';
|
|
18
18
|
export { namedInBody, isReply, anchorsOf, isCommentOn, referencesAddress, strengthOn, threadStrength, referenceTagsFor, mentionTagsFor, peopleNamedInBody, MAX_MENTIONED_PEOPLE, type Strength, } from './strength.js';
|
|
@@ -22,6 +22,7 @@ export { REACTION_HORIZON, REACTION_EMOJI, reactionTargetOf, reactionEmojiOf, re
|
|
|
22
22
|
export { decorationsOf, type Decoration, type Decorations, type Resolution, type QueryFn } from './decorations.js';
|
|
23
23
|
export { buildComment, buildReply, offersEditAndDelete, type CommentRef } from './builders.js';
|
|
24
24
|
export { eventsNamedInBody, mentionText, messageReference, quoteTagsFor, URGENT_TAG, urgentTagsFor } from './compose.js';
|
|
25
|
+
export { composerDocument, composerDraft, composerText, withoutNewUrgency, type ComposerDraft, type ComposerLabels, type ComposerText, } from './composer.js';
|
|
25
26
|
export { FILE_TIER, fileReference, MESSAGE_TIER, rankReferences, REFERENCE_CAPS, referenceMatch, referenceSearch, refMatch, type RankedReferences, type RankReferencesInput, type ReferenceCandidate, type ReferenceSearch, type ReferenceSearchFn, type ReferenceSearchOptions, type ReferenceType, } from './references.js';
|
|
26
27
|
export { KIND_CHANGE, MEMBER_FIELD_PREFIX, memberField, memberOfField, mentions, streamOf, membershipOf, membersOf, membershipFilters, candidateFilesOf, buildMembershipChange, MUTED_D_TAG, APPDATA_TAG, parseMutedBlob, serializeMutedBlob, buildMutedEvent, mutedFilter, mutedFromFollowed, type Membership, type MutedList, } from './membership.js';
|
|
27
28
|
export { READ_STATE_TAG, READ_STATE_D_PREFIX, MAX_CONTEXTS, MAX_CONTEXT_ID_BYTES, MAX_TIMESTAMP, MAX_CLIENT_ID_BYTES, MAX_BLOB_BYTES, MAX_CONTEXTS_BYTES, READ_STATE_HORIZON_DAYS, channelContext, fileContext, threadContext, messageContext, toContextSeconds, isPublishableContextId, loadSlotIdentity, rotateSlotId, readStateDTag, parseReadStateBlob, serializeReadStateBlob, capContextsToBytes, capReadStateContexts, THREAD_RULE_FROM, REPLY_FLOOR_CONTEXT, advanceContexts, buildReadStateEvent, allSlotsFilter, mergeSlots, classifyOwnSlots, effectiveReadAt, threadReadAt, belowReplyFloor, fetchReadState, createSlotCache, publishReadState, type SlotCache, type SlotIdentity, type SlotStorage, type SlotSource, type RandomBytes, type ReadStateBlob, type CappedContexts, type SlotBlob, type OwnSlotVerdict, type Nip44, type FetchedReadState, } from './readState.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,WAAW,CAAA;AAE5C,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,aAAa,EACb,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,SAAS,GACV,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3D,OAAO,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,gBAAgB,EA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AW,EACX,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,GACf,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,WAAW,EACX,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,gBAAgB,GACtB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAElE,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,YAAY,GAClB,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,WAAW,CAAA;AAE5C,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,aAAa,EAC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,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAElE,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,YAAY,GAClB,MAAM,aAAa,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* apps: it imports no app's data layer, opens no socket, and takes every
|
|
13
13
|
* environment touch — the relay read, the clock, storage — as a parameter.
|
|
14
14
|
*/
|
|
15
|
-
export const CONVERSATION_VERSION = '0.
|
|
15
|
+
export const CONVERSATION_VERSION = '0.13.0';
|
|
16
16
|
export { KIND_MESSAGE, KIND_COMMENT, KIND_EDIT, KIND_REACTION, KIND_DELETION, KIND_ASSERTION, isConversationKind, isEventId, } from './kinds.js';
|
|
17
17
|
export { trustedTs, orderingMs, byOrder } from './order.js';
|
|
18
18
|
export { namedInBody, isReply, anchorsOf, isCommentOn, referencesAddress, strengthOn, threadStrength, referenceTagsFor, mentionTagsFor, peopleNamedInBody, MAX_MENTIONED_PEOPLE, } from './strength.js';
|
|
@@ -22,6 +22,7 @@ export { REACTION_HORIZON, REACTION_EMOJI, reactionTargetOf, reactionEmojiOf, re
|
|
|
22
22
|
export { decorationsOf } from './decorations.js';
|
|
23
23
|
export { buildComment, buildReply, offersEditAndDelete } from './builders.js';
|
|
24
24
|
export { eventsNamedInBody, mentionText, messageReference, quoteTagsFor, URGENT_TAG, urgentTagsFor } from './compose.js';
|
|
25
|
+
export { composerDocument, composerDraft, composerText, withoutNewUrgency, } from './composer.js';
|
|
25
26
|
export { FILE_TIER, fileReference, MESSAGE_TIER, rankReferences, REFERENCE_CAPS, referenceMatch, referenceSearch, refMatch, } from './references.js';
|
|
26
27
|
export { KIND_CHANGE, MEMBER_FIELD_PREFIX, memberField, memberOfField, mentions, streamOf, membershipOf, membersOf, membershipFilters, candidateFilesOf, buildMembershipChange, MUTED_D_TAG, APPDATA_TAG, parseMutedBlob, serializeMutedBlob, buildMutedEvent, mutedFilter, mutedFromFollowed, } from './membership.js';
|
|
27
28
|
export { READ_STATE_TAG, READ_STATE_D_PREFIX, MAX_CONTEXTS, MAX_CONTEXT_ID_BYTES, MAX_TIMESTAMP, MAX_CLIENT_ID_BYTES, MAX_BLOB_BYTES, MAX_CONTEXTS_BYTES, READ_STATE_HORIZON_DAYS, channelContext, fileContext, threadContext, messageContext, toContextSeconds, isPublishableContextId, loadSlotIdentity, rotateSlotId, readStateDTag, parseReadStateBlob, serializeReadStateBlob, capContextsToBytes, capReadStateContexts, THREAD_RULE_FROM, REPLY_FLOOR_CONTEXT, advanceContexts, buildReadStateEvent, allSlotsFilter, mergeSlots, classifyOwnSlots, effectiveReadAt, threadReadAt, belowReplyFloor, fetchReadState, createSlotCache, publishReadState, } from './readState.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAA;AAE5C,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,aAAa,EACb,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,SAAS,GACV,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3D,OAAO,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,GAErB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAiB,MAAM,cAAc,CAAA;AAEpE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAiB,MAAM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",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "The conversation rules of the Estiva SPEC (§6.2–§6.8, §11): comment and mention strengths, threading, the edit, reaction and attachment folds, NIP-22 comment and reply builders, drafts, NIP-RS read state, membership and unread. A convenience an app adopts, never a requirement.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/composer.ts
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the shared comment box holds, as the message it writes, and back
|
|
3
|
+
* (COMM-2).
|
|
4
|
+
*
|
|
5
|
+
* The box is `@estiva-app/ui/editor`'s `CommentBox`, and it hands its app the
|
|
6
|
+
* editor's document: a person as a `mention` or `urgentMention` chip, a
|
|
7
|
+
* message or a file as a `captionedReference` chip. That package depends on no
|
|
8
|
+
* protocol package, so the translation is here, once, for every app — Ship
|
|
9
|
+
* wrote it itself until now (`chipsAsReferences`, `withoutNewUrgency`,
|
|
10
|
+
* `urgentChipsFrom`), and Peek and Leaf each would have again.
|
|
11
|
+
*
|
|
12
|
+
* - {@link composerText}: the document → the marker text a send writes, and the
|
|
13
|
+
* people it names urgently (what {@link urgentTagsFor} takes).
|
|
14
|
+
* - {@link composerDocument}: marker text → the document an edit or a draft
|
|
15
|
+
* opens with, the people and references as chips again.
|
|
16
|
+
* - {@link withoutNewUrgency}: an edit's text, making nobody newly urgent.
|
|
17
|
+
* - {@link composerDraft}: a {@link DraftStore} as the box reads and writes it.
|
|
18
|
+
*
|
|
19
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/every-app-writes-and-reacts-with-one-shared-box.md
|
|
20
|
+
*/
|
|
21
|
+
import {
|
|
22
|
+
blockDocumentToMarkerText,
|
|
23
|
+
decodeNpub,
|
|
24
|
+
documentForEditing,
|
|
25
|
+
fromEditorDocument,
|
|
26
|
+
toEditorDocument,
|
|
27
|
+
type EditorDocument,
|
|
28
|
+
type EditorNode,
|
|
29
|
+
} from '@estiva-app/protocol'
|
|
30
|
+
import { mentionText } from './compose.js'
|
|
31
|
+
import type { DraftStore } from './drafts.js'
|
|
32
|
+
|
|
33
|
+
/** What a composer's document writes: the trimmed marker text, and whom it names urgently. */
|
|
34
|
+
export interface ComposerText {
|
|
35
|
+
text: string
|
|
36
|
+
/** The keys its urgent chips name, once each; absent when none do. What `urgentTagsFor` takes. */
|
|
37
|
+
urgent?: string[]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const HEX_KEY = /^[0-9a-f]{64}$/
|
|
41
|
+
|
|
42
|
+
const keyOf = (node: EditorNode): string | null => {
|
|
43
|
+
const pubkey = node.attrs?.pubkey
|
|
44
|
+
return typeof pubkey === 'string' && HEX_KEY.test(pubkey) ? pubkey : null
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The chips as the block bridge can write them. `fromEditorDocument` knows a
|
|
49
|
+
* `reference` and drops any inline node it does not, so a picked person would
|
|
50
|
+
* vanish from the message: a chip becomes the `reference` its `nostr:` text
|
|
51
|
+
* names (§13.1), or `@Name` / `!@Name` for somebody with no key.
|
|
52
|
+
*/
|
|
53
|
+
function chipsAsReferences(node: EditorNode): EditorNode {
|
|
54
|
+
if (node.type === 'mention' || node.type === 'urgentMention') {
|
|
55
|
+
const pubkey = keyOf(node)
|
|
56
|
+
const written = mentionText({ pubkey, label: String(node.attrs?.label ?? '') }, node.type === 'urgentMention')
|
|
57
|
+
return pubkey ? { type: 'reference', attrs: { uri: written } } : { type: 'text', text: written }
|
|
58
|
+
}
|
|
59
|
+
if (node.type === 'captionedReference') {
|
|
60
|
+
const uri = typeof node.attrs?.uri === 'string' ? node.attrs.uri : ''
|
|
61
|
+
return uri ? { type: 'reference', attrs: { uri } } : { type: 'text', text: String(node.attrs?.label ?? '') }
|
|
62
|
+
}
|
|
63
|
+
return node.content ? { ...node, content: node.content.map(chipsAsReferences) } : node
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The message a composer's document writes: its marker text, trimmed, and the
|
|
68
|
+
* keys its urgent chips name. A document with no blocks (an edit of a message
|
|
69
|
+
* that is only files starts as one) is no text.
|
|
70
|
+
*
|
|
71
|
+
* The send then earns its tags from these, as before: `mentionTagsFor`,
|
|
72
|
+
* `urgentTagsFor(text, urgent)`, `quoteTagsFor`, `referenceTagsFor`.
|
|
73
|
+
*/
|
|
74
|
+
export function composerText(doc: EditorDocument | EditorNode): ComposerText {
|
|
75
|
+
const urgent = new Set<string>()
|
|
76
|
+
const walk = (node: EditorNode) => {
|
|
77
|
+
if (node.type === 'urgentMention') {
|
|
78
|
+
const pubkey = keyOf(node)
|
|
79
|
+
if (pubkey) urgent.add(pubkey)
|
|
80
|
+
}
|
|
81
|
+
node.content?.forEach(walk)
|
|
82
|
+
}
|
|
83
|
+
walk(doc)
|
|
84
|
+
const text = doc.content?.length ? blockDocumentToMarkerText(fromEditorDocument(chipsAsReferences(doc) as EditorDocument)).trim() : ''
|
|
85
|
+
return urgent.size > 0 ? { text, urgent: [...urgent] } : { text }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** What a composer needs to draw marker text as chips again. Each answers `undefined` for what it does not know. */
|
|
89
|
+
export interface ComposerLabels {
|
|
90
|
+
/** A person's name, by key: their `nostr:npub…` becomes a chip again. */
|
|
91
|
+
personLabel?: (pubkey: string) => string | undefined
|
|
92
|
+
/** A message's or a file's chip, by its `nostr:` URI, as `[` captioned it. */
|
|
93
|
+
referenceCaption?: (uri: string) => { label: string; snippet: string } | undefined
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** A reference that carries nothing a chip would drop: no marks, no card, no URL. */
|
|
97
|
+
const plainReference = (node: EditorNode): string | null => {
|
|
98
|
+
if (node.type !== 'reference') return null
|
|
99
|
+
const { uri, marks, embed, extra, href } = node.attrs ?? {}
|
|
100
|
+
if (typeof uri !== 'string' || !uri) return null
|
|
101
|
+
if ((Array.isArray(marks) && marks.length > 0) || embed || extra || href) return null
|
|
102
|
+
return uri
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The document a composer opens with for marker text — an edit's or a draft's.
|
|
107
|
+
*
|
|
108
|
+
* A person written as `nostr:npub…` becomes a `mention` chip again, or an
|
|
109
|
+
* `urgentMention` one when `urgent` names them (§13.1 keeps the urgency in a
|
|
110
|
+
* tag, so marker text alone cannot say it); a message or a file becomes its
|
|
111
|
+
* `captionedReference` chip. Whatever `labels` does not know stays the
|
|
112
|
+
* `reference` it was, and so does one with marks or a card, which a chip
|
|
113
|
+
* would lose.
|
|
114
|
+
*/
|
|
115
|
+
export function composerDocument(text: string, labels: ComposerLabels = {}, urgent?: readonly string[]): EditorDocument {
|
|
116
|
+
const keys = new Set(urgent ?? [])
|
|
117
|
+
const walk = (node: EditorNode): EditorNode => {
|
|
118
|
+
const uri = plainReference(node)
|
|
119
|
+
if (uri && /^nostr:npub1/i.test(uri)) {
|
|
120
|
+
let pubkey: string | null = null
|
|
121
|
+
try {
|
|
122
|
+
pubkey = decodeNpub(uri.slice('nostr:'.length).toLowerCase())
|
|
123
|
+
} catch {
|
|
124
|
+
pubkey = null
|
|
125
|
+
}
|
|
126
|
+
const label = pubkey ? labels.personLabel?.(pubkey) : undefined
|
|
127
|
+
if (pubkey && label !== undefined) return { type: keys.has(pubkey) ? 'urgentMention' : 'mention', attrs: { id: pubkey, label, pubkey } }
|
|
128
|
+
return node
|
|
129
|
+
}
|
|
130
|
+
if (uri) {
|
|
131
|
+
const caption = labels.referenceCaption?.(uri)
|
|
132
|
+
if (caption) return { type: 'captionedReference', attrs: { id: uri, label: caption.label, snippet: caption.snippet, uri } }
|
|
133
|
+
return node
|
|
134
|
+
}
|
|
135
|
+
return node.content ? { ...node, content: node.content.map(walk) } : node
|
|
136
|
+
}
|
|
137
|
+
return walk(toEditorDocument(documentForEditing(text, 'marker')) as EditorNode) as EditorDocument
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* An edit's text with any `!@Name` the message did not already hold written as
|
|
142
|
+
* an ordinary `@Name` — CON-24. An edit carries no tags, so it makes nobody
|
|
143
|
+
* urgent (Miky, kickoff, 2026-10-07); a hand-typed `!@Name` is the old urgent
|
|
144
|
+
* text, which Peek still draws urgent while it pages nobody.
|
|
145
|
+
*/
|
|
146
|
+
export function withoutNewUrgency(text: string, original: string): string {
|
|
147
|
+
return text.replace(/!@([^\s!@]+)/g, (whole, name: string) => (original.includes(whole) ? whole : `@${name}`))
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** One composer's draft, in the composer's own terms. */
|
|
151
|
+
export interface ComposerDraft {
|
|
152
|
+
/** The document to open with, or `undefined` when there is no draft. */
|
|
153
|
+
read(): EditorDocument | undefined
|
|
154
|
+
/** Keep what is written; an empty document clears the draft. */
|
|
155
|
+
write(doc: EditorDocument): void
|
|
156
|
+
clear(): void
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* A draft kept in `store` under `key` (one of `draftKeys`), read and written as
|
|
161
|
+
* the composer's document: the marker text and the urgent picks (CON-31), and
|
|
162
|
+
* the chips back through {@link composerDocument}.
|
|
163
|
+
*/
|
|
164
|
+
export function composerDraft(store: DraftStore, key: string, labels: ComposerLabels = {}): ComposerDraft {
|
|
165
|
+
return {
|
|
166
|
+
read() {
|
|
167
|
+
const draft = store.readDraft(key)
|
|
168
|
+
return draft && draft.text.trim() ? composerDocument(draft.text, labels, draft.urgent) : undefined
|
|
169
|
+
},
|
|
170
|
+
write(doc) {
|
|
171
|
+
const { text, urgent } = composerText(doc)
|
|
172
|
+
store.write(key, text, urgent)
|
|
173
|
+
},
|
|
174
|
+
clear() {
|
|
175
|
+
store.clear(key)
|
|
176
|
+
},
|
|
177
|
+
}
|
|
178
|
+
}
|
package/src/edits.ts
CHANGED
|
@@ -146,7 +146,7 @@ export function foldAttachments(events: readonly SignedEvent[]): Record<string,
|
|
|
146
146
|
* edit removes a card. Which of these the body still names is
|
|
147
147
|
* `cardsIn`'s question, asked of the folded body. Messages with none are absent.
|
|
148
148
|
*
|
|
149
|
-
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/where-a-link-sits-
|
|
149
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/where-a-link-sits-and-which-file-gets-the-card.md
|
|
150
150
|
*/
|
|
151
151
|
export function foldEmbeds(events: readonly SignedEvent[]): Record<string, Embed[]> {
|
|
152
152
|
const out: Record<string, Embed[]> = {}
|
package/src/index.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* apps: it imports no app's data layer, opens no socket, and takes every
|
|
13
13
|
* environment touch — the relay read, the clock, storage — as a parameter.
|
|
14
14
|
*/
|
|
15
|
-
export const CONVERSATION_VERSION = '0.
|
|
15
|
+
export const CONVERSATION_VERSION = '0.13.0'
|
|
16
16
|
|
|
17
17
|
export {
|
|
18
18
|
KIND_MESSAGE,
|
|
@@ -66,6 +66,16 @@ export { buildComment, buildReply, offersEditAndDelete, type CommentRef } from '
|
|
|
66
66
|
|
|
67
67
|
export { eventsNamedInBody, mentionText, messageReference, quoteTagsFor, URGENT_TAG, urgentTagsFor } from './compose.js'
|
|
68
68
|
|
|
69
|
+
export {
|
|
70
|
+
composerDocument,
|
|
71
|
+
composerDraft,
|
|
72
|
+
composerText,
|
|
73
|
+
withoutNewUrgency,
|
|
74
|
+
type ComposerDraft,
|
|
75
|
+
type ComposerLabels,
|
|
76
|
+
type ComposerText,
|
|
77
|
+
} from './composer.js'
|
|
78
|
+
|
|
69
79
|
export {
|
|
70
80
|
FILE_TIER,
|
|
71
81
|
fileReference,
|