fix(PendingRequestMap): resolve type name conflict between env.ts interface and call.ts class
- Remove PendingRequestMap interface from env.ts (had reduced signature missing deadline, identity typed as unknown) - Add CallMap interface in env.ts with full call() signature matching the class - Update EnvOptions.callMap to use CallMap type - Export PendingRequestMap class directly (remove PendingRequestMapClass alias) - Export CallMap type from index.ts instead of old PendingRequestMap interface
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import { OperationType } from "./types.js";
|
||||
import type { OperationContext, OperationEnv } from "./types.js";
|
||||
import type { OperationContext, OperationEnv, Identity } from "./types.js";
|
||||
import type { OperationRegistry } from "./registry.js";
|
||||
import { getLogger } from "@logtape/logtape";
|
||||
|
||||
const logger = getLogger("operations:env");
|
||||
|
||||
export interface PendingRequestMap {
|
||||
call(operationId: string, input: unknown, options?: { parentRequestId?: string; identity?: unknown }): Promise<unknown>;
|
||||
export interface CallMap {
|
||||
call(operationId: string, input: unknown, options?: { parentRequestId?: string; deadline?: number; identity?: Identity }): Promise<unknown>;
|
||||
}
|
||||
|
||||
export interface EnvOptions {
|
||||
registry: OperationRegistry;
|
||||
context: OperationContext;
|
||||
allowedNamespaces?: string[];
|
||||
callMap?: PendingRequestMap;
|
||||
callMap?: CallMap;
|
||||
}
|
||||
|
||||
export function buildEnv(options: EnvOptions): OperationEnv {
|
||||
|
||||
@@ -3,7 +3,7 @@ export type { IOperationDefinition, OperationHandler, SubscriptionHandler, Ident
|
||||
export { OperationRegistry } from "./registry.js";
|
||||
export { formatValueErrors, assertIsSchema, validateOrThrow, collectErrors } from "./validation.js";
|
||||
export { buildEnv } from "./env.js";
|
||||
export type { PendingRequestMap, EnvOptions } from "./env.js";
|
||||
export type { CallMap, EnvOptions } from "./env.js";
|
||||
export { FromSchema } from "./from_schema.js";
|
||||
export { FromOpenAPI, FromOpenAPIFile, FromOpenAPIUrl } from "./from_openapi.js";
|
||||
export type { OpenAPISpec, OpenAPIOperation, OpenAPIParameter, HTTPServiceConfig, OpenAPIFS } from "./from_openapi.js";
|
||||
@@ -11,7 +11,7 @@ export { scanOperations } from "./scanner.js";
|
||||
export type { OperationManifest, ScannerFS } from "./scanner.js";
|
||||
export { CallError, InfrastructureErrorCode, mapError } from "./error.js";
|
||||
export type { CallErrorCode } from "./error.js";
|
||||
export { PendingRequestMap as PendingRequestMapClass, buildCallHandler } from "./call.js";
|
||||
export { PendingRequestMap, buildCallHandler } from "./call.js";
|
||||
export type { CallEventMap, CallEventMapValue, CallRequestedEvent, CallRespondedEvent, CallAbortedEvent, CallErrorEvent, CallHandler, CallHandlerConfig } from "./call.js";
|
||||
export { subscribe } from "./subscribe.js";
|
||||
export { createMCPClient, closeMCPClient, MCPClientLoader } from "./from_mcp.js";
|
||||
|
||||
Reference in New Issue
Block a user