Repository navigation
Expand file tree
/
Copy pathsetup-nav.contributions.ts
More file actions
226 lines (222 loc) · 14.4 KB
/
Copy pathsetup-nav.contributions.ts
File metadata and controls
226 lines (222 loc) · 14.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
/**
* Setup App navigation contributions owned by `@objectstack/platform-objects`
* (ADR-0029 D7).
*
* The Setup App (`setup.app.ts`) is a shell of empty group anchors; these
* contributions fill the groups with the entries for objects that still live
* in `@objectstack/platform-objects`. They are registered alongside
* `SETUP_APP` (via `plugin-auth`'s `manifest.register`).
*
* Some entries/groups are intentionally contributed by the capability plugin
* that owns the underlying objects rather than living here (ADR-0029 K2):
* - `group_integrations` → `@objectstack/plugin-webhooks` (K2.a)
* - `group_approvals` → `@objectstack/plugin-approvals` (K2.b)
* - `group_access_control` Positions / Permission Sets → `@objectstack/plugin-security`
* - `group_access_control` Sharing Rules / Record Shares → `@objectstack/plugin-sharing`
* As each remaining domain moves to its capability plugin, its entries move out
* of this file into that plugin the same way.
*
* Priority 100 keeps platform-objects base entries ahead of later
* contributions in the same group (mirrors object owner priority).
*/
import type { NavigationContribution } from '@objectstack/spec/ui';
const BASE_PRIORITY = 100;
// Marketplace entries (browse / installed) moved to
// @objectstack/cloud-connection's marketplace plugins (cloud ADR-0009:
// the nav lives and dies with the capability — no plugin, no entry).
export const SETUP_NAV_CONTRIBUTIONS: NavigationContribution[] = [
{
app: 'setup',
group: 'group_overview',
priority: BASE_PRIORITY,
items: [
{ id: 'nav_system_overview', type: 'dashboard', label: 'System Overview', dashboardName: 'system_overview', icon: 'activity' },
],
},
{
// No unfiltered Packages entry here (#25098, ruling 甲 amending #23892 B):
// the full `developer:packages` list is a development surface, so its one
// unfiltered door is Studio's Overview → Packages (`studio.app.ts`). Setup
// reaches installed packages through the marketplace-filtered "Installed
// Apps" door (`nav_marketplace_installed`, `developer:packages` with
// `params: { source: 'marketplace' }`), which
// `@objectstack/cloud-connection` contributes to this group wherever the
// marketplace capability is present. `setup-packages-door.test.ts` pins
// both halves.
app: 'setup',
group: 'group_apps',
priority: BASE_PRIORITY,
items: [
// Packaged actions are OPERATIONAL state — on/off per packaged action
// (ADR-0126 §7.4: "Studio keeps the editing; Setup gets the operational
// state"). ADR-0146 D4 keeps the action switch here while the flow
// switch moved onto the flow's item in Studio, and its clone became
// Studio's New similar (D11 retired Setup's packaged FLOWS page). The
// console binds `automation:packaged-actions` to the packaged-actions
// page (objectui app-shell `builtinComponents`). The entry lives HERE,
// not in service-automation: the page's data source is the
// `sys_metadata_activation` ledger this package registers (#12419), and
// the action switches work on compositions with no automation service —
// a nav entry riding that service would hide a page that still works
// there.
{ id: 'nav_packaged_actions', type: 'component', label: 'Packaged Actions', componentRef: 'automation:packaged-actions', icon: 'zap' },
],
},
{
app: 'setup',
group: 'group_people_org',
priority: BASE_PRIORITY,
items: [
// `viewName` names the tenant-wide list (#21960). With no view named,
// the console opens the object's FIRST declared list view, and
// `sys_user` used to declare `me` first — a one-row view of the caller —
// so an administrator landed on themselves and read "this organization
// has one user". Every object entry here names its unscoped view the
// same way (#21972), so no entry depends on the declared order; `me`
// stays a tab in the view switcher.
{ id: 'nav_users', type: 'object', label: 'Users', objectName: 'sys_user', viewName: 'all_users', icon: 'user' },
// The ACTIVE organization's record page (Members / Invitations / Teams
// tabs with the better-auth row actions), rendered inside the app shell
// (cloud ADR-0081 D3). `{current_org_id}` resolves from the session's active
// organization; unresolved (e.g. org-less admin before bootstrap) it
// falls back to the sys_organization list — one row in single-org.
{ id: 'nav_organization', type: 'object', label: 'Organization', objectName: 'sys_organization', recordId: '{current_org_id}', icon: 'building-2' },
{ id: 'nav_business_units', type: 'object', label: 'Business Units', objectName: 'sys_business_unit', icon: 'building', requiresObject: 'sys_business_unit' },
// Teams / Invitations no longer gate on `org-scoping` (cloud ADR-0081 D1):
// the better-auth organization capability is always mounted, and
// plugin-auth's single-org default-org bootstrap guarantees an org to
// invite into — these are the OPEN member-management basics. Only the
// org LIST below keeps the gate: browsing organizations is meaningful
// only when more than one can exist (a walled multi-org posture).
{ id: 'nav_teams', type: 'object', label: 'Teams', objectName: 'sys_team', icon: 'users-round' },
{ id: 'nav_organizations', type: 'object', label: 'Organizations', objectName: 'sys_organization', icon: 'building-2', requiresService: 'org-scoping' },
{ id: 'nav_invitations', type: 'object', label: 'Invitations', objectName: 'sys_invitation', icon: 'mail' },
],
},
{
app: 'setup',
group: 'group_access_control',
// Priority 300 keeps API Keys after plugin-security's Positions / Permission
// Sets (100) and plugin-sharing's Sharing Rules / Record Shares (200),
// preserving the original menu order.
priority: 300,
items: [
// Positions / Permission Sets are contributed by @objectstack/plugin-security
// and Sharing Rules / Record Shares by @objectstack/plugin-sharing
// (ADR-0029 K2). Only API Keys (sys_api_key, an identity object owned by
// plugin-auth) remains a platform-objects base entry here.
{ id: 'nav_api_keys', type: 'object', label: 'API Keys', objectName: 'sys_api_key', viewName: 'all_keys', icon: 'key', requiredPermissions: ['manage_platform_settings'] },
],
},
// group_approvals is contributed by @objectstack/plugin-approvals, which owns
// sys_approval_request / sys_approval_action (ADR-0029 K2.b).
{
app: 'setup',
group: 'group_configuration',
priority: BASE_PRIORITY,
items: [
{ id: 'nav_settings_hub', type: 'url', label: 'All Settings', url: '/apps/setup/system/settings', icon: 'settings-2', requiredPermissions: ['manage_platform_settings'] },
// Workspace identity first — Localization (order 2) and Company (order 3)
// are the lowest-`order` settings manifests and the first thing a new
// company admin configures. They ship as `service-settings` manifests
// (tenant scope, read=`setup.access`) but were never pinned here, so they
// were reachable only by drilling into the "All Settings" hub. Mainstream
// admin consoles (Salesforce "Company Information", ServiceNow) surface
// both directly. No `requiredPermissions` — matches Branding (read perm is
// the app's base `setup.access`).
{ id: 'nav_settings_localization', type: 'url', label: 'Localization', url: '/apps/setup/system/settings/localization', icon: 'globe' },
// Multi-currency M1-1 (epic #8345): the dated rates from the home
// currency Localization sets, so the entry sits directly under it. The
// list page states the rate direction (`EXCHANGE_RATE_DIRECTION`). No
// `requiredPermissions`: the object grant decides who reads and writes
// (organization admins), and Setup itself already needs `setup.access`.
{ id: 'nav_exchange_rates', type: 'object', label: 'Exchange Rates', objectName: 'sys_exchange_rate', viewName: 'all_rates', icon: 'arrow-right-left' },
{ id: 'nav_settings_company', type: 'url', label: 'Company', url: '/apps/setup/system/settings/company', icon: 'building-2' },
// `nav_settings_branding` is contributed by `@objectstack/service-settings`
// with the `branding` namespace, which is offered only where no
// organization wall stands (#24766) — so the entry lives and dies with it.
{ id: 'nav_settings_auth', type: 'url', label: 'Authentication', url: '/apps/setup/system/settings/auth', icon: 'lock-keyhole', requiredPermissions: ['manage_platform_settings'] },
// [ADR-0069 TL;DR 6] An organization's own sign-in restrictions, held to
// the deployment's Authentication values (the `access_policy` namespace,
// scope `tenant`). No `requiredPermissions`: like Localization, the
// manifest's `setup.access` read is the app's base permission, and an
// organization administrator writes it (`setup.write`).
{ id: 'nav_settings_access_policy', type: 'url', label: 'Access policy', url: '/apps/setup/system/settings/access_policy', icon: 'shield-check' },
// Every entry below opening a settings page carries that page's hub
// title, and every hub page has one (#27854): the sidebar and the
// "All Settings" hub are two lists of one set of pages. Pinned against
// the registered manifests and both translation bundles in
// `@objectstack/service-settings` (`setup-nav-hub-parity.test.ts`).
{ id: 'nav_settings_mail', type: 'url', label: 'Mail Delivery', url: '/apps/setup/system/settings/mail', icon: 'mail', requiredPermissions: ['manage_platform_settings'] },
{ id: 'nav_settings_sms', type: 'url', label: 'SMS Delivery', url: '/apps/setup/system/settings/sms', icon: 'message-square', requiredPermissions: ['manage_platform_settings'] },
{ id: 'nav_settings_storage', type: 'url', label: 'File Storage', url: '/apps/setup/system/settings/storage', icon: 'hard-drive', requiredPermissions: ['manage_platform_settings'] },
{ id: 'nav_settings_ai', type: 'url', label: 'AI & Embedder', url: '/apps/setup/system/settings/ai', icon: 'sparkles', requiredPermissions: ['manage_platform_settings'] },
{ id: 'nav_settings_knowledge', type: 'url', label: 'Knowledge', url: '/apps/setup/system/settings/knowledge', icon: 'book-open', requiredPermissions: ['manage_platform_settings'] },
// `lifecycle` is `@objectstack/objectql`'s manifest (ADR-0057), offered
// wherever a settings service is mounted, like the entries above.
{ id: 'nav_settings_lifecycle', type: 'url', label: 'Data Lifecycle', url: '/apps/setup/system/settings/lifecycle', icon: 'timer', requiredPermissions: ['manage_platform_settings'] },
],
},
{
app: 'setup',
group: 'group_diagnostics',
priority: BASE_PRIORITY,
items: [
// Audit Logs (sys_audit_log) is contributed by @objectstack/plugin-audit
// which now owns it (ADR-0029 K2).
{ id: 'nav_sessions', type: 'object', label: 'Sessions', objectName: 'sys_session', viewName: 'all_sessions', icon: 'monitor' },
{ id: 'nav_notifications', type: 'object', label: 'Notification Events', objectName: 'sys_notification', viewName: 'recent', icon: 'bell', requiresObject: 'sys_notification' },
],
},
{
app: 'setup',
group: 'group_advanced',
priority: BASE_PRIORITY,
items: [
{ id: 'nav_oauth_apps', type: 'object', label: 'OAuth Applications', objectName: 'sys_oauth_application', viewName: 'all_apps', icon: 'app-window' },
// No `nav_jwks` here (#7544). `sys_jwks` is the environment's JWT SIGNING
// KEY store (`private_key` — private key material), and it declares
// `enable.apiEnabled: false` / `apiMethods: []`, so the generic data API
// answers `OBJECT_API_DISABLED` (404) on every list request.
//
// ⚠️ That 404 is NOT a permission outcome and no permission gate can
// prune it. `apiAccessDenialFromEnable` (rest-server.ts) is a PURE
// function of the object's `enable` block — it takes no user, no
// permissions and no context — so the 404 is identical for every
// persona, platform admin included. The entry this replaces carried
// `requiredPermissions: ['manage_platform_settings']` and a comment
// claiming a non-admin "403s server-side", which read as though an ADMIN
// could list the keys. None could: the page was dead for everyone, and
// the console masked the 404 as a generic empty state, so the surface
// read as "you have no signing keys" rather than "this page cannot work".
//
// ⛔ The repair is the entry, never the object: opening a read path onto
// private signing keys over the generic data API would be a credential
// disclosure. `apiMethods: []` fails CLOSED by design (#3391).
//
// The same reasoning already governs the two entries below, and it is why
// the other six API-disabled objects (the `sys_oauth_*` token/consent
// stores) have no nav entry either — `sys_jwks` was the only one that did.
//
// `sys_verification` (email/phone tokens) and `sys_device_code` (OAuth
// device-grant codes) deliberately omit `list` from their `apiMethods`
// (sensitive, ephemeral secrets — not browsable), so an object/list-view
// nav entry for them can only ever render "failed to load". They're
// reachable by id (get) when needed; no browse menu. (Re-adding requires
// enabling `list` on the object — a security decision.)
//
// No `nav_accounts` ("Identity Links", `sys_account`) and no
// `nav_user_preferences` ("User Preferences", `sys_user_preference`)
// either (#23803), for a different reason: both objects list fine, but
// each row belongs to one user and is written for that user — identity
// links by better-auth at sign-in, preferences by the console as the
// user works (`ui.recent`, `ui.favorites`, …). A menu entry listing them
// across every user is not a page an administrator works from. Each is
// reached from the user it belongs to instead: the User record page's
// "Linked Accounts" and "Preferences" tabs (`pages/sys-user.page.ts`),
// and the search, which finds the user. The objects, their list views and
// their routes are unchanged; only the two menu entries left.
],
},
];