refactor: 템플릿에서 기본적으로 제공하고 있는 워크 플로우에 디자인과 라우팅 흡수
This commit is contained in:
@@ -3,12 +3,12 @@ import {
|
||||
type TechLogFeatureInput,
|
||||
} from "../application/tech-log-feature-input.ts";
|
||||
import type { Asset } from "../contracts/studio/contract.ts";
|
||||
import { createTechLogStudioApplication } from "../application/studio-application.ts";
|
||||
import type { InstalledHttpOperationExecutor } from "../../../adapters/http/index.ts";
|
||||
import { createTechLogHttpBinding } from "./http/tech-log-http-binding.ts";
|
||||
import { createAssetUploadTransport } from "./http/asset-upload-transport.ts";
|
||||
import { createHttpStudioAssetGateway } from "./http/http-studio-asset-gateway.ts";
|
||||
import {
|
||||
createHttpStudioGateway,
|
||||
type StudioOperationExecutor,
|
||||
} from "./http/http-studio-gateway.ts";
|
||||
import { createHttpStudioGateway } from "./http/http-studio-gateway.ts";
|
||||
import type { CsrfTokenProvider } from "./http/studio-session-csrf.ts";
|
||||
import { createMockStudioAssetGateway } from "./mock/mock-studio-asset-gateway.ts";
|
||||
import { createMockStudioGateway } from "./mock/mock-studio-gateway.ts";
|
||||
@@ -30,7 +30,7 @@ import { publicContentQueries } from "./static/public-query.ts";
|
||||
export type TechLogInstallContext = Readonly<{
|
||||
studioSource: "MOCK" | "HTTP";
|
||||
publicSource: "MOCK" | "HTTP";
|
||||
contractOperations: StudioOperationExecutor;
|
||||
http: InstalledHttpOperationExecutor;
|
||||
apiBaseUrl: string;
|
||||
requestTimeoutMs: number;
|
||||
csrf: CsrfTokenProvider;
|
||||
@@ -51,12 +51,14 @@ export function createTechLogFeatureInstalledInput(
|
||||
// lifetime — shares it, the same way a real backend's asset store outlives
|
||||
// any one editing session. It is never read on the HTTP branch.
|
||||
const mockAssets = new Map<string, Asset>();
|
||||
const http = createTechLogHttpBinding(context.http);
|
||||
|
||||
|
||||
const createStudioAssetGateway = () =>
|
||||
context.studioSource === "MOCK"
|
||||
? createMockStudioAssetGateway(mockAssets)
|
||||
: createHttpStudioAssetGateway({
|
||||
operations: context.contractOperations,
|
||||
http,
|
||||
csrf: context.csrf,
|
||||
upload: createAssetUploadTransport({
|
||||
baseUrl: context.apiBaseUrl,
|
||||
@@ -67,7 +69,7 @@ export function createTechLogFeatureInstalledInput(
|
||||
const createStudioGateway = () =>
|
||||
context.studioSource === "MOCK"
|
||||
? createMockStudioGateway({ assets: mockAssets })
|
||||
: createHttpStudioGateway({ operations: context.contractOperations });
|
||||
: createHttpStudioGateway({ http });
|
||||
|
||||
// The public read source switches independently of Studio: the two are
|
||||
// different services, and the combination that matters today is an authoring
|
||||
@@ -75,16 +77,21 @@ export function createTechLogFeatureInstalledInput(
|
||||
const publicContent =
|
||||
context.publicSource === "MOCK"
|
||||
? publicContentQueries
|
||||
: createHttpPublicContentGateway({ operations: context.contractOperations });
|
||||
: createHttpPublicContentGateway({ http });
|
||||
|
||||
const createManagementGateway = () =>
|
||||
createHttpManagementGateway({ operations: context.contractOperations });
|
||||
createHttpManagementGateway({ http });
|
||||
|
||||
const createStudioApplication = () =>
|
||||
createTechLogStudioApplication({
|
||||
studio: createStudioGateway(),
|
||||
assets: createStudioAssetGateway(),
|
||||
management: createManagementGateway(),
|
||||
});
|
||||
|
||||
const input: TechLogFeatureInput = Object.freeze({
|
||||
publicContent,
|
||||
createManagementGateway,
|
||||
createStudioGateway,
|
||||
createStudioAssetGateway,
|
||||
createStudioApplication,
|
||||
});
|
||||
|
||||
return Object.freeze({
|
||||
|
||||
Reference in New Issue
Block a user