@estiva-app/interop 0.106.0 → 0.108.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 +13 -0
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +4 -1
- package/dist/fields.js.map +1 -1
- package/dist/projection.d.ts +10 -0
- package/dist/projection.d.ts.map +1 -1
- package/dist/projection.js +2 -1
- package/dist/projection.js.map +1 -1
- package/package.json +2 -1
- package/src/fields.ts +5 -1
- package/src/projection.ts +12 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@estiva-app/interop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.108.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",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@estiva-app/conversation": ">=0.34.0",
|
|
55
55
|
"@estiva-app/protocol": ">=0.60.0",
|
|
56
|
+
"fast-check": "4.10.2",
|
|
56
57
|
"typescript": "~5.9.3"
|
|
57
58
|
}
|
|
58
59
|
}
|
package/src/fields.ts
CHANGED
|
@@ -113,7 +113,11 @@ export function filesOf(events: readonly SignedEvent[], options: { withText?: bo
|
|
|
113
113
|
if (event.kind === KIND_CHANGE || tagValue(event, 'd') === undefined) continue
|
|
114
114
|
const address = addressOfRoot(event)
|
|
115
115
|
const held = roots.get(address)
|
|
116
|
-
|
|
116
|
+
// Two versions of one record: the later `created_at`, then the lower id (§6.3, NIP-01), so
|
|
117
|
+
// the file is the same whichever version arrived first, and the same as `projectEvents` reads.
|
|
118
|
+
if (!held || event.created_at > held.created_at || (event.created_at === held.created_at && event.id < held.id)) {
|
|
119
|
+
roots.set(address, event)
|
|
120
|
+
}
|
|
117
121
|
}
|
|
118
122
|
const files = new Map<string, FileFields>()
|
|
119
123
|
for (const [address, root] of roots) files.set(address, { root, address, fields: {}, events: [root] })
|
package/src/projection.ts
CHANGED
|
@@ -7688,6 +7688,16 @@ export async function resolveFolderContents(
|
|
|
7688
7688
|
* not as the change before it.
|
|
7689
7689
|
*/
|
|
7690
7690
|
listRead?: boolean
|
|
7691
|
+
/**
|
|
7692
|
+
* With `listRead`, the file kinds of this Folder's own files it reads so;
|
|
7693
|
+
* every file kind when absent. The rest are read whole, text included, as
|
|
7694
|
+
* without it (a parent outside the Folder is still read by the list read,
|
|
7695
|
+
* for its archive only): an app that opens
|
|
7696
|
+
* a listed file of its own from this answer keeps reading that kind whole
|
|
7697
|
+
* while the kinds it only lists cost their current values (Leaf: its pages
|
|
7698
|
+
* whole, projects and issues by the list read, ISS-6).
|
|
7699
|
+
*/
|
|
7700
|
+
listReadKinds?: readonly number[]
|
|
7691
7701
|
} = {},
|
|
7692
7702
|
): Promise<FolderContents> {
|
|
7693
7703
|
// 1. The folder itself. Both kinds in one trip: the state is the model and
|
|
@@ -7801,7 +7811,8 @@ export async function resolveFolderContents(
|
|
|
7801
7811
|
// With the list read, a file's current changes come with its root. The relay
|
|
7802
7812
|
// keeps only its file kinds that way, so a nested Folder, or any other kind,
|
|
7803
7813
|
// is read as before.
|
|
7804
|
-
const
|
|
7814
|
+
const listKinds = options.listRead === true ? (options.listReadKinds ?? FILE_KINDS) : []
|
|
7815
|
+
const byFields = (kind: number) => listKinds.includes(kind) && FILE_KINDS.includes(kind)
|
|
7805
7816
|
const changesAsked = addresses.filter((address) => !byFields(addressPointerOf(address)?.kind ?? NaN))
|
|
7806
7817
|
const rootFilters = [...groups.values()].map(({ pointer, addresses: group }) => ({
|
|
7807
7818
|
kinds: [pointer.kind],
|