fix(housekeeping): preserve runtime import boundaries
This commit is contained in:
1 parent
b9c47aa89a
commit
1ae59bcc1a
7 files changed
+18
-22
No files matched your search
@@ -5,6 +5,7 @@ import type {
|
||||
HousekeepingSurface,
|
||||
} from "../../../foundation/contracts";
|
||||
import type { HousekeepingPreferences } from "../../../foundation/preferences/schema";
|
||||
import type { HousekeepingWidgetOption } from "../../../foundation/preferences/widget-options";
|
||||
import type { HousekeepingWidgetLoadResult } from "../../../foundation/registry";
|
||||
import { Favorites } from "../../../foundation/shell/favorites";
|
||||
import { WidgetGrid } from "../../../foundation/shell/widget-grid";
|
||||
@@ -12,7 +13,6 @@ import {
|
||||
type HousekeepingPreferenceSaver,
|
||||
WidgetSettings,
|
||||
} from "../../../foundation/shell/widget-settings";
|
||||
import type { OperationsWidgetOption } from "../personalization-model";
|
||||
|
||||
export interface OperationsPersonalizationLabels {
|
||||
readonly favorites: {
|
||||
@@ -55,7 +55,7 @@ export function OperationsPersonalization({
|
||||
}: {
|
||||
readonly preferences: HousekeepingPreferences;
|
||||
readonly routes: readonly HousekeepingRouteDefinition[];
|
||||
readonly widgets: readonly OperationsWidgetOption[];
|
||||
readonly widgets: readonly HousekeepingWidgetOption[];
|
||||
readonly widgetResult: HousekeepingWidgetLoadResult;
|
||||
readonly surface: HousekeepingSurface;
|
||||
readonly labels: OperationsPersonalizationLabels;
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
ok,
|
||||
} from "../../../foundation/contracts";
|
||||
import { defaultHousekeepingPreferences } from "../../../foundation/preferences/schema";
|
||||
import type { OperationsWidgetOption } from "../personalization-model";
|
||||
import type { HousekeepingWidgetOption } from "../../../foundation/preferences/widget-options";
|
||||
import type { OperationsWorkspaceLoadResult } from "../queries";
|
||||
import { OperationsWorkspacePage } from "./workspace";
|
||||
|
||||
@@ -20,7 +20,7 @@ const routes: readonly HousekeepingRouteDefinition[] = [
|
||||
capability,
|
||||
},
|
||||
];
|
||||
const widgets: readonly OperationsWidgetOption[] = [
|
||||
const widgets: readonly HousekeepingWidgetOption[] = [
|
||||
{
|
||||
id: "people.queue",
|
||||
kind: "mandatory",
|
||||
|
||||
@@ -3,10 +3,10 @@ import type {
|
||||
HousekeepingSurface,
|
||||
} from "../../../foundation/contracts";
|
||||
import { HousekeepingPageShell } from "../../../foundation/page/housekeeping-page-shell";
|
||||
import type { HousekeepingWidgetOption } from "../../../foundation/preferences/widget-options";
|
||||
import { OperationalInbox } from "../../../foundation/shell/operational-inbox";
|
||||
import { RecentWork } from "../../../foundation/shell/recent-work";
|
||||
import type { HousekeepingPreferenceSaver } from "../../../foundation/shell/widget-settings";
|
||||
import type { OperationsWidgetOption } from "../personalization-model";
|
||||
import type { OperationsWorkspaceLoadResult } from "../queries";
|
||||
import {
|
||||
OperationsPersonalization,
|
||||
@@ -50,7 +50,7 @@ export function OperationsWorkspacePage({
|
||||
}: {
|
||||
readonly result: OperationsWorkspaceLoadResult;
|
||||
readonly routes: readonly HousekeepingRouteDefinition[];
|
||||
readonly widgetDefinitions: readonly OperationsWidgetOption[];
|
||||
readonly widgetDefinitions: readonly HousekeepingWidgetOption[];
|
||||
readonly surface: HousekeepingSurface;
|
||||
readonly labels: OperationsWorkspaceLabels;
|
||||
readonly routeTitles: Readonly<Record<string, string>>;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { createElement } from "react";
|
||||
import { satisfiesCapability } from "../../foundation/capability-context";
|
||||
import { toHousekeepingWidgetOptions } from "../../foundation/preferences/widget-options";
|
||||
import { createHousekeepingRegistry } from "../../foundation/registry";
|
||||
import { HOUSEKEEPING_MANIFESTS } from "../../manifests";
|
||||
import type { HousekeepingRouteHandler } from "../../route-handlers";
|
||||
@@ -7,7 +8,6 @@ import {
|
||||
type OperationsWorkspaceLabels,
|
||||
OperationsWorkspacePage,
|
||||
} from "./pages/workspace";
|
||||
import { toOperationsWidgetOptions } from "./personalization-model";
|
||||
import { operationsWorkspaceQuery } from "./queries";
|
||||
|
||||
export async function renderOperationsWorkspacePage(
|
||||
@@ -139,7 +139,7 @@ export async function renderOperationsWorkspacePage(
|
||||
return createElement(OperationsWorkspacePage, {
|
||||
result: workspaceResult,
|
||||
routes,
|
||||
widgetDefinitions: toOperationsWidgetOptions(widgetDefinitions),
|
||||
widgetDefinitions: toHousekeepingWidgetOptions(widgetDefinitions),
|
||||
surface: input.surface ?? "preview",
|
||||
labels,
|
||||
routeTitles,
|
||||
|
||||
+4
-4
@@ -3,10 +3,10 @@ import {
|
||||
anyCapability,
|
||||
type HousekeepingWidgetDefinition,
|
||||
ok,
|
||||
} from "../../foundation/contracts";
|
||||
import { toOperationsWidgetOptions } from "./personalization-model";
|
||||
} from "../contracts";
|
||||
import { toHousekeepingWidgetOptions } from "./widget-options";
|
||||
|
||||
describe("toOperationsWidgetOptions", () => {
|
||||
describe("toHousekeepingWidgetOptions", () => {
|
||||
it("projects provider definitions to a serializable client view model", () => {
|
||||
const load = vi.fn(async () => ok({ count: 1 }, "widget"));
|
||||
const definitions: readonly HousekeepingWidgetDefinition[] = [
|
||||
@@ -19,7 +19,7 @@ describe("toOperationsWidgetOptions", () => {
|
||||
},
|
||||
];
|
||||
|
||||
const options = toOperationsWidgetOptions(definitions);
|
||||
const options = toHousekeepingWidgetOptions(definitions);
|
||||
|
||||
expect(options).toEqual([{ id: "people.queue", kind: "mandatory" }]);
|
||||
expect(structuredClone(options)).toEqual(options);
|
||||
+4
-4
@@ -1,15 +1,15 @@
|
||||
import type {
|
||||
HousekeepingWidgetDefinition,
|
||||
HousekeepingWidgetKind,
|
||||
} from "../../foundation/contracts";
|
||||
} from "../contracts";
|
||||
|
||||
export interface OperationsWidgetOption {
|
||||
export interface HousekeepingWidgetOption {
|
||||
readonly id: string;
|
||||
readonly kind: HousekeepingWidgetKind;
|
||||
}
|
||||
|
||||
export function toOperationsWidgetOptions(
|
||||
export function toHousekeepingWidgetOptions(
|
||||
definitions: readonly HousekeepingWidgetDefinition[],
|
||||
): readonly OperationsWidgetOption[] {
|
||||
): readonly HousekeepingWidgetOption[] {
|
||||
return definitions.map(({ id, kind }) => ({ id, kind }));
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import type { HousekeepingResult, HousekeepingWidgetKind } from "../contracts";
|
||||
import type { HousekeepingResult } from "../contracts";
|
||||
import type { HousekeepingPreferences } from "../preferences/schema";
|
||||
import type { HousekeepingWidgetOption } from "../preferences/widget-options";
|
||||
|
||||
export type HousekeepingPreferenceSaver = (
|
||||
preferences: HousekeepingPreferences,
|
||||
@@ -41,11 +42,6 @@ export interface WidgetSettingsLabels {
|
||||
readonly error: string;
|
||||
}
|
||||
|
||||
export interface HousekeepingWidgetOption {
|
||||
readonly id: string;
|
||||
readonly kind: HousekeepingWidgetKind;
|
||||
}
|
||||
|
||||
export function WidgetSettings({
|
||||
preferences: initialPreferences,
|
||||
widgets,
|
||||
|
||||
Reference in new issue
Block a user