@estiva-app/interop 0.108.0 → 0.108.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@estiva-app/interop",
3
- "version": "0.108.0",
3
+ "version": "0.108.1",
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",
package/src/fields.ts CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  type UnsignedEvent,
33
33
  } from '@estiva-app/protocol'
34
34
  import { refusalCode } from './folders.js'
35
- import { folderOf, type QueryFn } from './projection.js'
35
+ import { SUMMARY_FIELD, inTargetFolder, targetFolders, type QueryFn } from './projection.js'
36
36
 
37
37
  /** The change event every Estiva app writes (SPEC §6.2). */
38
38
  const KIND_CHANGE = 1851
@@ -128,9 +128,16 @@ export function filesOf(events: readonly SignedEvent[], options: { withText?: bo
128
128
  if (!file) continue
129
129
  const O = tagValue(event, 'O')
130
130
  if (O !== undefined && O !== tagValue(file.root, 'd')) continue
131
- if (tagValue(event, 'h') !== (folderOf(file.root) ?? undefined)) continue
131
+ // A root that names no team cannot be checked, and §6.2 folds its changes
132
+ // as before — but never a summary (§6.12) or a delete (§6.5), which need a
133
+ // team. `projectEvents` reads them the same way, by the same check; this
134
+ // read dropped every such change, so a renamed bare file listed its first
135
+ // title (TES-2).
136
+ const folders = targetFolders(file.root)
137
+ if (!inTargetFolder(event, folders)) continue
132
138
  for (const set of fieldsSetBy(event)) {
133
139
  if (set.field === TEXT_FIELD && !options.withText) continue
140
+ if (!folders && (set.field === SUMMARY_FIELD || set.field === DELETED_FIELD)) continue
134
141
  const held = file.fields[set.field]
135
142
  if (held && !newer(event, held.event)) continue
136
143
  file.fields[set.field] = { ...set, id: event.id, pubkey: event.pubkey, at: changedAt(event), event }
package/src/projection.ts CHANGED
@@ -2385,7 +2385,7 @@ type FoldedField = { value: string; format?: ContentFormat; stage?: Stage }
2385
2385
  *
2386
2386
  * Built once per root, and asked once per change.
2387
2387
  */
2388
- function targetFolders(root: SignedEvent | undefined): ReadonlySet<string> | undefined {
2388
+ export function targetFolders(root: SignedEvent | undefined): ReadonlySet<string> | undefined {
2389
2389
  if (!root) return undefined
2390
2390
  const folders = new Set(PLACEMENTS.flatMap((name) => root.tags.filter((t) => t[0] === name && t[1]).map((t) => t[1]!)))
2391
2391
  if (root.kind === KIND_CHANNEL_METADATA) {
@@ -2395,7 +2395,7 @@ function targetFolders(root: SignedEvent | undefined): ReadonlySet<string> | und
2395
2395
  return folders.size ? folders : undefined
2396
2396
  }
2397
2397
 
2398
- function inTargetFolder(change: SignedEvent, folders: ReadonlySet<string> | undefined): boolean {
2398
+ export function inTargetFolder(change: SignedEvent, folders: ReadonlySet<string> | undefined): boolean {
2399
2399
  if (!folders) return true
2400
2400
  // The first `h` with a value, as the relay reads it: an empty `["h"]` ahead
2401
2401
  // of a real one must not make this read a different Folder from the one the
@@ -2595,7 +2595,10 @@ function archiveOf(
2595
2595
  root: SignedEvent | undefined,
2596
2596
  folderAdmins?: ReadonlySet<string>,
2597
2597
  ): Archive | undefined {
2598
- const [kind, , identifier] = address.split(':')
2598
+ // The `d` is everything after the pubkey: an id may hold a colon, and cutting
2599
+ // it there dropped every archive whose `O` named the whole id (TES-2).
2600
+ const [kind, , ...rest] = address.split(':')
2601
+ const identifier = rest.join(':')
2599
2602
  if (Number(kind) === KIND_CHANNEL) {
2600
2603
  if (!folderAdmins?.size) return undefined
2601
2604
  changes = changes.filter((change) => tagValue(change, 'h') === identifier && folderAdmins.has(change.pubkey))