@estiva-app/interop 0.31.0 → 0.33.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 +36 -0
- package/README.md +35 -4
- package/dist/folders.d.ts +130 -0
- package/dist/folders.d.ts.map +1 -0
- package/dist/folders.js +128 -0
- package/dist/folders.js.map +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/projection.d.ts +28 -0
- package/dist/projection.d.ts.map +1 -1
- package/dist/projection.js +20 -0
- package/dist/projection.js.map +1 -1
- package/package.json +3 -3
- package/src/folders.ts +167 -0
- package/src/index.ts +17 -0
- package/src/projection.ts +33 -0
package/src/projection.ts
CHANGED
|
@@ -4100,6 +4100,37 @@ export interface FolderSummary {
|
|
|
4100
4100
|
* `listFolders` already holds every state, so the answer is free.
|
|
4101
4101
|
*/
|
|
4102
4102
|
listedIn?: string[]
|
|
4103
|
+
/**
|
|
4104
|
+
* The addresses this folder's state lists, in the state's order — present
|
|
4105
|
+
* only when there are any.
|
|
4106
|
+
*
|
|
4107
|
+
* `listedIn` in the other direction, and free for the same reason: the
|
|
4108
|
+
* states are already in hand. It is the unresolved list — a row that names
|
|
4109
|
+
* an archived or unreachable record is still here — so a consumer that
|
|
4110
|
+
* draws one app's own records under a folder (Ship's projects under a team,
|
|
4111
|
+
* FOL-5) intersects it with the records it holds, and a consumer that draws
|
|
4112
|
+
* another app's files resolves them with {@link resolveFolderContents}.
|
|
4113
|
+
*/
|
|
4114
|
+
addresses?: string[]
|
|
4115
|
+
}
|
|
4116
|
+
|
|
4117
|
+
/**
|
|
4118
|
+
* The folders a person navigates by: the ones with state that no other folder
|
|
4119
|
+
* lists (FOL-5).
|
|
4120
|
+
*
|
|
4121
|
+
* Most channels a relay answers with are nobody's folder — an app's record
|
|
4122
|
+
* channels, the channel a record's conversation lives in, a test topic — and
|
|
4123
|
+
* each is reached through the object it belongs to. Two facts the summary
|
|
4124
|
+
* already carries decide it, with no further read: a `kind:30890` exists once
|
|
4125
|
+
* somebody has sent a folder command at the channel, which a record channel
|
|
4126
|
+
* never gets; and a folder another one lists (`listedIn`) is a row inside
|
|
4127
|
+
* that one, not a section beside it.
|
|
4128
|
+
*
|
|
4129
|
+
* Not a list of ids: a new team is a folder somebody creates, not a code
|
|
4130
|
+
* change. Moved here from Peek and Ship, which each held the same line.
|
|
4131
|
+
*/
|
|
4132
|
+
export function topLevelFolders<T extends Pick<FolderSummary, 'hasState' | 'listedIn'>>(folders: T[]): T[] {
|
|
4133
|
+
return folders.filter((folder) => folder.hasState && !folder.listedIn?.length)
|
|
4103
4134
|
}
|
|
4104
4135
|
|
|
4105
4136
|
/** A folder and everything in it, each file drawn through its owner's manifest. */
|
|
@@ -4156,10 +4187,12 @@ export async function listFolders(query: QueryFn): Promise<FolderSummary[]> {
|
|
|
4156
4187
|
const existing = byId.get(id)
|
|
4157
4188
|
// State wins over the channel for the name, whichever order they arrived.
|
|
4158
4189
|
if (existing && !state) continue
|
|
4190
|
+
const addresses = state ? event.tags.filter((tag) => tag[0] === 'a' && tag[1]).map((tag) => tag[1]) : []
|
|
4159
4191
|
byId.set(id, {
|
|
4160
4192
|
id,
|
|
4161
4193
|
name: tagValue(event, 'name') ?? existing?.name,
|
|
4162
4194
|
hasState: state || (existing?.hasState ?? false),
|
|
4195
|
+
...(addresses.length ? { addresses } : {}),
|
|
4163
4196
|
})
|
|
4164
4197
|
}
|
|
4165
4198
|
/*
|