feat: 기능 추가 과정중

This commit is contained in:
donghyeon-ka
2026-07-30 15:58:20 +09:00
parent d3ef801fe6
commit 6c52cdb916
648 changed files with 126325 additions and 6680 deletions
+12 -5
View File
@@ -1,7 +1,9 @@
import { z } from "zod";
import type { createHttpClient } from "../../src/adapters/http/client.js";
import { canonicalize } from "../../src/contracts/query-keys.js";
import type { createHttpClient } from "../../src/adapters/http/client.ts";
import { canonicalize } from "../../src/contracts/query-keys.ts";
import { mappingSuccess } from "../../src/contracts/boundary-mapper.ts";
import { createDemoSessionAdapter } from "../../src/adapters/auth/external-session-adapter.ts";
const entitySchema = z
.object({
@@ -73,6 +75,7 @@ function project(schema: z.ZodType | undefined, value: unknown): Validation {
type HttpDependencies = Parameters<typeof createHttpClient>[0];
export const TEST_HTTP_CONTRACT = Object.freeze({
authSession: createDemoSessionAdapter("authenticated"),
getOperation(operationId: string) {
const operation =
TEST_OPERATIONS[operationId as keyof typeof TEST_OPERATIONS];
@@ -97,12 +100,16 @@ export const TEST_HTTP_CONTRACT = Object.freeze({
return { id: entity.id, displayName: entity.name };
};
if (operationId === "LIST_ENTITIES") {
return (payload as readonly unknown[]).map(mapOne);
return mappingSuccess((payload as readonly unknown[]).map(mapOne));
}
if (operationId === "CREATE_ENTITY") return mapOne(payload);
if (operationId === "CREATE_ENTITY") return mappingSuccess(mapOne(payload));
throw new Error(`Unknown test mapper: ${operationId}`);
},
}) satisfies Pick<
HttpDependencies,
"getOperation" | "validatePayload" | "validateRequest" | "mapPayload"
| "authSession"
| "getOperation"
| "validatePayload"
| "validateRequest"
| "mapPayload"
>;