Type Alias RateLimiterFactorySettingsBase

RateLimiterFactorySettingsBase: {
    defaultErrorPolicy?: ErrorPolicy;
    enableAsyncTracking?: boolean;
    eventBus?: EventBusInput;
    executionContext?: IExecutionContext;
    namespace?: INamespace;
    onlyError?: boolean;
    serde?: OneOrMore<ISerderRegister>;
    serdeTransformerName?: string;
    waitUntil?: WaitUntil;
}

Base configuration shared by all RateLimiterFactory variants.

IMPORT_PATH: "@daiso-tech/core/rate-limiter"

Type declaration

  • OptionaldefaultErrorPolicy?: ErrorPolicy

    You can set the default ErrorPolicy

    (_error: unknown) => true
    
  • OptionalenableAsyncTracking?: boolean

    If true, metric tracking will run asynchronously in the background and won't block the function utilizing the circuit breaker logic. This will only have effect if onlyError settings is true.

    true
    
  • OptionaleventBus?: EventBusInput

    You can provide an IEventBus or an IEventBusAdapter instance to handle the component's events. If you provide an adapter, it will be automatically wrapped in an EventBus instance.

    import { NoOpEventBusAdapter } from "@daiso-tech/core/event-bus/no-op-event-bus-adapter";

    new NoOpEventBusAdapter()
  • OptionalexecutionContext?: IExecutionContext

    You can pass IExecutionContext that will be used by context-aware adapters.

    import { ExecutionContext } from "@daiso-tech/core/execution-context"
    import { NoOpExecutionContextAdapter } from "@daiso-tech/core/execution-context/no-op-execution-context-adapter"

    new ExecutionContext(new NoOpExecutionContextAdapter())
  • Optionalnamespace?: INamespace
    import { NoOpNamespace } from "@daiso-tech/core/namespace";

    new NoOpNamespace()
  • OptionalonlyError?: boolean

    If true will only apply rate limiting when function errors and not when function is called.

    false
    
  • Optionalserde?: OneOrMore<ISerderRegister>

    You can pass an ISerderRegister instance to the RateLimiterFactory to register the rate limiter's serialization and deserialization logic for the provided adapter.

    import { Serde } from "@daiso-tech/core/serde";
    import { NoOpSerdeAdapter } from "@daiso-tech/core/serde/no-op-serde-adapter";

    new Serde(new NoOpSerdeAdapter())
  • OptionalserdeTransformerName?: string

    The serde transformer name used to identify rate-limiter serializers and deserializers when there are adapters with the same name.

    ""
    
  • OptionalwaitUntil?: WaitUntil

    You can pass the waitUntil function to handle background promises. This is required when working with environments like Cloudflare Workers or Vercel Functions to ensure tasks complete after the response is sent.

    import { defaultWaitUntil } from "@daiso-tech/core/utilities"