@jeffusion/bungee-types 5.24.3 → 5.26.0

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.
@@ -43,6 +43,8 @@ export type DaemonFileOptions = {
43
43
  export declare function formatDaemonFileAclError(error: unknown): string | null;
44
44
  /** @internal source-test probe; not re-exported from the package root. */
45
45
  export declare function __testSelectWindowsAclExecutable(environment: NodeJS.ProcessEnv): string;
46
+ /** Restrict a newly created private file before writing any secret bytes. */
47
+ export declare function secureWindowsOwnerOnlyFileAcl(path: string, adapter?: WindowsAclAdapter): Promise<void>;
46
48
  /** Read-only validation: untrusted input files must never have their ACL repaired. */
47
49
  export declare function assertWindowsOwnerOnlyFileAcl(path: string, adapter?: WindowsAclAdapter): Promise<void>;
48
50
  /** @internal source-test probe; not re-exported from the package root. */
@@ -717,6 +717,11 @@ function defaultWindowsAclAdapter(deadlineMs = WINDOWS_ACL_DEADLINE_MS) {
717
717
  },
718
718
  };
719
719
  }
720
+ /** Restrict a newly created private file before writing any secret bytes. */
721
+ export async function secureWindowsOwnerOnlyFileAcl(path, adapter = defaultWindowsAclAdapter()) {
722
+ await ensureWindowsAcl(path, adapter, 'file');
723
+ await assertWindowsOwnerOnlyFileAcl(path, adapter);
724
+ }
720
725
  /** Read-only validation: untrusted input files must never have their ACL repaired. */
721
726
  export async function assertWindowsOwnerOnlyFileAcl(path, adapter = defaultWindowsAclAdapter()) {
722
727
  const snapshot = await adapter.read(path);
package/dist/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from './daemon-control.js';
5
5
  export * from './publication-policy.js';
6
6
  export * from './sse-log.js';
7
7
  export * from './plugin-config-contract.js';
8
+ export * from './menus.js';
package/dist/index.js CHANGED
@@ -5,3 +5,4 @@ export * from './daemon-control.js';
5
5
  export * from './publication-policy.js';
6
6
  export * from './sse-log.js';
7
7
  export * from './plugin-config-contract.js';
8
+ export * from './menus.js';
@@ -0,0 +1,82 @@
1
+ /** Instance-wide navigation. Visibility never grants or revokes page access. */
2
+ export type MenuPage = {
3
+ readonly id: string;
4
+ readonly label: string;
5
+ readonly href: string;
6
+ readonly source: 'builtin' | 'plugin';
7
+ readonly pluginName?: string;
8
+ readonly defaultIcon: string;
9
+ readonly available: boolean;
10
+ };
11
+ export type MenuPageNode = {
12
+ readonly kind: 'page';
13
+ readonly pageId: string;
14
+ readonly visible: boolean;
15
+ readonly icon?: string;
16
+ };
17
+ export type MenuGroupNode = {
18
+ readonly kind: 'group';
19
+ readonly id: string;
20
+ /** Null is reserved for the translated default system group. */
21
+ readonly title: string | null;
22
+ readonly visible: boolean;
23
+ readonly icon?: string;
24
+ readonly children: readonly MenuPageNode[];
25
+ };
26
+ export type MenuNode = MenuPageNode | MenuGroupNode;
27
+ export type MenuLayout = readonly MenuNode[];
28
+ export type MenuLayoutRecord = {
29
+ readonly revision: number;
30
+ readonly layout: MenuLayout | null;
31
+ };
32
+ export type MenuSnapshot = {
33
+ readonly revision: number;
34
+ readonly catalog: readonly MenuPage[];
35
+ readonly layout: MenuLayout;
36
+ readonly iconRevision: string;
37
+ };
38
+ export type MenuWrite = {
39
+ readonly expected_revision: number;
40
+ readonly layout: MenuLayout;
41
+ };
42
+ export type MenuIconData = {
43
+ readonly body: string;
44
+ readonly width: number;
45
+ readonly height: number;
46
+ };
47
+ export type MenuIconCollection = {
48
+ readonly id: string;
49
+ readonly title: string;
50
+ readonly total: number;
51
+ readonly version: string;
52
+ readonly license: {
53
+ readonly title: string;
54
+ readonly url?: string;
55
+ };
56
+ };
57
+ export type MenuIconCollections = {
58
+ readonly revision: string;
59
+ readonly collections: readonly MenuIconCollection[];
60
+ };
61
+ export type MenuIconSearch = {
62
+ readonly revision: string;
63
+ readonly items: readonly {
64
+ readonly id: string;
65
+ readonly name: string;
66
+ readonly collection: string;
67
+ }[];
68
+ readonly total: number;
69
+ readonly offset: number;
70
+ readonly limit: number;
71
+ };
72
+ export type MenuIcons = {
73
+ readonly revision: string;
74
+ readonly icons: Readonly<Record<string, MenuIconData>>;
75
+ readonly missing: readonly string[];
76
+ };
77
+ export declare const MENU_MANAGEMENT_ID = "builtin:menus";
78
+ export declare const SYSTEM_MENU_GROUP_ID = "group:system";
79
+ export declare const BUILTIN_MENU_PAGES: readonly MenuPage[];
80
+ export declare function createDefaultMenuLayout(catalog: readonly MenuPage[]): MenuLayout;
81
+ /** New contributions append without moving saved or temporarily unavailable pages. */
82
+ export declare function reconcileMenuLayout(layout: MenuLayout, catalog: readonly MenuPage[]): MenuLayout;
package/dist/menus.js ADDED
@@ -0,0 +1,25 @@
1
+ export const MENU_MANAGEMENT_ID = 'builtin:menus';
2
+ export const SYSTEM_MENU_GROUP_ID = 'group:system';
3
+ export const BUILTIN_MENU_PAGES = [
4
+ { id: 'builtin:dashboard', label: 'nav.dashboard', href: '/#/', source: 'builtin', defaultIcon: 'lucide:layout-dashboard', available: true },
5
+ { id: 'builtin:routes', label: 'nav.routes', href: '/#/routes', source: 'builtin', defaultIcon: 'lucide:route', available: true },
6
+ { id: 'builtin:services', label: 'nav.services', href: '/#/services', source: 'builtin', defaultIcon: 'lucide:server', available: true },
7
+ { id: 'builtin:logs', label: 'nav.logs', href: '/#/logs', source: 'builtin', defaultIcon: 'lucide:file-text', available: true },
8
+ { id: 'builtin:configuration', label: 'nav.configuration', href: '/#/config', source: 'builtin', defaultIcon: 'lucide:sliders-horizontal', available: true },
9
+ { id: 'builtin:plugins', label: 'nav.plugins', href: '/#/plugins', source: 'builtin', defaultIcon: 'lucide:blocks', available: true },
10
+ { id: MENU_MANAGEMENT_ID, label: 'nav.menus', href: '/#/menus', source: 'builtin', defaultIcon: 'lucide:list-tree', available: true },
11
+ ];
12
+ export function createDefaultMenuLayout(catalog) {
13
+ const page = (pageId) => ({ kind: 'page', pageId, visible: true });
14
+ return [
15
+ ...BUILTIN_MENU_PAGES.slice(0, 4).map(item => page(item.id)),
16
+ ...catalog.filter(item => item.source === 'plugin' && item.available).map(item => page(item.id)),
17
+ { kind: 'group', id: SYSTEM_MENU_GROUP_ID, title: null, visible: true,
18
+ children: BUILTIN_MENU_PAGES.slice(4).map(item => page(item.id)) },
19
+ ];
20
+ }
21
+ /** New contributions append without moving saved or temporarily unavailable pages. */
22
+ export function reconcileMenuLayout(layout, catalog) {
23
+ const seen = new Set(layout.flatMap(node => node.kind === 'page' ? [node.pageId] : node.children.map(child => child.pageId)));
24
+ return [...layout, ...catalog.filter(page => page.available && !seen.has(page.id)).map(page => ({ kind: 'page', pageId: page.id, visible: true }))];
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeffusion/bungee-types",
3
- "version": "5.24.3",
3
+ "version": "5.26.0",
4
4
  "description": "TypeScript type definitions for Bungee",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",