MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / extractAbortOptions

Function extractAbortOptions

packages/sql/src/AbstractSqlConnection.ts:29–42  ·  view source on GitHub ↗

* Pulls cancellation controls out of a `loggerContext` payload, returning the abort options * and a sanitized context that no longer carries them. The QueryBuilder/EM stash * `signal`/`inflightQueryAbortStrategy` on `loggerContext` to avoid widening the public * connection API; stripping them pre

(loggerContext?: LoggingOptions)

Source from the content-addressed store, hash-verified

27 * connection API; stripping them prevents leakage into user `Logger.logQuery` payloads.
28 */
29function extractAbortOptions(loggerContext?: LoggingOptions): {
30 abort?: AbortQueryOptions;
31 loggerContext?: LoggingOptions;
32} {
33 const ctx = loggerContext as (LoggingOptions & Partial<AbortQueryOptions>) | undefined;
34 if (ctx?.signal == null && ctx?.inflightQueryAbortStrategy == null) {
35 return { loggerContext };
36 }
37 const { signal, inflightQueryAbortStrategy, ...rest } = ctx;
38 return {
39 abort: { signal, inflightQueryAbortStrategy },
40 loggerContext: rest as LoggingOptions,
41 };
42}
43
44/** Base class for SQL database connections, built on top of Kysely. */
45export abstract class AbstractSqlConnection extends Connection {

Callers 2

executeFunction · 0.85
streamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected