@crossworks/client-types 0.239.89 → 0.239.90
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/grants.ts +210 -0
- package/src/dto/member-mcp.ts +3 -4
- package/src/dto/rows.ts +36 -9
- package/src/dto/workspaces.ts +3 -6
- package/src/index.ts +24 -0
- package/src/tree.ts +58 -27
package/package.json
CHANGED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Grant Access panel on the wire (workspaces plan page 4887b8e7, phase
|
|
3
|
+
* W5b2): /api/grants. An item is shared by a grant to a workspace; each
|
|
4
|
+
* grant has its own Write switch. Every item has ONE home workspace (R1):
|
|
5
|
+
* only Moderators of the home manage the item's grants. Folders pass their
|
|
6
|
+
* grants to what is inside them (rows "via folder"); a row taken away from
|
|
7
|
+
* a folder-derived grant stays as "Removed here" until restored.
|
|
8
|
+
*
|
|
9
|
+
* Permissions are set in exactly two places: the workspace screen and this
|
|
10
|
+
* panel. Every refusal is `{ error, code }` with 400, 403, 404 or 409; an
|
|
11
|
+
* item or workspace the caller may not see answers 404, never 403.
|
|
12
|
+
*
|
|
13
|
+
* Pure: no imports.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** A workspace as the panel names it. */
|
|
17
|
+
export type GrantWorkspaceRef = { wsId: string; name: string };
|
|
18
|
+
|
|
19
|
+
/** One grant row of an item. */
|
|
20
|
+
export type GrantRow = {
|
|
21
|
+
wsId: string;
|
|
22
|
+
name: string;
|
|
23
|
+
/** Users of this workspace who are not its Moderators may edit the item. */
|
|
24
|
+
write: boolean;
|
|
25
|
+
/** The item's home: its Moderators manage the item. */
|
|
26
|
+
isHome: boolean;
|
|
27
|
+
/** The folder this row comes from ("via folder X", with "Change here");
|
|
28
|
+
* null for a grant set on the item. `title` is null when the caller
|
|
29
|
+
* cannot open that folder. */
|
|
30
|
+
viaFolder: { id: string; title: string | null } | null;
|
|
31
|
+
/** "Removed here": the folder grants this workspace, the item does not
|
|
32
|
+
* take it (with "Restore"). */
|
|
33
|
+
excluded: boolean;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** An embed of a page, drawing or note that is not granted to every
|
|
37
|
+
* workspace the item is ("Grant these too"). */
|
|
38
|
+
export type GrantEmbed = { nodeId: string; title: string; kind: string };
|
|
39
|
+
|
|
40
|
+
/** One item on a link's served list. `nodeId` lower-case; `title` null
|
|
41
|
+
* when the caller cannot read that item (or it is gone). */
|
|
42
|
+
export type GrantServedRef = { nodeId: string; title: string | null };
|
|
43
|
+
|
|
44
|
+
/** A contact the item is shared with (the same shape as the Access
|
|
45
|
+
* control's AccessContactShare). */
|
|
46
|
+
export type GrantContactShare = {
|
|
47
|
+
shareId: string;
|
|
48
|
+
contactId: string;
|
|
49
|
+
name: string;
|
|
50
|
+
canWrite: boolean;
|
|
51
|
+
sharingOn: boolean;
|
|
52
|
+
lastOpenedAt: string | null;
|
|
53
|
+
/** Server-relative: `/s/<token>`. */
|
|
54
|
+
path: string;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** GET /api/grants/:nodeId (an item or a folder). */
|
|
58
|
+
export type GrantsResponse = {
|
|
59
|
+
item: { id: string; title: string; type: string };
|
|
60
|
+
/** Both null when the caller is not a user of the home workspace (and
|
|
61
|
+
* not an Admin user): a home the caller may not name is not identified. */
|
|
62
|
+
home: { wsId: string | null; name: string | null };
|
|
63
|
+
/** The home first, then by name. Only rows of workspaces the caller is a
|
|
64
|
+
* user of, unless it is an Admin user or manages the item. */
|
|
65
|
+
rows: GrantRow[];
|
|
66
|
+
/** "Add workspace": live workspaces where the caller is a Moderator that
|
|
67
|
+
* the item is not granted to yet. Empty unless `mayManage`. */
|
|
68
|
+
addable: GrantWorkspaceRef[];
|
|
69
|
+
/** The caller moderates the item's home. */
|
|
70
|
+
mayManage: boolean;
|
|
71
|
+
/** The caller may open or close the item's public link: the item can
|
|
72
|
+
* carry one, and the caller may edit it (an app: home Moderator). */
|
|
73
|
+
mayLink: boolean;
|
|
74
|
+
/** A live open link exists (the "Public" pill). */
|
|
75
|
+
hasLink: boolean;
|
|
76
|
+
/** The open link, only when `mayLink`, with its served list (plan 8.1:
|
|
77
|
+
* the items the link shows besides its own, in the list's order). Changed
|
|
78
|
+
* by PATCH /api/shares/:id { serve }, which takes the ids. A new embed of
|
|
79
|
+
* an item that already has a link is NOT served until it is ticked
|
|
80
|
+
* (decision 12): it shows in `serveCandidates`, not here. */
|
|
81
|
+
link: { id: string; path: string; served: GrantServedRef[] } | null;
|
|
82
|
+
/** What the caller may put on the link's served list: the items this item
|
|
83
|
+
* names or embeds (a folder: the first 500 items under it that the
|
|
84
|
+
* caller may edit) that the caller may edit, by title; the ones already
|
|
85
|
+
* served among them. Empty unless `mayLink`. The same rule POST
|
|
86
|
+
* /api/shares and PATCH /api/shares/:id { serve } check. */
|
|
87
|
+
serveCandidates: GrantEmbed[];
|
|
88
|
+
/** The contacts it is shared with: only for an Admin user who `mayLink`,
|
|
89
|
+
* on a kind that takes contact shares; else null. */
|
|
90
|
+
contactShares: GrantContactShare[] | null;
|
|
91
|
+
/** Pages, drawings and notes: what they embed that is not granted to
|
|
92
|
+
* every workspace the item is (only embeds the caller may open). */
|
|
93
|
+
embedsNotGranted: GrantEmbed[];
|
|
94
|
+
/** Apps only. MCP access is written by PATCH /api/apps/:id. */
|
|
95
|
+
app?: { mcpAccess: boolean };
|
|
96
|
+
/** Folders, when the caller may add items there: every workspace a new
|
|
97
|
+
* item placed in it takes (its rows not removed there, the home's
|
|
98
|
+
* included), named even where the caller is not a user (S6). */
|
|
99
|
+
placesInto?: GrantWorkspaceRef[];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/** A write answers the panel again, or `{ visible: false }` when the caller
|
|
103
|
+
* no longer reads the item after its own change. */
|
|
104
|
+
export type GrantsWriteResponse = GrantsResponse | { visible: false };
|
|
105
|
+
|
|
106
|
+
/** POST /api/grants/:nodeId: add a grant ("Add workspace"). A folder, or an
|
|
107
|
+
* app gaining a holder, needs `confirm: true` (409 confirm_required). */
|
|
108
|
+
export type GrantAddBody = { wsId: string; write?: boolean; confirm?: boolean };
|
|
109
|
+
|
|
110
|
+
/** PATCH /api/grants/:nodeId/:wsId: the Write switch. A folder needs
|
|
111
|
+
* `confirm: true`. */
|
|
112
|
+
export type GrantPatchBody = { write: boolean; confirm?: boolean };
|
|
113
|
+
|
|
114
|
+
/** DELETE /api/grants/:nodeId/:wsId (a folder-derived row becomes "Removed
|
|
115
|
+
* here"), POST .../restore and POST .../hand ("Change here") take
|
|
116
|
+
* `?confirm=1` for a folder. */
|
|
117
|
+
|
|
118
|
+
/** POST /api/grants/:nodeId/embeds: grant the listed embeds to these
|
|
119
|
+
* workspaces (each must hold the item). */
|
|
120
|
+
export type GrantEmbedsBody = { wsIds: string[]; confirm?: boolean };
|
|
121
|
+
|
|
122
|
+
/** Pairs an embeds grant left out, and why. */
|
|
123
|
+
export type GrantEmbedSkip = { nodeId: string; wsId: string; code: GrantErrorCode };
|
|
124
|
+
|
|
125
|
+
export type GrantEmbedsResponse = GrantsWriteResponse & { skipped: GrantEmbedSkip[] };
|
|
126
|
+
|
|
127
|
+
/** GET /api/grants/:nodeId/preview?add=<ws>&remove=<ws>: how many items
|
|
128
|
+
* (the item, and for a folder everything inside it) would gain or lose
|
|
129
|
+
* that workspace. The caller must be allowed the change itself (add: home
|
|
130
|
+
* Moderator and Moderator of the target; remove: either), else 403.
|
|
131
|
+
* `tooBig` when a folder holds more than the limit (the change then
|
|
132
|
+
* answers 409 too_big). `app` for an app with `add`: what the new holder
|
|
133
|
+
* would see (rows null when the app has no database yet or it cannot be
|
|
134
|
+
* read). */
|
|
135
|
+
export type GrantPreviewResponse = {
|
|
136
|
+
gain: number;
|
|
137
|
+
/** Apps among `gain`: each also narrows what it reads (21.8 row 13). */
|
|
138
|
+
gainApps: number;
|
|
139
|
+
lose: number;
|
|
140
|
+
total: number;
|
|
141
|
+
/** Items in the folder the caller cannot open, counted in `total`,
|
|
142
|
+
* `gain` and `lose` all the same ("N items, some you cannot open"). */
|
|
143
|
+
hidden: number;
|
|
144
|
+
tooBig: boolean;
|
|
145
|
+
app?: { rows: number | null; exportedTables: number };
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/** POST /api/grants/move/preview and POST /api/grants/move: change the home
|
|
149
|
+
* (`toWorkspaceId`: Moderator of the old home and of the new one) or the
|
|
150
|
+
* folder (`toFolderId`, null = the kind's root: items only, of one tree
|
|
151
|
+
* kind). `keepReadableIn` (the old home only) keeps a read grant there. */
|
|
152
|
+
export type GrantMoveBody = {
|
|
153
|
+
nodeIds: string[];
|
|
154
|
+
toWorkspaceId?: string;
|
|
155
|
+
toFolderId?: string | null;
|
|
156
|
+
keepReadableIn?: string;
|
|
157
|
+
confirm?: boolean;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export type GrantMovePreviewResponse = {
|
|
161
|
+
alsoVisibleTo: GrantWorkspaceRef[];
|
|
162
|
+
removedFrom: GrantWorkspaceRef[];
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export type GrantMoveResponse = {
|
|
166
|
+
moved: number;
|
|
167
|
+
failed: Array<{ id: string; error: string }>;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/** Every `code` a /api/grants refusal carries. */
|
|
171
|
+
export type GrantErrorCode =
|
|
172
|
+
| 'invalid'
|
|
173
|
+
| 'not_migrated'
|
|
174
|
+
| 'not_found'
|
|
175
|
+
| 'forbidden'
|
|
176
|
+
| 'already_granted'
|
|
177
|
+
| 'not_granted'
|
|
178
|
+
| 'not_excluded'
|
|
179
|
+
| 'not_derived'
|
|
180
|
+
| 'derived_row'
|
|
181
|
+
| 'home_row'
|
|
182
|
+
| 'kind_not_allowed'
|
|
183
|
+
| 'confirm_required'
|
|
184
|
+
| 'too_big'
|
|
185
|
+
| 'same_home'
|
|
186
|
+
| 'mixed_kinds';
|
|
187
|
+
|
|
188
|
+
export type GrantError = { error: string; code: GrantErrorCode };
|
|
189
|
+
|
|
190
|
+
// ── Lists (W5b2 contract changes 5 and 14) ───────────────────────────────────
|
|
191
|
+
|
|
192
|
+
/** A workspace chip on a list row. */
|
|
193
|
+
export type ListWorkspace = { id: string; name: string };
|
|
194
|
+
|
|
195
|
+
/** What every row of GET /api/pages and /api/notes, and every item and
|
|
196
|
+
* folder of GET /api/tree/:kind (its search and marks too), carries. */
|
|
197
|
+
export type ListChips = {
|
|
198
|
+
/** The workspaces that read the item (its read_ws) and that the caller is
|
|
199
|
+
* a user of; all of them for an Admin user. Live workspaces only, by
|
|
200
|
+
* name. */
|
|
201
|
+
workspaces: ListWorkspace[];
|
|
202
|
+
/** A live open public link exists (the "Public" pill). */
|
|
203
|
+
hasLink: boolean;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/** A list asked with `?ws=<id>` keeps only the items that workspace reads
|
|
207
|
+
* and echoes the id as a top-level `ws` (absent when not asked). A
|
|
208
|
+
* workspace the caller is not a user of, unless an Admin user, answers 404
|
|
209
|
+
* `{ error, code: 'not_found' }`. */
|
|
210
|
+
export type ListWsEcho = { ws?: string };
|
package/src/dto/member-mcp.ts
CHANGED
|
@@ -27,8 +27,9 @@ export type MemberMcpView = {
|
|
|
27
27
|
access: { enabled: boolean; writeEnabled: boolean };
|
|
28
28
|
/** The clients this member connected, never another login's. */
|
|
29
29
|
clients: MemberMcpClient[];
|
|
30
|
-
/** The connectors (outside data sources)
|
|
31
|
-
* apps Phase 2): their MCP and their apps may use these
|
|
30
|
+
/** The connectors (outside data sources) the member's workspaces hold
|
|
31
|
+
* (team apps Phase 2; W5b2): their MCP and their apps may use these
|
|
32
|
+
* tools. Read
|
|
32
33
|
* tools carry the admin's read-only mark; write tools need Write on
|
|
33
34
|
* over MCP. Absent from a brain before Phase 2. */
|
|
34
35
|
connectors?: MemberMcpConnector[];
|
|
@@ -38,8 +39,6 @@ export type MemberMcpView = {
|
|
|
38
39
|
export type MemberMcpConnector = {
|
|
39
40
|
id: string;
|
|
40
41
|
name: string;
|
|
41
|
-
/** The connector's level: team, client or public. */
|
|
42
|
-
level: string;
|
|
43
42
|
readTools: number;
|
|
44
43
|
writeTools: number;
|
|
45
44
|
};
|
package/src/dto/rows.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import type { AppNav, AppOpenStat, AppTint } from '../app-nav';
|
|
14
14
|
import type { AccessLevel } from './access';
|
|
15
|
+
import type { ListChips, ListWorkspace } from './grants';
|
|
15
16
|
|
|
16
17
|
// ── Row/DTO shapes moved from the server packages (jackdaw split P0) ─────────
|
|
17
18
|
// Sources: @mantle/content, @mantle/email, @mantle/microsoft, @mantle/runtime/agent
|
|
@@ -155,6 +156,11 @@ export type PageListRow = PageRow & {
|
|
|
155
156
|
parentTitle: string | null;
|
|
156
157
|
};
|
|
157
158
|
|
|
159
|
+
/** A row of GET /api/pages (and of /api/notes, on its note row): the item
|
|
160
|
+
* with its workspace chips and link pill (W5b2 contract changes 5 and 14).
|
|
161
|
+
* The caller's own private rows carry them too, empty. */
|
|
162
|
+
export type PagesListRow = PageRow & ListChips;
|
|
163
|
+
|
|
158
164
|
export type AppRow = {
|
|
159
165
|
id: string;
|
|
160
166
|
title: string;
|
|
@@ -178,18 +184,21 @@ export type AppRow = {
|
|
|
178
184
|
shareMode: ShareMode | null;
|
|
179
185
|
/** Whether this app is the designated Team Hub (prefs.teamHubAppId). */
|
|
180
186
|
isHub: boolean;
|
|
181
|
-
/**
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
187
|
+
/** The old access level badge. Not sent since workspaces W5b2 (grants
|
|
188
|
+
* decide who reads an app: the list's `workspaces` chips and `hasLink`);
|
|
189
|
+
* the field goes in W8. */
|
|
190
|
+
audience?: AccessLevel;
|
|
191
|
+
/** Not sent since W5b2 (with the level badge). */
|
|
186
192
|
inherited?: 'team' | 'client' | null;
|
|
187
|
-
/**
|
|
188
|
-
* 0208), or null. Optional: absent from brains before it. */
|
|
193
|
+
/** Not sent since W5b2 (with the level badge). */
|
|
189
194
|
embedded?: 'team' | 'client' | null;
|
|
195
|
+
/** A live open public link exists (not revoked, not expired): the
|
|
196
|
+
* "Public" pill. Absent from a brain before W5b2. */
|
|
197
|
+
hasLink?: boolean;
|
|
190
198
|
/** Informational (client logins C6): members and clients only read the
|
|
191
|
-
* app's data
|
|
192
|
-
*
|
|
199
|
+
* app's data, whatever the grants' Write says. It changes no grant
|
|
200
|
+
* (contract change 36): off, a member writes where a workspace of
|
|
201
|
+
* theirs holds the app with Write on. Set with PATCH /api/apps/:id
|
|
193
202
|
* `{ dataReadOnly }`. Absent from an older brain: read as false. */
|
|
194
203
|
dataReadOnly?: boolean;
|
|
195
204
|
/** MCP access (team apps Phase 1, migration 0234): a member's or client's
|
|
@@ -215,6 +224,24 @@ export type AppRow = {
|
|
|
215
224
|
updatedAt: string;
|
|
216
225
|
};
|
|
217
226
|
|
|
227
|
+
/** A workspace as a list row's chip names it (the same as ListWorkspace). */
|
|
228
|
+
export type WorkspaceChip = ListWorkspace;
|
|
229
|
+
|
|
230
|
+
/** One row of GET /api/apps (workspaces W5b2): the chips every list row
|
|
231
|
+
* carries (ListChips, lib/list-workspaces.ts). */
|
|
232
|
+
export type AppListRow = AppRow & ListChips;
|
|
233
|
+
|
|
234
|
+
/** GET /api/apps?q=&tag=&sort=&page=&ws=. `ws` (a workspace id): only the
|
|
235
|
+
* apps that workspace holds, echoed back; a workspace the caller may not
|
|
236
|
+
* see answers 404 `{ error, code: 'not_found' }`. */
|
|
237
|
+
export type AppListResponse = {
|
|
238
|
+
apps: AppListRow[];
|
|
239
|
+
total: number;
|
|
240
|
+
page: number;
|
|
241
|
+
pageSize: number;
|
|
242
|
+
ws?: string;
|
|
243
|
+
};
|
|
244
|
+
|
|
218
245
|
export type AppDetail = AppRow & {
|
|
219
246
|
source: AppSource;
|
|
220
247
|
draft: AppSource | null;
|
package/src/dto/workspaces.ts
CHANGED
|
@@ -32,8 +32,8 @@ export type Workspace = {
|
|
|
32
32
|
/** The Admin workspace: its users manage the brain (requireArea). */
|
|
33
33
|
isAdmin: boolean;
|
|
34
34
|
/** Admin or Team, the built-in workspaces: they cannot be renamed or
|
|
35
|
-
* archived
|
|
36
|
-
*
|
|
35
|
+
* archived (hide Rename and Archive there). Their connectors are
|
|
36
|
+
* attached here like any workspace's since W5b2. */
|
|
37
37
|
builtIn: boolean;
|
|
38
38
|
/** Every Admin workspace user is a Moderator here (the Team workspace);
|
|
39
39
|
* only an Admin user may remove or demote one of them. */
|
|
@@ -82,9 +82,6 @@ export type WorkspaceResource = {
|
|
|
82
82
|
id: string;
|
|
83
83
|
name: string;
|
|
84
84
|
write: boolean;
|
|
85
|
-
/** Owned by a level bridge until W5b (the Admin and Team workspaces'
|
|
86
|
-
* connectors follow each connector's level): shown, not editable here. */
|
|
87
|
-
locked: boolean;
|
|
88
85
|
};
|
|
89
86
|
|
|
90
87
|
/** GET /api/workspaces/:id. */
|
|
@@ -164,7 +161,7 @@ export type WorkspaceErrorCode =
|
|
|
164
161
|
| 'reserved_name'
|
|
165
162
|
| 'archived'
|
|
166
163
|
| 'admin_workspace'
|
|
167
|
-
| '
|
|
164
|
+
| 'built_in'
|
|
168
165
|
| 'workspace_holds_items'
|
|
169
166
|
| 'already_user'
|
|
170
167
|
| 'not_user'
|
package/src/index.ts
CHANGED
|
@@ -216,6 +216,7 @@ export type {
|
|
|
216
216
|
TreeSort,
|
|
217
217
|
TreeVisibilityChange,
|
|
218
218
|
TreeVisibilityRefusal,
|
|
219
|
+
TreeWorkspaceChange,
|
|
219
220
|
} from './tree';
|
|
220
221
|
// Types only; WORKSPACE_AREAS (runtime) is the `@mantle/client-types/dto/workspaces` subpath.
|
|
221
222
|
export type {
|
|
@@ -242,3 +243,26 @@ export type {
|
|
|
242
243
|
WorkspaceUserSearchResponse,
|
|
243
244
|
WorkspaceUsersResponse,
|
|
244
245
|
} from './dto/workspaces';
|
|
246
|
+
export type {
|
|
247
|
+
GrantAddBody,
|
|
248
|
+
GrantContactShare,
|
|
249
|
+
GrantEmbed,
|
|
250
|
+
GrantEmbedSkip,
|
|
251
|
+
GrantEmbedsBody,
|
|
252
|
+
GrantEmbedsResponse,
|
|
253
|
+
GrantError,
|
|
254
|
+
GrantErrorCode,
|
|
255
|
+
GrantMoveBody,
|
|
256
|
+
GrantMovePreviewResponse,
|
|
257
|
+
GrantMoveResponse,
|
|
258
|
+
GrantPatchBody,
|
|
259
|
+
GrantPreviewResponse,
|
|
260
|
+
GrantRow,
|
|
261
|
+
GrantServedRef,
|
|
262
|
+
GrantWorkspaceRef,
|
|
263
|
+
GrantsResponse,
|
|
264
|
+
GrantsWriteResponse,
|
|
265
|
+
ListChips,
|
|
266
|
+
ListWorkspace,
|
|
267
|
+
ListWsEcho,
|
|
268
|
+
} from './dto/grants';
|
package/src/tree.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* `@mantle/client-types/tree` subpath.
|
|
13
13
|
*/
|
|
14
14
|
import type { AccessLevel } from './dto/access';
|
|
15
|
+
import type { GrantWorkspaceRef, ListWorkspace } from './dto/grants';
|
|
15
16
|
import type { TaskStatus } from './dto/rows';
|
|
16
17
|
import type { AppTint } from './app-nav';
|
|
17
18
|
|
|
@@ -188,14 +189,21 @@ export type TreeFolder = {
|
|
|
188
189
|
depth: number;
|
|
189
190
|
/** The parent folder; null at the top level. */
|
|
190
191
|
parentId: string | null;
|
|
191
|
-
/**
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
/** DEPRECATED (W5b2): folder shares are frozen and grants decide who
|
|
193
|
+
* reads (`workspaces`). The brain's tree no longer sends it; a member's
|
|
194
|
+
* own folder still sends null. */
|
|
195
|
+
share?: TreeShareLevel | null;
|
|
196
|
+
/** DEPRECATED (W5b2): no longer sent by the brain's tree. */
|
|
194
197
|
inherited?: TreeShareLevel | null;
|
|
195
198
|
/** Made by Mantle (Auto-filed): the name is locked and it cannot be shared. */
|
|
196
199
|
system: boolean;
|
|
197
200
|
folderCount: number;
|
|
198
201
|
itemCount: number;
|
|
202
|
+
/** The workspaces that read the folder (ListChips): filled by the owner's
|
|
203
|
+
* tree routes; empty in the member tree until W5c. */
|
|
204
|
+
workspaces: ListWorkspace[];
|
|
205
|
+
/** A live open public link exists. */
|
|
206
|
+
hasLink: boolean;
|
|
199
207
|
/** A member's tree only: the member's own private folder (folder plan
|
|
200
208
|
* phase 5). Only they see it; they may rename, move and delete it. */
|
|
201
209
|
own?: boolean;
|
|
@@ -229,19 +237,21 @@ export type TreeItem = {
|
|
|
229
237
|
/** A short kind-specific token for the status slot: a file's extension, a
|
|
230
238
|
* secret's kind, an event's start. Null when the kind has none. */
|
|
231
239
|
subtype: string | null;
|
|
232
|
-
/**
|
|
233
|
-
*
|
|
234
|
-
level
|
|
235
|
-
/**
|
|
236
|
-
* "Shared via" names); null = none. `level` already counts it. */
|
|
240
|
+
/** DEPRECATED (W5b2): the tier levels are frozen and grants decide who
|
|
241
|
+
* reads (`workspaces`, `hasLink`). The brain's tree no longer sends it. */
|
|
242
|
+
level?: AccessLevel;
|
|
243
|
+
/** DEPRECATED (W5b2): no longer sent. */
|
|
237
244
|
inherited?: TreeShareLevel | null;
|
|
238
|
-
/**
|
|
239
|
-
* note's image), kept by the brain; absent = none. `level` already
|
|
240
|
-
* counts it. */
|
|
245
|
+
/** DEPRECATED (W5b2): no longer sent. */
|
|
241
246
|
embedded?: TreeShareLevel | null;
|
|
242
247
|
state: TreeItemState | null;
|
|
243
248
|
updatedAt: string;
|
|
244
249
|
meta?: TreeItemMeta;
|
|
250
|
+
/** The workspaces that read the item (ListChips): filled by the owner's
|
|
251
|
+
* tree routes; empty in the member tree until W5c. */
|
|
252
|
+
workspaces: ListWorkspace[];
|
|
253
|
+
/** A live open public link exists (the "Public" pill). */
|
|
254
|
+
hasLink: boolean;
|
|
245
255
|
/** A member's tree only: a draft rather than a brain item (folder plan
|
|
246
256
|
* phase 5). `own` is the member's own; `team` a teammate's draft shared
|
|
247
257
|
* with the team. Absent on a brain item. */
|
|
@@ -264,14 +274,18 @@ export type TreeFolderPage = {
|
|
|
264
274
|
sort: TreeSort;
|
|
265
275
|
/** Pass back as `cursor` for the next page of items; null at the end. */
|
|
266
276
|
nextCursor: string | null;
|
|
277
|
+
/** Asked with `?ws=<id>` (ListWsEcho): the items are only those that
|
|
278
|
+
* workspace reads; the folders stay (the way to them). */
|
|
279
|
+
ws?: string;
|
|
267
280
|
};
|
|
268
281
|
|
|
269
|
-
/** Narrowing for GET /api/tree/:kind/search (`
|
|
282
|
+
/** Narrowing for GET /api/tree/:kind/search (`ws=`, `tag=`), the tree's
|
|
270
283
|
* filter menu. Both optional; together they both apply. A filtered search
|
|
271
|
-
* lists items only, no folders.
|
|
284
|
+
* lists items only, no folders. The level filter went with the levels
|
|
285
|
+
* (W5b2). */
|
|
272
286
|
export type TreeFilter = {
|
|
273
|
-
/** Only items
|
|
274
|
-
|
|
287
|
+
/** Only items this workspace reads (its id is in their read_ws). */
|
|
288
|
+
ws?: string;
|
|
275
289
|
/** Only items carrying this tag. */
|
|
276
290
|
tag?: string;
|
|
277
291
|
};
|
|
@@ -289,6 +303,8 @@ export type TreeSearchResult = {
|
|
|
289
303
|
folders: Array<TreeFolder & { crumbs: TreeCrumb[] }>;
|
|
290
304
|
items: Array<TreeItem & { crumbs: TreeCrumb[] }>;
|
|
291
305
|
nextCursor: string | null;
|
|
306
|
+
/** Asked with `?ws=<id>` (ListWsEcho). */
|
|
307
|
+
ws?: string;
|
|
292
308
|
};
|
|
293
309
|
|
|
294
310
|
/** The flat views beside the tree: this login's pins, recent and most used
|
|
@@ -303,8 +319,20 @@ export type TreeMarkList = {
|
|
|
303
319
|
items: Array<TreeItem & { crumbs: TreeCrumb[] }>;
|
|
304
320
|
};
|
|
305
321
|
|
|
306
|
-
/**
|
|
307
|
-
*
|
|
322
|
+
/** One item a tree write would change (W5b2: in workspaces, from the
|
|
323
|
+
* grants). A new item is compared with one at the kind's root (Admin). */
|
|
324
|
+
export type TreeWorkspaceChange = {
|
|
325
|
+
/** '' for an item not made yet (a create or upload). */
|
|
326
|
+
id: string;
|
|
327
|
+
title: string;
|
|
328
|
+
/** "This will also be visible to: ..." */
|
|
329
|
+
alsoVisibleTo: GrantWorkspaceRef[];
|
|
330
|
+
/** The workspaces that would no longer read it. */
|
|
331
|
+
removedFrom: GrantWorkspaceRef[];
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
/** A level change, as the member review's accept still lists it (until
|
|
335
|
+
* W5c). The tree's own refusal lists TreeWorkspaceChange. */
|
|
308
336
|
export type TreeVisibilityChange = {
|
|
309
337
|
id: string;
|
|
310
338
|
title: string;
|
|
@@ -315,20 +343,20 @@ export type TreeVisibilityChange = {
|
|
|
315
343
|
* opening is more than an image. Absent elsewhere. */
|
|
316
344
|
type?: string;
|
|
317
345
|
};
|
|
346
|
+
/** A tree write that would change which workspaces read something (a
|
|
347
|
+
* folder moved or deleted with its contents lifted, items moved, a file or
|
|
348
|
+
* page made in a folder, a copy) is refused with this (409) until it is
|
|
349
|
+
* repeated with `confirm: true`. A confirm's `seen` is `total`. */
|
|
318
350
|
export type TreeVisibilityRefusal = {
|
|
319
351
|
error: 'visibility';
|
|
320
352
|
/** The first changes (at most TREE_VISIBILITY_LIST_MAX). */
|
|
321
|
-
changes:
|
|
353
|
+
changes: TreeWorkspaceChange[];
|
|
322
354
|
/** How many items change in all. */
|
|
323
355
|
total: number;
|
|
324
|
-
/**
|
|
325
|
-
*
|
|
326
|
-
* readable through them, less open when an unshare or a move out takes
|
|
327
|
-
* that away (nothing's own level changes; migration 0208). Absent when
|
|
328
|
-
* there are none, and from brains before it was listed. */
|
|
356
|
+
/** @deprecated Never sent since W5b2: embeds no longer open with what
|
|
357
|
+
* embeds them (grants are never added for you). */
|
|
329
358
|
alsoEmbeds?: TreeVisibilityChange[];
|
|
330
|
-
/**
|
|
331
|
-
* TREE_VISIBILITY_LIST_MAX). A confirm's `seen` is `total` plus this. */
|
|
359
|
+
/** @deprecated Never sent since W5b2. */
|
|
332
360
|
embedsTotal?: number;
|
|
333
361
|
/** @deprecated Never sent: an unreleased first form of `alsoEmbeds`, when
|
|
334
362
|
* a share still lowered embeds for good. */
|
|
@@ -346,11 +374,14 @@ export const TREE_VISIBILITY_LIST_MAX = 100;
|
|
|
346
374
|
// where a folder's share covers the reader; counts are the reader's.
|
|
347
375
|
|
|
348
376
|
/** A folder as a client login's tree shows it. */
|
|
349
|
-
export type ClientTreeFolder = Omit<
|
|
377
|
+
export type ClientTreeFolder = Omit<
|
|
378
|
+
TreeFolder,
|
|
379
|
+
'share' | 'inherited' | 'system' | 'own' | 'workspaces' | 'hasLink'
|
|
380
|
+
>;
|
|
350
381
|
/** An item as a client login's tree shows it. */
|
|
351
382
|
export type ClientTreeItem = Omit<
|
|
352
383
|
TreeItem,
|
|
353
|
-
'level' | 'inherited' | 'embedded' | 'state' | 'source' | 'author'
|
|
384
|
+
'level' | 'inherited' | 'embedded' | 'state' | 'source' | 'author' | 'workspaces' | 'hasLink'
|
|
354
385
|
>;
|
|
355
386
|
|
|
356
387
|
export type ClientTreeFolderPage = Omit<TreeFolderPage, 'folder' | 'folders' | 'items'> & {
|