@ai2070/l0
Version:
L0: The Missing Reliability Substrate for AI
64 lines • 2.42 kB
TypeScript
export interface EffectSchema<A = unknown, I = unknown, R = never> {
readonly Type: A;
readonly Encoded: I;
readonly Context: R;
readonly ast: unknown;
readonly annotations: unknown;
}
export interface EffectParseError {
readonly _tag: "ParseError";
readonly issue: unknown;
message: string;
}
export type EffectParseResult<A> = {
readonly _tag: "Right";
readonly right: A;
} | {
readonly _tag: "Left";
readonly left: EffectParseError;
};
export declare function isEffectSchema(value: unknown): value is EffectSchema;
export declare function isEffectParseError(error: unknown): error is EffectParseError;
export declare function isEffectRight<A>(result: EffectParseResult<A>): result is {
readonly _tag: "Right";
readonly right: A;
};
export declare function isEffectLeft<A>(result: EffectParseResult<A>): result is {
readonly _tag: "Left";
readonly left: EffectParseError;
};
export type InferEffectSchema<S extends EffectSchema> = S["Type"];
export type InferEffectSchemaEncoded<S extends EffectSchema> = S["Encoded"];
export interface EffectDecodeOptions {
onError?: (error: EffectParseError) => void;
}
export interface EffectSchemaAdapter {
decodeUnknownSync: <A, I, R>(schema: EffectSchema<A, I, R>, data: unknown) => A;
decodeUnknownEither: <A, I, R>(schema: EffectSchema<A, I, R>, data: unknown) => EffectParseResult<A>;
formatError: (error: EffectParseError) => string;
}
export declare function registerEffectSchemaAdapter(adapter: EffectSchemaAdapter): void;
export declare function unregisterEffectSchemaAdapter(): void;
export declare function hasEffectSchemaAdapter(): boolean;
export declare function getEffectSchemaAdapter(): EffectSchemaAdapter;
export declare function safeDecodeEffectSchema<A, I, R>(schema: EffectSchema<A, I, R>, data: unknown): {
success: true;
data: A;
} | {
success: false;
error: EffectParseError;
};
export declare function getEffectErrorMessage(error: EffectParseError): string;
export interface UnifiedSchema<T = unknown> {
readonly _tag: "zod" | "effect";
parse(data: unknown): T;
safeParse(data: unknown): {
success: true;
data: T;
} | {
success: false;
error: Error;
};
}
export declare function wrapEffectSchema<A, I, R>(schema: EffectSchema<A, I, R>): UnifiedSchema<A>;
//# sourceMappingURL=effectSchemaCompat.d.ts.map