client.asyncJobs for polling long-running jobs, and client.on(...) for subscribing to SDK lifecycle events.
Async Jobs
Endpoints that kick off long-running work — currently adverse media screening — return ajobId immediately. Most callers use the typed handle from the originating method (screening.adverseMedia(...)), but client.asyncJobs.get(jobId) lets you resume polling a jobId you persisted earlier (for example, across process restarts).
get(jobId)
Returns
AsyncJobSnapshot — a discriminated union on status. result is typed as unknown because the async-jobs surface is service-agnostic; re-parse it against the originating service’s schema to narrow it.
createdAt is epoch seconds (a number); updatedAt is an ISO 8601 string. ready and failed are the terminal states.ValidationError (empty jobId), AuthenticationError (401), AuthorizationError (403), NotFoundError (404 — unknown ID or pruned by TTL), DeepIDVError.
Events
The SDK emits lifecycle events for observability, logging, and APM integration. Subscribe withclient.on(event, listener).
on(event, listener)
Event map
Execution model
Events dispatch synchronously within the request flow, in registration order. The SDK does not await listener return values. Therefore:- Listeners should not perform heavy blocking work — use async logging instead.
- Listeners cannot modify the request or response — payloads are read-only.
Listener error safety
If a listener throws, the SDK catches the exception, emits awarning event with the details, and continues processing normally — a broken listener never crashes a request. If a warning listener itself throws, that exception is silently swallowed to prevent infinite recursion.