@crossworks/client-types 0.300.80 → 0.300.82
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/file-deletes.ts +77 -0
- package/src/dto/workspace-hits.ts +1 -1
- package/src/index.ts +9 -0
- package/src/role-names.test.ts +3 -5
package/package.json
CHANGED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A file delete's answers (F4 fix rounds 2 and 3; docs/actors.md, "F4 fix
|
|
3
|
+
* round 3", the bulk delete's contract): what jackdaw reads back from
|
|
4
|
+
* DELETE /api/files/files (bulk) and DELETE /api/files/files/:id?cascade=1.
|
|
5
|
+
*
|
|
6
|
+
* No name or id of an item the caller's scope does not read is ever in an
|
|
7
|
+
* answer: such an item is a count (`hiddenDrawings`, `kept`, `keptTotal`)
|
|
8
|
+
* or the `not_found` of an id no row has.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** What a file produced, by user-facing bucket (the has_derived preview and
|
|
12
|
+
* the confirmed cascade's reap). Counts every derived item, ones the
|
|
13
|
+
* caller does not read included. */
|
|
14
|
+
export type FileDerivedCounts = {
|
|
15
|
+
images: number;
|
|
16
|
+
tables: number;
|
|
17
|
+
pages: number;
|
|
18
|
+
notes: number;
|
|
19
|
+
other: number;
|
|
20
|
+
total: number;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Why one id of a bulk delete was not deleted:
|
|
25
|
+
* - `not_found`: no file has the id, or one the caller's scope does not
|
|
26
|
+
* read (one answer: the two are never told apart);
|
|
27
|
+
* - `forbidden`: the caller reads the file but may not delete it (deleting
|
|
28
|
+
* is for a Moderator of its workspace);
|
|
29
|
+
* - `in_drawing`: a drawing places it on its canvas;
|
|
30
|
+
* - `attachment`: an email attachment (delete it from the email).
|
|
31
|
+
*/
|
|
32
|
+
export type FileDeleteRefusalReason = 'not_found' | 'forbidden' | 'in_drawing' | 'attachment';
|
|
33
|
+
|
|
34
|
+
/** One id a bulk delete did not delete, and why (never a silent skip). */
|
|
35
|
+
export type BulkDeleteRefusal = {
|
|
36
|
+
fileId: string;
|
|
37
|
+
reason: FileDeleteRefusalReason;
|
|
38
|
+
/** On `in_drawing`: the drawings placing it that the caller reads. */
|
|
39
|
+
drawings?: Array<{ id: string; title: string }>;
|
|
40
|
+
/** On `in_drawing`: how many more place it that the caller does not read,
|
|
41
|
+
* when any. */
|
|
42
|
+
hiddenDrawings?: number;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** DELETE /api/files/files `{ ids }` (no cascade): 200. */
|
|
46
|
+
export type BulkDeleteFilesResponse = {
|
|
47
|
+
deleted: number;
|
|
48
|
+
/** Files not deleted because ingest derived items from them: confirm,
|
|
49
|
+
* then send these ids again with `cascade: true`. */
|
|
50
|
+
hasDerived: Array<{ fileId: string; derived: FileDerivedCounts }>;
|
|
51
|
+
refused: BulkDeleteRefusal[];
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** DELETE /api/files/files `{ ids, cascade: true }`: 200. */
|
|
55
|
+
export type BulkDeleteCascadeResponse = {
|
|
56
|
+
deleted: number;
|
|
57
|
+
/** Always empty on a cascade. */
|
|
58
|
+
hasDerived: [];
|
|
59
|
+
/** Derived items reaped, over every file. */
|
|
60
|
+
reapedTotal: number;
|
|
61
|
+
/** Derived items kept because the caller may not delete them (in a
|
|
62
|
+
* workspace it does not manage, or one it does not read): left in place,
|
|
63
|
+
* over every file (F4 fix round 3). */
|
|
64
|
+
keptTotal: number;
|
|
65
|
+
refused: BulkDeleteRefusal[];
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** DELETE /api/files/files/:id?cascade=1: 200 once the file is deleted. */
|
|
69
|
+
export type FileCascadeDeleteResponse = {
|
|
70
|
+
ok: true;
|
|
71
|
+
reaped: FileDerivedCounts;
|
|
72
|
+
/** Derived items the reap could not delete (audit-visible). */
|
|
73
|
+
skipped: number;
|
|
74
|
+
/** Derived items kept because the caller may not delete them: a count,
|
|
75
|
+
* never a name (F4 fix round 3). */
|
|
76
|
+
kept: number;
|
|
77
|
+
};
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* that reads the item. The switcher's workspace when it reads the item,
|
|
16
16
|
* else the item's home when the caller is a user of it, else the first by
|
|
17
17
|
* name. Absent when the caller is in no such workspace (a read on the
|
|
18
|
-
* system pool
|
|
18
|
+
* system pool). */
|
|
19
19
|
export type HitWorkspace = { id: string; name: string };
|
|
20
20
|
|
|
21
21
|
/** What a search hit carries beside its own fields. */
|
package/src/index.ts
CHANGED
|
@@ -105,6 +105,15 @@ export type {
|
|
|
105
105
|
MemberInviteState,
|
|
106
106
|
} from './dto/member-invites';
|
|
107
107
|
export type { MemberMcpClient, MemberMcpConnector, MemberMcpView } from './dto/member-mcp';
|
|
108
|
+
export type {
|
|
109
|
+
BulkDeleteCascadeResponse,
|
|
110
|
+
BulkDeleteFilesResponse,
|
|
111
|
+
BulkDeleteRefusal,
|
|
112
|
+
FileCascadeDeleteResponse,
|
|
113
|
+
FileDeleteRefusalReason,
|
|
114
|
+
FileDerivedCounts,
|
|
115
|
+
} from './dto/file-deletes';
|
|
116
|
+
|
|
108
117
|
export type { MemberItemKind, ClientItemKind, ClientItemFilter } from './member-kinds';
|
|
109
118
|
export type {
|
|
110
119
|
LoginKind,
|
package/src/role-names.test.ts
CHANGED
|
@@ -136,11 +136,9 @@ export const RECORDED = {
|
|
|
136
136
|
accessLevel: {
|
|
137
137
|
// packages/client-types/src/dto/access.ts ACCESS_LEVELS, highest first.
|
|
138
138
|
source: ['admin', 'team', 'client', 'public'],
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
'packages/db/src/viewer.ts VIEWER_LEVELS': ['public', 'client', 'team', 'admin'],
|
|
143
|
-
},
|
|
139
|
+
// Its one copy (packages/db/src/viewer.ts VIEWER_LEVELS, lowest first)
|
|
140
|
+
// went with the level helpers in arch A7.
|
|
141
|
+
copies: {},
|
|
144
142
|
},
|
|
145
143
|
keyArea: {
|
|
146
144
|
// packages/client-types/src/dto/access-keys.ts ACCESS_KEY_AREAS.
|