On this page
Overview
Sends one complete mail report to a normalized HTTP(S) endpoint with timeout and complete response handling.
- Artifact
MailTransport.mjs· esm - Classification
public first party - Availability
Browser/server with fetch + cloud - Normalization
Endpoint, timeout, cancellation, network, HTTP, and response-contract errors are normalized.
Import and lifecycle
import * as module from '/arcane/modules/MailTransport.mjs';
normalizeMailEndpoint() is pure. sendMailReport() performs one HTTP(S) POST with same-origin credentials, no-referrer, redirect rejection, idempotency/app headers, an explicit caller timeout when supplied, and reads the complete response.
Application-facing behavior: MailTransportError, normalizeMailEndpoint(), serializeMailReport(), and sendMailReport().
Protocol and host implementation
HTTP(S) fetch + AbortController This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
MailTransportError | class | class MailTransportError extends Error | — |
normalizeMailEndpoint | function | function normalizeMailEndpoint(endpoint,base=globalThis.location?.href) | endpoint,base=globalThis.location?.href |
serializeMailReport | function | function serializeMailReport(report) | report |
sendMailReport | function | async function sendMailReport({
appKey,
appName,
endpoint,
fetchImpl=globalThis.fetch,
report,
reportKey,
requestTimeout=null,
serializedReport,
signal,
}) | {
appKey,
appName,
endpoint,
fetchImpl=globalThis.fetch,
report,
reportKey,
requestTimeout=null,
serializedReport,
signal,
} |
| Callable | Kind | Exact public signature | Parameter syntax |
|---|---|---|---|
normalizeMailEndpoint | exported-function | function normalizeMailEndpoint(endpoint,base=globalThis.location?.href) | endpoint,base=globalThis.location?.href |
sendMailReport | exported-function | async function sendMailReport({
appKey,
appName,
endpoint,
fetchImpl=globalThis.fetch,
report,
reportKey,
requestTimeout=null,
serializedReport,
signal,
}) | {
appKey,
appName,
endpoint,
fetchImpl=globalThis.fetch,
report,
reportKey,
requestTimeout=null,
serializedReport,
signal,
} |
| Member | Kind | Exact public declaration | Parameter syntax |
|---|---|---|---|
MailTransportError.constructor | constructor | constructor(message,{cause,code='MAIL_TRANSPORT_ERROR',details=null,retryable=false,
retryAfterMs=0,statusCode=0,uncertain=false}={}) | message,{cause,code='MAIL_TRANSPORT_ERROR',details=null,retryable=false,
retryAfterMs=0,statusCode=0,uncertain=false}={} |
Parameter meanings and results
normalizeMailEndpoint(endpoint,base?) returns an absolute HTTPS or loopback-HTTP URL without credentials/query/fragment. sendMailReport({appKey?,appName,endpoint,fetchImpl?,report,reportKey,requestTimeout=null,serializedReport?,signal?}) resolves the complete provider response plus normalized requestId, sent, partial, uncertain, status, statusCode, optional providerId, and retryAfterMs for the exact 202/207 response contract.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
This artifact has no additional documented lifecycle event flow.
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
MailTransportError extends Error
Documented failure behavior
- Uncoded Error for invalid endpoint, identity, key, timeout, report, timeout/network/HTTP failure, or an unreadable/invalid success response.
Availability and capabilities
Browser/server with fetch + cloud. Endpoint, timeout, cancellation, network, HTTP, and response-contract errors are normalized.
None; this is direct fetch transport. Core mail.send remains separate.
Contract example
import {normalizeMailEndpoint} from '/arcane/modules/MailTransport.mjs';
console.log(normalizeMailEndpoint('/v1/mail', 'https://mail.example.com/'));
Related reference
No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.