refactor: 프론트엔드 리펙토링
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import type { ApplicationFeatureInputs } from "../application/ports/in/application-api.ts";
|
||||
import {
|
||||
composeFeatureAdapterInputs,
|
||||
type ContributionsCapabilityContext,
|
||||
type InstalledFeatureInputs,
|
||||
} from "./feature-adapter-contribution.ts";
|
||||
import { REFERENCE_FEATURE_ADAPTER_CONTRIBUTION } from "./reference-feature/adapters/create-reference-feature-input.ts";
|
||||
import { INSTALLED_PRODUCT_FEATURE_IDS } from "./installed-product-manifest.ts";
|
||||
|
||||
@@ -6,28 +10,22 @@ const COMPILED_FEATURE_ADAPTER_CONTRIBUTIONS = Object.freeze([
|
||||
REFERENCE_FEATURE_ADAPTER_CONTRIBUTION,
|
||||
] as const);
|
||||
|
||||
type FeatureAdapterContext = Parameters<
|
||||
(typeof COMPILED_FEATURE_ADAPTER_CONTRIBUTIONS)[number]["createInput"]
|
||||
>[0];
|
||||
|
||||
type InstalledFeatureInputs = Readonly<Partial<ApplicationFeatureInputs>>;
|
||||
type InstalledFeatureCapabilityContext =
|
||||
ContributionsCapabilityContext<
|
||||
typeof COMPILED_FEATURE_ADAPTER_CONTRIBUTIONS
|
||||
>;
|
||||
|
||||
/**
|
||||
* Central adapter composition only selects and aggregates feature-owned
|
||||
* contributions. The feature owns how its application input is bound to
|
||||
* reusable platform capabilities.
|
||||
* contributions. The feature owns how its application input is bound to the
|
||||
* reusable platform capabilities declared by its `needs` list.
|
||||
*/
|
||||
export function createInstalledFeatureInputs(
|
||||
context: FeatureAdapterContext,
|
||||
context: InstalledFeatureCapabilityContext,
|
||||
): InstalledFeatureInputs {
|
||||
const entries = COMPILED_FEATURE_ADAPTER_CONTRIBUTIONS
|
||||
.filter((contribution) =>
|
||||
INSTALLED_PRODUCT_FEATURE_IDS.includes(contribution.featureId),
|
||||
)
|
||||
.map((contribution) => {
|
||||
const installed = contribution.createInput(context);
|
||||
return [installed.featureId, installed.input] as const;
|
||||
});
|
||||
|
||||
return Object.freeze(Object.fromEntries(entries)) as InstalledFeatureInputs;
|
||||
return composeFeatureAdapterInputs(
|
||||
COMPILED_FEATURE_ADAPTER_CONTRIBUTIONS,
|
||||
INSTALLED_PRODUCT_FEATURE_IDS,
|
||||
context,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user