@crossworks/client-types 0.232.338 → 0.232.342

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.338",
3
+ "version": "0.232.342",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/dto/client.ts CHANGED
@@ -5,7 +5,9 @@
5
5
  * client level only (the brain enforces it with row security). Client DTOs
6
6
  * never carry a staff name or an author: clients see the brand name.
7
7
  */
8
- import type { MemberItemKind } from '../member-kinds';
8
+ import type { ClientItemKind, MemberItemKind } from '../member-kinds';
9
+ import type { MemberItemPill, MemberSpaceItemRow } from './member';
10
+ import type { NodeComment } from './rows';
9
11
 
10
12
  /** GET /api/client/shell: who is signed in and the brain's brand. */
11
13
  export type ClientShell = {
@@ -265,3 +267,100 @@ export type ClientChatUsage = {
265
267
  limits: { dailyTurns: number; dailyTokens: number };
266
268
  rows: { loginId: string; turnsToday: number; tokensToday: number }[];
267
269
  };
270
+
271
+ // ── The client's own items, My requests (client logins C5) ─────────────────
272
+
273
+ /**
274
+ * Where a row of My requests comes from: `own` an item in the client's own
275
+ * space (GET /api/client/space/:id; a draft, submitted, returned, or with a
276
+ * reviewer who took it over), `accepted` the version the client wrote and an
277
+ * admin accepted (GET /api/client/accepted/:id).
278
+ */
279
+ export type ClientItemSource = 'own' | 'accepted';
280
+
281
+ /** One row of GET /api/client/items. No level, no staff name. */
282
+ export type ClientItemRow = {
283
+ id: string;
284
+ type: ClientItemKind;
285
+ title: string;
286
+ icon: string | null;
287
+ updatedAt: string;
288
+ source: ClientItemSource;
289
+ /** `private` a draft, `submitted`, `returned`, `with-admin`; null on an
290
+ * accepted row. Never `draft` (a client never shares with the team). */
291
+ pill: MemberItemPill | null;
292
+ /** The space row of an own item (review state, the returned note). */
293
+ space: MemberSpaceItemRow | null;
294
+ acceptedAt: string | null;
295
+ };
296
+
297
+ /** GET /api/client/items?kind=&q=&state=&page=: the client's own items and
298
+ * their accepted items in ONE list, newest first. `state` is a
299
+ * ClientItemFilter (default `all`). */
300
+ export type ClientItemsPage = {
301
+ items: ClientItemRow[];
302
+ total: number;
303
+ page: number;
304
+ pageSize: number;
305
+ };
306
+
307
+ /**
308
+ * The client's own space (/api/client/space*, /api/client/space-files): the
309
+ * member space routes' shapes (MemberSpaceItem, MemberSpaceItemRow,
310
+ * MemberSpaceList) for kinds page, note and file only. No share route: a
311
+ * client's item is private until submitted, and a submitted item goes to the
312
+ * reviewers (and members read it as a client request). Refusals (the 409
313
+ * `reason`): the member ones, plus `quota` for the client caps: 20 MB a file,
314
+ * 200 MB a client, 50 MB uploaded a day, 500 items, 10 submissions a day, 50
315
+ * waiting for review, and one total for all client uploads of the brain.
316
+ */
317
+ export type ClientSpaceRefusedReason =
318
+ | 'not-found'
319
+ | 'frozen'
320
+ | 'not-draft'
321
+ | 'not-submitted'
322
+ | 'unsaved-draft'
323
+ | 'quota'
324
+ | 'embed'
325
+ | 'not-shared'
326
+ | 'too-large'
327
+ | 'invalid'
328
+ | 'with-admin';
329
+
330
+ /** GET /api/client/accepted/:id -> { item }: the version the client wrote
331
+ * and an admin accepted (the snapshot taken at Accept, never the brain's
332
+ * current version). A file's bytes: /api/client/files/:id while the brain
333
+ * file still holds the bytes accepted (`changedByAdmin` otherwise). */
334
+ export type ClientAcceptedItem =
335
+ | (ClientAcceptedBase & { type: 'page'; doc: unknown })
336
+ | (ClientAcceptedBase & { type: 'note'; content: string })
337
+ | (ClientAcceptedBase & {
338
+ type: 'file';
339
+ filename: string;
340
+ mimeType: string | null;
341
+ sizeBytes: number | null;
342
+ changedByAdmin?: boolean;
343
+ });
344
+
345
+ export type ClientAcceptedBase = {
346
+ id: string;
347
+ title: string;
348
+ icon: string | null;
349
+ acceptedAt: string | null;
350
+ updatedAt: string;
351
+ };
352
+
353
+ // ── Comments (client logins C5, decision 8) ─────────────────────────────────
354
+
355
+ /**
356
+ * GET /api/client/shared/:id/comments (POST { body } -> 201 { comment },
357
+ * DELETE /comments/:commentId for the client's own): the thread on an item
358
+ * shared with clients. The team, admins and every client login read and
359
+ * write it; each comment shows its author's display name (clients are
360
+ * approved users). Only on an item at client level: any other id is a 404.
361
+ *
362
+ * GET /api/client/space/:id/comments (POST, DELETE own) on the client's own
363
+ * item: the review talk with the reviewers, open while it is submitted. A
364
+ * reviewer's comment shows the brand name, never a staff name.
365
+ */
366
+ export type ClientCommentThread = { comments: NodeComment[] };
package/src/dto/member.ts CHANGED
@@ -256,8 +256,11 @@ export type MemberAcceptedItem =
256
256
  /** Where a row of the one list comes from; it picks the item view that
257
257
  * opens it: `own` the member's editor, `team` a teammate's saved draft,
258
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';
259
+ * admin accepted at a level above the Library's (admin or public),
260
+ * `client-request` a client's SUBMITTED item (client logins C5, decision
261
+ * 5 B), read only from /api/member/client-requests/:id; its `space` row
262
+ * carries the review state, its `author` the client (role `client`). */
263
+ export type MemberItemSource = 'own' | 'team' | 'library' | 'accepted' | 'client-request';
261
264
 
262
265
  /** The small state pill a row wears beside its actions. Brain items (the
263
266
  * Library and accepted rows) wear none. */
@@ -284,6 +287,14 @@ export type MemberItemRow = {
284
287
  space: MemberSpaceItemRow | null;
285
288
  };
286
289
 
290
+ /** GET /api/member/client-requests/:id (client logins C5, decision 5 B): a
291
+ * client's SUBMITTED item, read only, with its author (the client). File
292
+ * bytes: /api/member/client-requests/:id/bytes. */
293
+ export type MemberClientRequestItem<TDoc = unknown, TTable = unknown> = MemberSpaceItem<
294
+ TDoc,
295
+ TTable
296
+ > & { author: MemberItemAuthor };
297
+
287
298
  /**
288
299
  * GET /api/member/items?kind=&q=&state=&page= (brains from the item-list
289
300
  * alignment release): the member's own items, teammates' shared drafts, the
package/src/dto/rows.ts CHANGED
@@ -50,7 +50,7 @@ export type TaskTodo = {
50
50
  };
51
51
 
52
52
  /** Mirrors @mantle/db `NodeCommentAuthorKind`. */
53
- export type NodeCommentAuthorKind = 'owner' | 'member' | 'agent';
53
+ export type NodeCommentAuthorKind = 'owner' | 'member' | 'agent' | 'client';
54
54
 
55
55
  /**
56
56
  * A comment on a node (tasks first; the table is node-generic). `authorName`
package/src/index.ts CHANGED
@@ -86,6 +86,7 @@ export type {
86
86
  MemberSpaceItem,
87
87
  MemberSpaceItemBody,
88
88
  MemberSpaceItemRow,
89
+ MemberClientRequestItem,
89
90
  MemberSpaceItemState,
90
91
  MemberSpaceList,
91
92
  MemberSpaceSharing,
@@ -109,7 +110,7 @@ export type {
109
110
  MemberInviteRow,
110
111
  MemberInviteState,
111
112
  } from './dto/member-invites';
112
- export type { MemberItemKind } from './member-kinds';
113
+ export type { MemberItemKind, ClientItemKind, ClientItemFilter } from './member-kinds';
113
114
  export type {
114
115
  LoginKind,
115
116
  LoginRefused,
@@ -143,6 +144,13 @@ export type {
143
144
  ClientShell,
144
145
  ClientSigninLinkCreated,
145
146
  ClientSigninLinkRow,
147
+ ClientItemSource,
148
+ ClientItemRow,
149
+ ClientItemsPage,
150
+ ClientSpaceRefusedReason,
151
+ ClientAcceptedItem,
152
+ ClientAcceptedBase,
153
+ ClientCommentThread,
146
154
  } from './dto/client';
147
155
 
148
156
  // Types only at the root; the runtime constants (APP_TINTS, limits) are the
@@ -25,6 +25,8 @@ export const MEMBER_ITEM_FILTERS = [
25
25
  'with-admin',
26
26
  'brain',
27
27
  'by-me',
28
+ // A client's submitted items (client logins C5, decision 5 B): read only.
29
+ 'client-requests',
28
30
  ] as const;
29
31
  export type MemberItemFilter = (typeof MEMBER_ITEM_FILTERS)[number];
30
32
 
@@ -44,3 +46,30 @@ export function adminListStateOf(v: unknown): AdminListState {
44
46
  ? (v as AdminListState)
45
47
  : 'brain';
46
48
  }
49
+
50
+ /** The kinds a CLIENT works with in their own space (client logins C5, plan
51
+ * section 6): pages and notes they write, files they upload. */
52
+ export const CLIENT_ITEM_KINDS = ['page', 'note', 'file'] as const;
53
+ export type ClientItemKind = (typeof CLIENT_ITEM_KINDS)[number];
54
+
55
+ export function isClientItemKind(v: unknown): v is ClientItemKind {
56
+ return typeof v === 'string' && (CLIENT_ITEM_KINDS as readonly string[]).includes(v);
57
+ }
58
+
59
+ /** The State filter of a client's one list, My requests (GET
60
+ * /api/client/items?state=): `all`, one row pill (`private` a draft,
61
+ * `submitted`, `returned`, `with-admin` an item a reviewer took over to
62
+ * work on), or `accepted`. */
63
+ export const CLIENT_ITEM_FILTERS = [
64
+ 'all',
65
+ 'private',
66
+ 'submitted',
67
+ 'returned',
68
+ 'with-admin',
69
+ 'accepted',
70
+ ] as const;
71
+ export type ClientItemFilter = (typeof CLIENT_ITEM_FILTERS)[number];
72
+
73
+ export function isClientItemFilter(v: unknown): v is ClientItemFilter {
74
+ return typeof v === 'string' && (CLIENT_ITEM_FILTERS as readonly string[]).includes(v);
75
+ }