@crossworks/client-types 0.300.55 → 0.300.58
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 +1 -1
- package/src/dto/views.ts +6 -0
- package/src/dto/workspace-hits.ts +60 -0
- package/src/index.ts +9 -0
- package/src/tree.ts +26 -2
package/package.json
CHANGED
package/src/dto/views.ts
CHANGED
|
@@ -646,6 +646,12 @@ export type SystemHealth = {
|
|
|
646
646
|
connections: number | null;
|
|
647
647
|
cacheHitPct: number | null;
|
|
648
648
|
topTables: { name: string; bytes: number }[];
|
|
649
|
+
/** Who the app's system pool logs in as (workspaces arch A9):
|
|
650
|
+
* 'runtime' = mantle_runtime, not a superuser and owning no table (a
|
|
651
|
+
* box after its roll, MANTLE_DB_RUNTIME_ROLE=1); 'superuser' = the
|
|
652
|
+
* migrator's superuser (before the roll); 'other' = anything else.
|
|
653
|
+
* Absent from a server before A9. */
|
|
654
|
+
role?: { mode: 'runtime' | 'superuser' | 'other'; user: string } | null;
|
|
649
655
|
};
|
|
650
656
|
storage: {
|
|
651
657
|
/** The object store answered (any S3 backend). */
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search across workspaces (task f26a516e). A search (GET /api/search, and
|
|
3
|
+
* GET /api/tree/:kind/search asked with `across=1`) looks in every
|
|
4
|
+
* workspace the caller reads, not only the one picked in the switcher. The
|
|
5
|
+
* database's row rules decide what the caller reads; the switcher's
|
|
6
|
+
* workspace (`ws`) only orders the hits: its own come first. Each hit names
|
|
7
|
+
* the workspace it opens in, so a client tags a hit from another workspace
|
|
8
|
+
* and switches there before it opens it.
|
|
9
|
+
*
|
|
10
|
+
* Every field here is optional on the wire: a brain before it sends none,
|
|
11
|
+
* and a client then shows no tag and does not switch.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** The workspace a hit opens in: a live workspace the caller is a user of
|
|
15
|
+
* that reads the item. The switcher's workspace when it reads the item,
|
|
16
|
+
* else the item's home when the caller is a user of it, else the first by
|
|
17
|
+
* name. Absent when the caller is in no such workspace (a read on the
|
|
18
|
+
* system pool, a brain not on workspaces). */
|
|
19
|
+
export type HitWorkspace = { id: string; name: string };
|
|
20
|
+
|
|
21
|
+
/** What a search hit carries beside its own fields. */
|
|
22
|
+
export type HitWorkspaceField = { workspace?: HitWorkspace };
|
|
23
|
+
|
|
24
|
+
/** Items of one folder that another workspace of the caller reads (GET
|
|
25
|
+
* /api/tree/:kind asked with `ws`, `elsewhere`): `count` items there, none
|
|
26
|
+
* of them read by the switcher's workspace. */
|
|
27
|
+
export type ElsewhereCount = { id: string; name: string; count: number };
|
|
28
|
+
|
|
29
|
+
/** One row of GET /api/search (nodes mode). */
|
|
30
|
+
export type SearchNodeHit = HitWorkspaceField & {
|
|
31
|
+
id: string;
|
|
32
|
+
type: string;
|
|
33
|
+
title: string | null;
|
|
34
|
+
path: string | null;
|
|
35
|
+
tags: string[];
|
|
36
|
+
summary: string | null;
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
url: string;
|
|
39
|
+
supersededBy?: { id: string; title: string | null; url: string };
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** One row of GET /api/search?mode=chunks (passages). */
|
|
43
|
+
export type SearchChunkHit = HitWorkspaceField & {
|
|
44
|
+
nodeId: string;
|
|
45
|
+
nodeTitle: string | null;
|
|
46
|
+
nodeType: string;
|
|
47
|
+
ordinal: number;
|
|
48
|
+
heading: string | null;
|
|
49
|
+
text: string;
|
|
50
|
+
url: string;
|
|
51
|
+
supersededBy?: { id: string; title: string | null; url: string };
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** GET /api/search?q=&mode=&ws=. `ws` (the switcher's workspace) never
|
|
55
|
+
* narrows a search: the hits that workspace reads come first, and it is
|
|
56
|
+
* echoed back. A workspace the caller may not name answers 404
|
|
57
|
+
* `{ error, code: 'not_found' }`, as the lists do. */
|
|
58
|
+
export type SearchApiResponse =
|
|
59
|
+
| { mode: 'nodes'; results: SearchNodeHit[]; ws?: string }
|
|
60
|
+
| { mode: 'chunks'; results: SearchChunkHit[]; ws?: string };
|
package/src/index.ts
CHANGED
|
@@ -239,3 +239,12 @@ export type {
|
|
|
239
239
|
ListWorkspace,
|
|
240
240
|
ListWsEcho,
|
|
241
241
|
} from './dto/grants';
|
|
242
|
+
// Search across workspaces (task f26a516e).
|
|
243
|
+
export type {
|
|
244
|
+
ElsewhereCount,
|
|
245
|
+
HitWorkspace,
|
|
246
|
+
HitWorkspaceField,
|
|
247
|
+
SearchApiResponse,
|
|
248
|
+
SearchChunkHit,
|
|
249
|
+
SearchNodeHit,
|
|
250
|
+
} from './dto/workspace-hits';
|
package/src/tree.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import type { AccessLevel } from './dto/access';
|
|
15
15
|
import type { GrantWorkspaceRef, ListWorkspace } from './dto/grants';
|
|
16
16
|
import type { TaskStatus } from './dto/rows';
|
|
17
|
+
import type { ElsewhereCount, HitWorkspaceField } from './dto/workspace-hits';
|
|
17
18
|
import type { AppTint } from './app-nav';
|
|
18
19
|
import {
|
|
19
20
|
ITEM_KINDS,
|
|
@@ -115,6 +116,12 @@ export type TreeFolder = {
|
|
|
115
116
|
system: boolean;
|
|
116
117
|
folderCount: number;
|
|
117
118
|
itemCount: number;
|
|
119
|
+
/** Asked with `?ws=<id>` (task f26a516e): the items in the folder that
|
|
120
|
+
* the caller reads in its other workspaces and `ws` does not read. They
|
|
121
|
+
* are not in `itemCount`; a client may still open the folder to say
|
|
122
|
+
* where they are (TreeFolderPage `elsewhere`). Absent without `ws`, and
|
|
123
|
+
* from a brain before it. */
|
|
124
|
+
itemsElsewhere?: number;
|
|
118
125
|
/** The workspaces that read the folder (ListChips): filled by the owner's
|
|
119
126
|
* tree routes; empty in the member tree until W5c. */
|
|
120
127
|
workspaces: ListWorkspace[];
|
|
@@ -193,6 +200,12 @@ export type TreeFolderPage = {
|
|
|
193
200
|
/** Asked with `?ws=<id>` (ListWsEcho): the items are only those that
|
|
194
201
|
* workspace reads; the folders stay (the way to them). */
|
|
195
202
|
ws?: string;
|
|
203
|
+
/** Asked with `?ws=<id>`, on the first page of a folder where `ws` reads
|
|
204
|
+
* no item (task f26a516e): the caller's other workspaces that read items
|
|
205
|
+
* in this same folder, with how many, most first. Only workspaces the
|
|
206
|
+
* caller is a user of, and only items its scope reads. Absent when there
|
|
207
|
+
* are none, and from a brain before it. */
|
|
208
|
+
elsewhere?: ElsewhereCount[];
|
|
196
209
|
};
|
|
197
210
|
|
|
198
211
|
/** Narrowing for GET /api/tree/:kind/search (`ws=`, `tag=`), the tree's
|
|
@@ -200,8 +213,15 @@ export type TreeFolderPage = {
|
|
|
200
213
|
* lists items only, no folders. The level filter went with the levels
|
|
201
214
|
* (W5b2). */
|
|
202
215
|
export type TreeFilter = {
|
|
203
|
-
/** Only items this workspace reads (its id is in their read_ws).
|
|
216
|
+
/** Only items this workspace reads (its id is in their read_ws). With
|
|
217
|
+
* `across`, the switcher's workspace instead: its items come first. */
|
|
204
218
|
ws?: string;
|
|
219
|
+
/** `across=1` (task f26a516e): a search with a term looks in every
|
|
220
|
+
* workspace the caller reads; `ws` then orders the items (its own
|
|
221
|
+
* first) and narrows nothing, and the folders that match come too. Each
|
|
222
|
+
* item names the workspace it opens in (`workspace`). An empty term (the
|
|
223
|
+
* A to Z view) ignores it. */
|
|
224
|
+
across?: boolean;
|
|
205
225
|
/** Only items carrying this tag. */
|
|
206
226
|
tag?: string;
|
|
207
227
|
};
|
|
@@ -217,10 +237,14 @@ export const TREE_TAGS_LIST_MAX = 40;
|
|
|
217
237
|
export type TreeSearchResult = {
|
|
218
238
|
kind: TreeKind;
|
|
219
239
|
folders: Array<TreeFolder & { crumbs: TreeCrumb[] }>;
|
|
220
|
-
|
|
240
|
+
/** `workspace`: asked `across`, where the item opens (HitWorkspace). */
|
|
241
|
+
items: Array<TreeItem & { crumbs: TreeCrumb[] } & HitWorkspaceField>;
|
|
221
242
|
nextCursor: string | null;
|
|
222
243
|
/** Asked with `?ws=<id>` (ListWsEcho). */
|
|
223
244
|
ws?: string;
|
|
245
|
+
/** Asked `across` with a term: the search covered every workspace the
|
|
246
|
+
* caller reads. Absent from a brain before it (which narrowed by `ws`). */
|
|
247
|
+
across?: true;
|
|
224
248
|
};
|
|
225
249
|
|
|
226
250
|
/** The flat views beside the tree: this login's pins, recent and most used
|