Type Alias LockFactorySettingsBase

LockFactorySettingsBase: {
    createLockId?: Invokable<[], string>;
    defaultRefreshTime?: ITimeSpan;
    defaultTtl?: ITimeSpan | null;
    eventBus?: EventBusInput;
    executionContext?: IExecutionContext;
    namespace?: INamespace;
    serde?: OneOrMore<ISerderRegister>;
    serdeTransformerName?: string;
    waitUntil?: WaitUntil;
}

Base configuration shared by all LockFactory variants.

IMPORT_PATH: "@daiso-tech/core/lock"

Type declaration

  • OptionalcreateLockId?: Invokable<[], string>

    You can pass your own lock id generator function.

    import { v4 } from "uuid";

    () => v4
  • OptionaldefaultRefreshTime?: ITimeSpan

    The default refresh time used in the ILock refresh method.

    import { TimeSpan } from "@daiso-tech/core/time-span";

    TimeSpan.fromMinutes(5);
  • OptionaldefaultTtl?: ITimeSpan | null

    You can decide the default ttl value for ILock expiration. If null is passed then no ttl will be used by default.

    import { TimeSpan } from "@daiso-tech/core/time-span";

    TimeSpan.fromMinutes(5);
  • 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()
  • Optionalserde?: OneOrMore<ISerderRegister>

    You can pass an ISerderRegister instance to the LockFactory to register the lock'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 registered serde transformer name used to identify lock serializer and deserializer adapters 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"