@crossworks/client-types 0.500.40 → 0.500.43

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.500.40",
3
+ "version": "0.500.43",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/dto/auth.ts CHANGED
@@ -73,8 +73,10 @@ export type SsoSetupStatusDTO =
73
73
  /** Where the client secret comes from. */
74
74
  secret: 'env' | 'row' | 'none';
75
75
  /** Where the SCIM token's hash comes from. `env-off`: the .env holds a
76
- * value that turns SCIM off. */
77
- scim: 'env' | 'env-off' | 'row' | 'none';
76
+ * value that turns SCIM off. `not-cc`: this box is not a Control
77
+ * Center, so SCIM is off and the screen shows no SCIM step (scimUrl
78
+ * '' and scimSet null then). */
79
+ scim: 'env' | 'env-off' | 'row' | 'none' | 'not-cc';
78
80
  secretSet: SsoSetupSetter | null;
79
81
  scimSet: SsoSetupSetter | null;
80
82
  };
package/src/dto/grants.ts CHANGED
@@ -104,8 +104,9 @@ export type GrantsResponse = {
104
104
  * no longer reads the item after its own change. */
105
105
  export type GrantsWriteResponse = GrantsResponse | { visible: false };
106
106
 
107
- /** POST /api/grants/:nodeId: add a grant ("Add workspace"). A folder, or an
108
- * app gaining a holder, needs `confirm: true` (409 confirm_required). */
107
+ /** POST /api/grants/:nodeId: add a grant ("Add workspace"). A folder needs
108
+ * `confirm: true` (409 confirm_required); an app needs none, as a page
109
+ * (2026-11-09). */
109
110
  export type GrantAddBody = { wsId: string; write?: boolean; confirm?: boolean };
110
111
 
111
112
  /** PATCH /api/grants/:nodeId/:wsId: the Write switch. A folder needs
package/src/dto/rows.ts CHANGED
@@ -14,6 +14,7 @@ import type { AppNav, AppOpenStat, AppTint } from '../app-nav';
14
14
  import type { HistoryActor } from '../role-names';
15
15
  import type { ListChips, ListWorkspace } from './grants';
16
16
  import type { StoredUpdateNotice } from './update-notice';
17
+ import type { TaskSubmission } from '../task-submissions';
17
18
 
18
19
  // ── Row/DTO shapes moved from the server packages (jackdaw split P0) ─────────
19
20
  // Sources: @mantle/content, @mantle/email, @mantle/microsoft, @mantle/runtime/agent
@@ -45,10 +46,29 @@ export type TaskRow = {
45
46
  * know it (the reopen then lands on 'open') and on every task that is not
46
47
  * done. Optional: brains before this field do not send it. */
47
48
  statusBeforeDone?: TaskStatus | null;
49
+ /** The task's files. Sent by the one-task read (`GET /api/tasks/:id`,
50
+ * `task_get`) only, never by a list. Absent on brains before task files. */
51
+ files?: TaskFile[];
52
+ /** A bug, feature or request sent to the Admins or the Control Center
53
+ * (the person's own task), or the copy that arrived (plan 5559936a).
54
+ * Absent on a task that is neither, and on brains before submissions. */
55
+ submission?: TaskSubmission;
48
56
  createdAt: string;
49
57
  updatedAt: string;
50
58
  };
51
59
 
60
+ /** One file on a task (a screenshot, a log, a PDF). A normal file node in
61
+ * the task's own Auto-filed folder; who reads the task opens it, who edits
62
+ * the task adds or removes it. The bytes are at
63
+ * `GET /api/tasks/:id/files/:fileId` (`?thumb=1` for an image's thumbnail). */
64
+ export type TaskFile = {
65
+ id: string;
66
+ filename: string;
67
+ mimeType: string;
68
+ sizeBytes: number;
69
+ createdAt: string;
70
+ };
71
+
52
72
  /** One checklist item inside a task. Server assigns `id` on write. */
53
73
  export type TaskTodo = {
54
74
  id: string;
package/src/index.ts CHANGED
@@ -38,6 +38,8 @@ export * from './dto/services';
38
38
  export * from './dto/box-status';
39
39
  export * from './dto/update-notice';
40
40
  export * from './dto/present-checks';
41
+ export * from './task-files';
42
+ export * from './task-submissions';
41
43
  // Types only; ACCESS_LEVELS (runtime) is the `@mantle/client-types/dto/access` subpath.
42
44
  export type {
43
45
  AccessItemView,
@@ -0,0 +1,18 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { isTaskFileType, taskFileExt, TASK_FILE_EXTS } from './task-files';
3
+
4
+ describe('task file types', () => {
5
+ it('takes images, PDF, text and logs, by extension, in any case', () => {
6
+ for (const name of ['a.png', 'b.JPG', 'c.jpeg', 'd.gif', 'e.webp', 'f.pdf', 'g.log']) {
7
+ expect(isTaskFileType(name)).toBe(true);
8
+ }
9
+ expect(TASK_FILE_EXTS).toContain('csv');
10
+ });
11
+
12
+ it('refuses svg, html, a name with no extension and a dot file', () => {
13
+ for (const name of ['x.svg', 'x.html', 'x.htm', 'noext', '.png', 'x.png.exe']) {
14
+ expect(isTaskFileType(name)).toBe(false);
15
+ }
16
+ expect(taskFileExt('Shot.PNG')).toBe('png');
17
+ });
18
+ });
@@ -0,0 +1,36 @@
1
+ /**
2
+ * A task file's caps and types (files on tasks, 2026-11-09). The server
3
+ * holds them (packages/content/src/task-files.ts); the client reads them to
4
+ * say no before an upload. Pure: no imports, so a browser bundle takes it.
5
+ */
6
+
7
+ /** 10 MB per file. */
8
+ export const TASK_FILE_MAX_BYTES = 10 * 1024 * 1024;
9
+ /** 5 files per task. */
10
+ export const TASK_FILES_MAX = 5;
11
+ /** Extensions a task file may have: images, PDF, text and logs. No svg or
12
+ * html: they can carry script. */
13
+ export const TASK_FILE_EXTS = [
14
+ 'png',
15
+ 'jpg',
16
+ 'jpeg',
17
+ 'gif',
18
+ 'webp',
19
+ 'pdf',
20
+ 'txt',
21
+ 'log',
22
+ 'md',
23
+ 'json',
24
+ 'csv',
25
+ ] as const;
26
+
27
+ /** The lower-case extension of `filename`, or '' when it has none. */
28
+ export function taskFileExt(filename: string): string {
29
+ const dot = filename.lastIndexOf('.');
30
+ return dot > 0 ? filename.slice(dot + 1).toLowerCase() : '';
31
+ }
32
+
33
+ /** May a file of this name be put on a task? */
34
+ export function isTaskFileType(filename: string): boolean {
35
+ return (TASK_FILE_EXTS as readonly string[]).includes(taskFileExt(filename));
36
+ }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Submit a bug, a feature or a request (plan page 5559936a, task
3
+ * f0c65930). A person sends one of their own tasks to the box's Admins
4
+ * (`admin`), or to the Control Center (`it`) when the box has one. The
5
+ * server keeps the block in the task's data (`data.submission`); only the
6
+ * system writes it. Pure: no imports, so a browser bundle takes it.
7
+ */
8
+
9
+ /** What a submission is. */
10
+ export const SUBMISSION_KINDS = ['bug', 'feature', 'request'] as const;
11
+ export type SubmissionKind = (typeof SUBMISSION_KINDS)[number];
12
+
13
+ /** Where a submission goes: this box's Admin workspace, or the Control
14
+ * Center (only on a box linked to one). */
15
+ export const SUBMIT_TARGETS = ['admin', 'it'] as const;
16
+ export type SubmitTarget = (typeof SUBMIT_TARGETS)[number];
17
+
18
+ /** The longest reply note. */
19
+ export const SUBMISSION_NOTE_MAX = 2000;
20
+ /** The longest version text on a reply. */
21
+ export const SUBMISSION_VERSION_MAX = 40;
22
+
23
+ /** The answer to a submission: written once, by who replies on the copy. */
24
+ export type SubmissionReply = {
25
+ status: 'done';
26
+ note: string;
27
+ /** The version the fix shipped in (the reply form fills in the running
28
+ * version of the box where the reply is made). */
29
+ version: string;
30
+ /** Who replied: a display name, never an id of another box. */
31
+ by: string;
32
+ at: string;
33
+ };
34
+
35
+ /** Who sent it, as the receiving side shows it. */
36
+ export type SubmissionSender = { name: string; email: string };
37
+
38
+ /**
39
+ * `data.submission` of a task, in one of two shapes:
40
+ * - `sent`: the person's own task. `copyId` is the Admin copy on this box
41
+ * (to `admin`); `collectedAt` is when the Control Center took it (to `it`).
42
+ * - `received`: the copy where it was sent (this box's Admin workspace, or
43
+ * the Control Center's). `from.box` is null for a copy on the same box.
44
+ */
45
+ export type TaskSubmission =
46
+ | {
47
+ side: 'sent';
48
+ kind: SubmissionKind;
49
+ to: SubmitTarget;
50
+ sentAt: string;
51
+ copyId?: string;
52
+ collectedAt?: string;
53
+ reply?: SubmissionReply;
54
+ }
55
+ | {
56
+ side: 'received';
57
+ kind: SubmissionKind;
58
+ from: { box: { id: string; name: string } | null; taskId: string; by: SubmissionSender };
59
+ receivedAt: string;
60
+ reply?: SubmissionReply;
61
+ /** On the Control Center: when the reply reached the box. */
62
+ replySentAt?: string;
63
+ };
64
+
65
+ /** One button the submit form shows (`GET /api/tasks/submit`). */
66
+ export type SubmitButton = { to: SubmitTarget; label: string };
67
+
68
+ /** Is `v` a submission kind? */
69
+ export function isSubmissionKind(v: unknown): v is SubmissionKind {
70
+ return typeof v === 'string' && (SUBMISSION_KINDS as readonly string[]).includes(v);
71
+ }