@crossworks/client-types 0.232.333 → 0.232.335

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": "@crossworks/client-types",
3
- "version": "0.232.333",
3
+ "version": "0.232.335",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/dto/member.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import type { AccessLevel, MemberItemAuthor } from './access';
8
8
  import type { MemberItemKind } from '../member-kinds';
9
+ export type { MemberItemFilter } from '../member-kinds';
9
10
 
10
11
  /** GET /api/member/shell */
11
12
  export type MemberShell = {
@@ -109,6 +110,8 @@ export type MemberSpaceItemRow = {
109
110
  returnedNote: string | null;
110
111
  /** The login that wrote it (team drafts show whose it is). */
111
112
  authorLoginId: string | null;
113
+ /** Brains from the item-list alignment release on. */
114
+ createdAt?: string;
112
115
  updatedAt: string;
113
116
  };
114
117
 
@@ -247,3 +250,69 @@ export type MemberAcceptedItem =
247
250
  sizeBytes: number | null;
248
251
  changedByAdmin?: boolean;
249
252
  });
253
+
254
+ // ── One list of everything a member can see (item-list alignment) ───────
255
+
256
+ /** Where a row of the one list comes from; it picks the item view that
257
+ * opens it: `own` the member's editor, `team` a teammate's saved draft,
258
+ * `library` the brain item, `accepted` the version this member wrote and an
259
+ * admin accepted at a level above the Library's (admin or public). */
260
+ export type MemberItemSource = 'own' | 'team' | 'library' | 'accepted';
261
+
262
+ /** The small state pill a row wears beside its actions. Brain items (the
263
+ * Library and accepted rows) wear none. */
264
+ export type MemberItemPill = 'private' | 'draft' | 'submitted' | 'returned' | 'with-admin';
265
+
266
+ /** One row of GET /api/member/items. */
267
+ export type MemberItemRow = {
268
+ id: string;
269
+ type: MemberItemKind;
270
+ title: string;
271
+ icon: string | null;
272
+ summary: string | null;
273
+ updatedAt: string;
274
+ source: MemberItemSource;
275
+ pill: MemberItemPill | null;
276
+ /** The brain item's level (library and accepted rows); null on a draft. */
277
+ audience: AccessLevel | null;
278
+ /** A brain item a member wrote and an admin accepted: whose it is. */
279
+ author: MemberItemAuthor | null;
280
+ /** This member wrote it and an admin accepted it. */
281
+ byMe: boolean;
282
+ /** The personal-space row (own and team rows): sharing, review state, the
283
+ * returned note, for the item view and the detail header. */
284
+ space: MemberSpaceItemRow | null;
285
+ };
286
+
287
+ /**
288
+ * GET /api/member/items?kind=&q=&state=&page= (brains from the item-list
289
+ * alignment release): the member's own items, teammates' shared drafts, the
290
+ * Library and their accepted items above it, in ONE list, newest first.
291
+ * `state` is a MemberItemFilter (default `all`). Absent on older brains: the
292
+ * client then falls back to the four source lists.
293
+ */
294
+ export type MemberItemsPage = {
295
+ items: MemberItemRow[];
296
+ total: number;
297
+ page: number;
298
+ pageSize: number;
299
+ };
300
+
301
+ /**
302
+ * The calling admin's own private item as a row of a BRAIN list (item-list
303
+ * alignment): /api/pages, /api/notes, /api/tables, /api/draws and the files
304
+ * root and Recent lists, with `?state=all` or `?state=private`. The
305
+ * `private` key marks it (brain rows never carry it) and holds the space
306
+ * row the item view opens; the item itself is read and written through
307
+ * /api/admin/space. Private items have no tags and no parent: a tag filter
308
+ * or a sub-page level lists none.
309
+ */
310
+ export type AdminPrivateListRow = {
311
+ id: string;
312
+ type: MemberItemKind;
313
+ title: string;
314
+ icon: string | null;
315
+ createdAt: string;
316
+ updatedAt: string;
317
+ private: AdminSpaceItemRow;
318
+ };
package/src/index.ts CHANGED
@@ -58,6 +58,7 @@ export type {
58
58
  ReviewAuthorView,
59
59
  } from './dto/review';
60
60
  export type {
61
+ AdminPrivateListRow,
61
62
  AdminSpaceItem,
62
63
  AdminSpaceItemRow,
63
64
  AdminSpaceList,
@@ -70,6 +71,11 @@ export type {
70
71
  MemberAcceptedRow,
71
72
  MemberChatMessage,
72
73
  MemberChatThread,
74
+ MemberItemFilter,
75
+ MemberItemPill,
76
+ MemberItemRow,
77
+ MemberItemSource,
78
+ MemberItemsPage,
73
79
  MemberLibraryItem,
74
80
  MemberLibraryKind,
75
81
  MemberLibraryPage,
@@ -10,3 +10,37 @@ export type MemberItemKind = (typeof MEMBER_ITEM_KINDS)[number];
10
10
  export function isMemberItemKind(v: unknown): v is MemberItemKind {
11
11
  return typeof v === 'string' && (MEMBER_ITEM_KINDS as readonly string[]).includes(v);
12
12
  }
13
+
14
+ /** The State filter of a member's one list (GET /api/member/items?state=):
15
+ * `all`, one row pill, `brain` (the rows without a pill), or `by-me` (what
16
+ * this member wrote and an admin accepted, at any level). A runtime constant
17
+ * for the same reason as the kinds: the brain parses it, the client offers
18
+ * it. */
19
+ export const MEMBER_ITEM_FILTERS = [
20
+ 'all',
21
+ 'private',
22
+ 'draft',
23
+ 'submitted',
24
+ 'returned',
25
+ 'with-admin',
26
+ 'brain',
27
+ 'by-me',
28
+ ] as const;
29
+ export type MemberItemFilter = (typeof MEMBER_ITEM_FILTERS)[number];
30
+
31
+ export function isMemberItemFilter(v: unknown): v is MemberItemFilter {
32
+ return typeof v === 'string' && (MEMBER_ITEM_FILTERS as readonly string[]).includes(v);
33
+ }
34
+
35
+ /** Which items an ADMIN's brain list holds (`?state=` on /api/pages, /notes,
36
+ * /tables, /draws and the files lists): `brain` (the default, as before),
37
+ * `private` (the admin's own private items only) or `all` (both, merged in
38
+ * the list's own order). */
39
+ export const ADMIN_LIST_STATES = ['brain', 'private', 'all'] as const;
40
+ export type AdminListState = (typeof ADMIN_LIST_STATES)[number];
41
+
42
+ export function adminListStateOf(v: unknown): AdminListState {
43
+ return typeof v === 'string' && (ADMIN_LIST_STATES as readonly string[]).includes(v)
44
+ ? (v as AdminListState)
45
+ : 'brain';
46
+ }