fix: close housekeeping foundation review findings
This commit is contained in:
1 parent
ebc263da35
commit
08f8d54888
21 files changed
+593
-46
No files matched your search
@@ -40,6 +40,9 @@ const searchResult = {
|
||||
} satisfies HousekeepingSearchResult;
|
||||
|
||||
const searchProvider: HousekeepingSearchProvider = {
|
||||
id: "people.users",
|
||||
owner: "people",
|
||||
capability,
|
||||
search: async () => ok([searchResult], "search-1"),
|
||||
};
|
||||
|
||||
@@ -49,10 +52,17 @@ const inboxSourceResult = {
|
||||
} satisfies HousekeepingInboxSourceResult;
|
||||
|
||||
const inboxSource: HousekeepingInboxSource = {
|
||||
id: "people.tickets",
|
||||
owner: "people",
|
||||
capability,
|
||||
getItems: async () => ok(inboxSourceResult, "inbox-1"),
|
||||
};
|
||||
|
||||
const widget: HousekeepingWidgetDefinition = {
|
||||
id: "people.queue",
|
||||
owner: "people",
|
||||
capability,
|
||||
kind: "mandatory",
|
||||
load: async () => ok({ count: 2 }, "widget-1"),
|
||||
};
|
||||
|
||||
@@ -80,6 +90,9 @@ const manifest: HousekeepingDomainManifest = {
|
||||
previewHref: "/admin-next/people",
|
||||
capability,
|
||||
routes: [],
|
||||
searchProviders: [searchProvider],
|
||||
inboxSources: [inboxSource],
|
||||
widgets: [widget],
|
||||
};
|
||||
|
||||
describe("housekeeping foundation contracts", () => {
|
||||
@@ -118,4 +131,23 @@ describe("housekeeping foundation contracts", () => {
|
||||
requirements,
|
||||
]).toHaveLength(8);
|
||||
});
|
||||
|
||||
it("carries stable ownership and capability metadata for registry entries", () => {
|
||||
expect(searchProvider).toMatchObject({
|
||||
id: "people.users",
|
||||
owner: "people",
|
||||
capability,
|
||||
});
|
||||
expect(inboxSource).toMatchObject({
|
||||
id: "people.tickets",
|
||||
owner: "people",
|
||||
capability,
|
||||
});
|
||||
expect(widget).toMatchObject({
|
||||
id: "people.queue",
|
||||
owner: "people",
|
||||
capability,
|
||||
kind: "mandatory",
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,8 @@
|
||||
import type { HousekeepingDomainId } from "../../migration/types";
|
||||
import type { CapabilityRequirement } from "./capability";
|
||||
import type { HousekeepingInboxSource } from "./inbox";
|
||||
import type { HousekeepingSearchProvider } from "./search";
|
||||
import type { HousekeepingWidgetDefinition } from "./widget";
|
||||
|
||||
export interface HousekeepingRouteDefinition {
|
||||
id: string;
|
||||
@@ -17,4 +20,7 @@ export interface HousekeepingDomainManifest {
|
||||
previewHref: `/admin-next/${HousekeepingDomainId}`;
|
||||
capability: CapabilityRequirement;
|
||||
routes: readonly HousekeepingRouteDefinition[];
|
||||
searchProviders: readonly HousekeepingSearchProvider[];
|
||||
inboxSources: readonly HousekeepingInboxSource[];
|
||||
widgets: readonly HousekeepingWidgetDefinition[];
|
||||
}
|
||||
@@ -29,6 +29,9 @@ export interface HousekeepingInboxSourceResult {
|
||||
}
|
||||
|
||||
export interface HousekeepingInboxSource {
|
||||
id: string;
|
||||
owner: HousekeepingDomainId;
|
||||
capability: CapabilityRequirement;
|
||||
getItems(
|
||||
context: HousekeepingCapabilityContext,
|
||||
signal: AbortSignal,
|
||||
|
||||
@@ -30,4 +30,7 @@ export type {
|
||||
HousekeepingSearchProvider,
|
||||
HousekeepingSearchResult,
|
||||
} from "./search";
|
||||
export type { HousekeepingWidgetDefinition } from "./widget";
|
||||
export type {
|
||||
HousekeepingWidgetDefinition,
|
||||
HousekeepingWidgetKind,
|
||||
} from "./widget";
|
||||
@@ -1,5 +1,8 @@
|
||||
import type { HousekeepingDomainId } from "../../migration/types";
|
||||
import type { HousekeepingCapabilityContext } from "./capability";
|
||||
import type {
|
||||
CapabilityRequirement,
|
||||
HousekeepingCapabilityContext,
|
||||
} from "./capability";
|
||||
import type { HousekeepingResult } from "./result";
|
||||
|
||||
export interface HousekeepingSearchInput {
|
||||
@@ -15,6 +18,9 @@ export interface HousekeepingSearchResult {
|
||||
}
|
||||
|
||||
export interface HousekeepingSearchProvider {
|
||||
id: string;
|
||||
owner: HousekeepingDomainId;
|
||||
capability: CapabilityRequirement;
|
||||
search(
|
||||
context: HousekeepingCapabilityContext,
|
||||
input: HousekeepingSearchInput,
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
import type { HousekeepingCapabilityContext } from "./capability";
|
||||
import type { HousekeepingDomainId } from "../../migration/types";
|
||||
import type {
|
||||
CapabilityRequirement,
|
||||
HousekeepingCapabilityContext,
|
||||
} from "./capability";
|
||||
import type { HousekeepingResult } from "./result";
|
||||
|
||||
export type HousekeepingWidgetKind = "mandatory" | "optional";
|
||||
|
||||
export interface HousekeepingWidgetDefinition {
|
||||
id: string;
|
||||
owner: HousekeepingDomainId;
|
||||
capability: CapabilityRequirement;
|
||||
kind: HousekeepingWidgetKind;
|
||||
load(
|
||||
context: HousekeepingCapabilityContext,
|
||||
): Promise<HousekeepingResult<unknown>>;
|
||||
|
||||
Reference in new issue
Block a user