import { NEXT_PUBLIC_LOG_INGEST_URL } from '../../../constants.js';
import { SHORTCUT_LOG_INGEST_ENDPOINTS } from '../../../endpoints.js';
/**
 * Thin HTTP transport for shipping ShortcutXL client logs to the shared logging ingress.
 */
export class HttpShortcutClientLogTransport {
    endpoint;
    fetchImpl;
    constructor(options = {}) {
        this.endpoint =
            options.endpoint ?? `${NEXT_PUBLIC_LOG_INGEST_URL}${SHORTCUT_LOG_INGEST_ENDPOINTS.logs}`;
        this.fetchImpl = options.fetchImpl ?? fetch;
    }
    async send(batch) {
        const response = await this.fetchImpl(this.endpoint, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify(batch)
        });
        if (!response.ok) {
            throw new Error(`client log ingest failed: ${response.status}`);
        }
    }
}
//# sourceMappingURL=transport.js.map