Serializable grouped (policyGroupId, price) reservation context.

Constructors

  • Constructs a lock, optionally seeded from another lock or from an iterable of [policyGroupId, Price] pairs.

    Passing undefined/null yields an empty lock. Records with the same policyGroupId accumulate in insertion order.

    Errors

    Throws ParamError on an invalid policyGroupId, a malformed entry, or a non-iterable argument.

    Parameters

    • entries:
          | undefined
          | null
          | Lock
          | Iterable<LockEntry, any, any>

    Returns Lock

Properties

isEmpty: boolean

Returns true when the lock holds no price records.

length: number

Returns the number of stored price records.

Methods

  • Returns void

  • Returns a deep copy of this lock, holding the same records.

    Returns Lock

  • Returns every [policyGroupId, Price] pair as a [number, Price] array.

    Default-group records come first, then each non-default group in insertion order.

    Returns [number, Price][]

  • Returns true when both locks hold the same records in the same order.

    Parameters

    Returns boolean

  • Appends [policyGroupId, price] entries from an iterable.

    Each price accepts a Price object or a DecimalInput.

    Errors

    Throws ParamError on an invalid entry or a non-iterable argument.

    Parameters

    Returns void

  • Returns void

  • Appends every record from other into this lock.

    Parameters

    Returns void

  • Returns every stored price, in iteration order.

    Default-group records come first, then each non-default group in insertion order.

    Returns Price[]

  • Returns every price stored under policyGroupId, in insertion order.

    Errors

    Throws ParamError on an invalid policyGroupId.

    Parameters

    • policy_group_id: number

    Returns Price[]

  • Stores price under policyGroupId, preserving prior prices.

    price accepts a Price object or a DecimalInput.

    Errors

    Throws ParamError on an invalid policyGroupId or price.

    Parameters

    • policy_group_id: number
    • price:
          | string
          | number
          | bigint
          | Price

    Returns void

  • Stores every price under policyGroupId, preserving prior prices.

    prices is an iterable of Price objects or DecimalInput values.

    Errors

    Throws ParamError on an invalid policyGroupId or price.

    Parameters

    • policy_group_id: number
    • prices: Iterable<
          | string
          | number
          | bigint
          | Price, any, any>

    Returns void

  • Returns the number of stored price records.

    Returns number

  • Serializes the lock to its CBOR wire form (Uint8Array).

    Errors

    Throws ParamError if encoding fails (not reachable for a valid lock).

    Returns Uint8Array

  • Serializes the lock to its compact JSON wire form.

    Errors

    Throws ParamError if encoding fails (not reachable for a valid lock).

    Returns string

  • Serializes the lock to its MessagePack wire form (Uint8Array).

    Errors

    Throws ParamError if encoding fails (not reachable for a valid lock).

    Returns Uint8Array

  • Parses a lock from its CBOR wire form (Uint8Array).

    Errors

    Throws ParamError on malformed input.

    Parameters

    • data: Uint8Array

    Returns Lock

  • Parses a lock from its JSON wire form.

    Errors

    Throws ParamError on malformed input.

    Parameters

    • text: string

    Returns Lock

  • Parses a lock from its MessagePack wire form (Uint8Array).

    Errors

    Throws ParamError on malformed input.

    Parameters

    • data: Uint8Array

    Returns Lock