UNPKG

@ritas-inc/sapb1commandapi-client

Version:

A stateless TypeScript client for SAP B1 Service Layer Command API with comprehensive error handling, type safety, and batch operations

45 lines (44 loc) 1.36 kB
import { z } from 'zod'; import { ErrorResponseSchema } from '../schemas/common.schema.js'; type ErrorResponse = z.infer<typeof ErrorResponseSchema>; export declare class SAPB1APIError extends Error { readonly status: number; readonly type: string; readonly title: string; readonly detail: string; readonly instance: string; readonly context: { request: string; responseText: string; }; readonly issues: string[]; constructor(errorResponse: ErrorResponse['problem']); toJSON(): { name: string; status: number; type: string; title: string; detail: string; instance: string; context: { request: string; responseText: string; }; issues: string[]; }; } export declare class AuthError extends SAPB1APIError { constructor(errorResponse: ErrorResponse['problem']); } export declare class NetworkError extends Error { readonly code?: string; readonly request?: any; readonly response?: any; constructor(message: string, code?: string, request?: any, response?: any); } export declare class ValidationError extends Error { readonly issues: any[]; constructor(message: string, issues: any[]); } export declare function isErrorResponse(response: any): response is ErrorResponse; export {};