@crossworks/client-types 0.232.254 → 0.232.257
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/access.ts +55 -0
- package/src/dto/rows.ts +5 -0
- package/src/index.ts +8 -0
package/package.json
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Access control's wire shapes (`/api/access/nodes/:id`). One level
|
|
3
|
+
* system: admin > team > client > public. A caller sees what is at or below
|
|
4
|
+
* its level. The level is the truth and the item's share link follows it:
|
|
5
|
+
* none at admin, a team-only link at team (the team workspace opens items
|
|
6
|
+
* through it), an open link at client and public. See docs/access-levels.md.
|
|
7
|
+
*/
|
|
8
|
+
import type { ShareMode } from './rows';
|
|
9
|
+
|
|
10
|
+
/** Highest first: the order the control shows them in. */
|
|
11
|
+
export const ACCESS_LEVELS = ['admin', 'team', 'client', 'public'] as const;
|
|
12
|
+
export type AccessLevel = (typeof ACCESS_LEVELS)[number];
|
|
13
|
+
|
|
14
|
+
/** One item as the Access control lists it (the item itself or its closure). */
|
|
15
|
+
export type AccessItemView = {
|
|
16
|
+
id: string;
|
|
17
|
+
type: string;
|
|
18
|
+
title: string;
|
|
19
|
+
audience: AccessLevel;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** The item's link. `path` is server-relative (`/s/<token>`). */
|
|
23
|
+
export type AccessLinkView = {
|
|
24
|
+
id: string;
|
|
25
|
+
token: string;
|
|
26
|
+
path: string;
|
|
27
|
+
mode: ShareMode;
|
|
28
|
+
/** Page links only: sub-pages are shared with it. */
|
|
29
|
+
cascade: boolean;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** GET /api/access/nodes/:id */
|
|
33
|
+
export type AccessNodeView = {
|
|
34
|
+
item: AccessItemView;
|
|
35
|
+
/** What the item's link or embeds need: a page's files and drawings, a
|
|
36
|
+
* folder's contents, a drawing's images. Each carries its own level. */
|
|
37
|
+
closure: AccessItemView[];
|
|
38
|
+
share: AccessLinkView | null;
|
|
39
|
+
/** Descendant pages (pages only; 0 otherwise). */
|
|
40
|
+
childCount: number;
|
|
41
|
+
/** Only workspace kinds go below admin (tasks, events, … are admin only). */
|
|
42
|
+
canLower: boolean;
|
|
43
|
+
/** Whether the item can carry a link (a folder only under `files`). */
|
|
44
|
+
canLink: boolean;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** PATCH /api/access/nodes/:id { audience, withClosure? } */
|
|
48
|
+
export type AccessNodeUpdate = {
|
|
49
|
+
item: AccessItemView;
|
|
50
|
+
/** Closure items lowered with it (only when `withClosure`). */
|
|
51
|
+
lowered: AccessItemView[];
|
|
52
|
+
/** Closure items still above the new level (when not `withClosure`). */
|
|
53
|
+
stillAbove: AccessItemView[];
|
|
54
|
+
share: AccessLinkView | null;
|
|
55
|
+
};
|
package/src/dto/rows.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import type { AppNav, AppOpenStat, AppTint } from '../app-nav';
|
|
14
|
+
import type { AccessLevel } from './access';
|
|
14
15
|
|
|
15
16
|
// ── Row/DTO shapes moved from the server packages (jackdaw split P0) ─────────
|
|
16
17
|
// Sources: @mantle/content, @mantle/email, @mantle/microsoft, @mantle/runtime/agent
|
|
@@ -128,6 +129,8 @@ export type PageRow = {
|
|
|
128
129
|
summary: string | null;
|
|
129
130
|
visibility: PageVisibility;
|
|
130
131
|
width: PageWidth;
|
|
132
|
+
/** Access level (admin > team > client > public); the owner UI's badge. */
|
|
133
|
+
audience: AccessLevel;
|
|
131
134
|
createdAt: string;
|
|
132
135
|
updatedAt: string;
|
|
133
136
|
};
|
|
@@ -170,6 +173,8 @@ export type AppRow = {
|
|
|
170
173
|
shareMode: ShareMode | null;
|
|
171
174
|
/** Whether this app is the designated Team Hub (prefs.teamHubAppId). */
|
|
172
175
|
isHub: boolean;
|
|
176
|
+
/** Access level (admin > team > client > public); the owner UI's badge. */
|
|
177
|
+
audience: AccessLevel;
|
|
173
178
|
createdAt: string;
|
|
174
179
|
updatedAt: string;
|
|
175
180
|
};
|
package/src/index.ts
CHANGED
|
@@ -32,6 +32,14 @@ export * from './dto/turns';
|
|
|
32
32
|
export * from './dto/rows';
|
|
33
33
|
export * from './dto/views';
|
|
34
34
|
export * from './dto/recall';
|
|
35
|
+
// Types only; ACCESS_LEVELS (runtime) is the `@mantle/client-types/dto/access` subpath.
|
|
36
|
+
export type {
|
|
37
|
+
AccessItemView,
|
|
38
|
+
AccessLevel,
|
|
39
|
+
AccessLinkView,
|
|
40
|
+
AccessNodeUpdate,
|
|
41
|
+
AccessNodeView,
|
|
42
|
+
} from './dto/access';
|
|
35
43
|
|
|
36
44
|
// Types only at the root; the runtime constants (APP_TINTS, limits) are the
|
|
37
45
|
// `@mantle/client-types/app-nav` subpath.
|